aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-guardmgr/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * Make ChannelMethod non-exhaustiveIan Jackson2022-11-242-1/+27
| | | | | | | | | | | | | | | | | | Enums with variants conditional on cargo features must be non-exhaustive, because cargo features are supposed to be additive, meaning that enabling a feature (which might happen due to some random distant thing) ought not to break things using that enum. There were surprisingly few places to fix this.
* | Merge branch 'reconfig-bridges-bad' into 'main'Nick Mathewson2022-11-273-11/+63
|\ \ | |/ |/| | | | | | | | | Require state ownership when using bridges Closes #612 See merge request tpo/core/arti!889
| * tor-guardmgr: rustfmt for recent changesIan Jackson2022-11-242-5/+6
| | | | | | | | Left unsquashed for ease of review
| * tor-guardmgr: NoLock error: add TODO for trying to get lockIan Jackson2022-11-241-0/+2
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/889#note_2856874
| * tor-config: Rename to ReconfigureError::UnsupportedSituationIan Jackson2022-11-241-1/+1
| | | | | | | | | | | | | | | | From Unsupported. Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/889#note_2856873 This was added in this MR. Also add the missing semver note.
| * tor-config: Rename to ConfigBuildError::NoCompileTimeSupportIan Jackson2022-11-241-1/+1
| | | | | | | | | | | | | | | | | | From Unsupported. Following one of the suggestions here https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/889#note_2856873 This was added in 2c3711614908d0c9cf1663b20b67a3fc233301f4 which was not yet in a release so this isn't a semver break. I have added the semver note that was omitted in that MR.
| * tor-guardmgr: Refuse to configure bridges if we don't have the lockIan Jackson2022-11-232-1/+18
| | | | | | | | Fixes #612
| * tor-guardmgr: make replace_bridge_config fallibleIan Jackson2022-11-232-7/+38
| | | | | | | | | | | | The error type needs to be convertible to GuardMgrError and also to ReconfigureError. Neither of those is right, so we need a new error type.
| * tor-guardmgr: Replace a let _ignore with a typed versionIan Jackson2022-11-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | `let _ignore =` isn't great because if the function called is currently infallible, but becomes fallible, it suppresses the detection of the error check. A better pattern is to specify the type of the ignored value. I'm about to do precisely this, here. I did a git-grep and `let _ignore =` seems very common. Let's not deal with all those now.
* | Merge branch 'bridge-config-arc' into 'main'Nick Mathewson2022-11-233-29/+43
|\ \ | | | | | | | | | | | | | | | | | | Make BridgeConfig be Arc, so no Arc<BridgeConfig> Closes #635 See merge request tpo/core/arti!885
| * | BridgeConfig: Replace all Arc<BridgeConfig> with BridgeConfigIan Jackson2022-11-222-7/+3
| | | | | | | | | | | | BridgeConfig is itself an Arc now, so these are redundant.
| * | BridgeConfig: Make it be a newtype around Arc<Inner>Ian Jackson2022-11-221-21/+40
| | | | | | | | | | | | | | | This leaves the external API of this type unchanged, but now it's much smaller and quite cheap to clone.
| * | bridge config: Remove a done TODOIan Jackson2022-11-221-1/+0
| | | | | | | | | | | | This was done by !874 and #604 closed accordingly.
* | | Merge branch 'test-config' into 'main'Ian Jackson2022-11-232-2/+2
|\ \ \ | | | | | | | | | | | | | | | | tor-guardmgr: Fix visibility of TestConfig with no features enabled See merge request tpo/core/arti!875
| * | | tor-guardmgr: Fix visibility of TestConfig with no features enabledIan Jackson2022-11-182-2/+2
| | | | | | | | | | | | | | | | | | | | Without this, tor-guardmgr tests don't build when run without the crate's own testing feature enabled.
* | | | Merge branch 'remove_deadcode_allow' into 'main'Nick Mathewson2022-11-231-1/+0
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | guardmgr: Remove a now-unneeded "allow(dead_code)" See merge request tpo/core/arti!862
| * | | guardmgr: Remove a now-unneeded "allow(dead_code)"Nick Mathewson2022-11-161-1/+0
| | | |
* | | | CircMgr: retire all circuits if bridge configuration changes.Nick Mathewson2022-11-221-7/+40
| |_|/ |/| | | | | | | | Closes #650.
* | | bridge config parsing tests: Show expected error message in asssrtIan Jackson2022-11-221-2/+3
| | |
* | | bridge config parsing: Parse transport as TransportId (fmt)Ian Jackson2022-11-221-17/+15
| | |
* | | bridge config parsing: Parse transport as TransportIdIan Jackson2022-11-221-11/+23
| | | | | | | | | | | | Fixes #653
* | | bridge config parsing: Move unsupported blockIan Jackson2022-11-221-7/+7
| | | | | | | | | | | | This will make the next commit textually smaller.
* | | bridge non-support: Add doc notes to GuardMgrConfig::bridges_enabledIan Jackson2022-11-211-0/+7
| | |
* | | bridge non-support: Provide a better BridgeConfigBuilderIan Jackson2022-11-212-3/+47
| | | | | | | | | | | | | | | This type now does all the things people expect of it: you can (try to) deserialize it, parse it from a string, and call build on it.
* | | bridge config: Feature-gate the error variantsIan Jackson2022-11-211-0/+9
| | | | | | | | | | | | | | | | | | | | | This leaves this enum empty of actual errors, when bridge-client is disabled. We're going to add the not supported variant in a moment.
* | | bridge config: Move error to its own fileIan Jackson2022-11-212-104/+112
| | | | | | | | | | | | | | | | | | | | | | | | The dummy module is going to need an error type just like this but with only the disabled variant. To avoid that dummy enum getting out of step with the nontrivial one, we're going to make them the same. So as a first step, break this out into its own file.
* | | bridge non-support: Move dummy bridge module into own fileIan Jackson2022-11-212-22/+23
| | | | | | | | | | | | | | | A bit more stuff is going to appear here, so it's getting to be rather much for an inline module.
* | | tor-config: introduce ConfigBuildError::UnsupportedIan Jackson2022-11-211-1/+1
| | | | | | | | | | | | And use it in bridge configuration parsing.
* | | bridge config builder: Introduce error constructor helpers (fmt noise)Ian Jackson2022-11-211-12/+12
| | |
* | | bridge config builder: Introduce error constructor helpersIan Jackson2022-11-211-40/+47
| | | | | | | | | | | | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/874/diffs?commit_id=12d13428d8fcc68b7b0f231bac9fc130b3eeb18b#d53209cbcd12771c549f3a130379ecb65dd60145_100_193
* | | bridge config builder: Document one id of each type restrictionIan Jackson2022-11-211-0/+2
| | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/874/diffs?commit_id=620cc90f6dcdad20f49a001a9e04d191a323e904#d53209cbcd12771c549f3a130379ecb65dd60145_100_124
* | | bridge config builder: Document PT one address restrictionIan Jackson2022-11-211-0/+2
| | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/874/diffs?commit_id=620cc90f6dcdad20f49a001a9e04d191a323e904#d53209cbcd12771c549f3a130379ecb65dd60145_100_121
* | | BridgeConfigBuilder: Allow (de)ser to/from bridge linesIan Jackson2022-11-211-2/+39
| | | | | | | | | | | | | | | | | | That the *de*serialisation works as expected will be tested properly in just a moment, because when we plumb this all the way through, it will be what parses the bridge lines in the example config file.
* | | BridgeConfigBuilder: Implement FromStrIan Jackson2022-11-211-1/+46
| | |
* | | BridgeConfigBuilder: Introduce build() functionIan Jackson2022-11-211-8/+255
| | | | | | | | | | | | And test cases for it, and its errors.
* | | BridgeConfigBuilder: Introduce the struct with the dictionary reprIan Jackson2022-11-213-6/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This struct is going to be the principal "dictionary-style" serde representation for a bridge, and the builder, making this all in keeping with our usual approach. In this commit: * Introduce the struct (defining the serialisation) * Provide the setters (defining the Rust API) * Add success test cases (not all of the data in which is used yet)
* | | BridgeAddr rename: update tor_guardmgr::bridge::configIan Jackson2022-11-211-5/+5
| |/ |/| | | | | | | Here is where my motivation is and I'm working on this code now, so do this renaming cleanup now.
* | Merge branch 'log_guard_status' into 'main'Nick Mathewson2022-11-182-21/+38
|\ \ | | | | | | | | | | | | | | | | | | GuardMgr: Log significant guard/bridge status changes at info/warn Closes #627 See merge request tpo/core/arti!869
| * | GuardMgr: Log when a guard status changes (significantly).Nick Mathewson2022-11-171-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We previously had a trace message on _every_ change. That's fine, but we also want to log more important changes where the user can see them. Namely: * If we go from any other status to Reachable, we want to tell the user. (We don't want to spam them if it was already reachable.) * If we go from Untried or Reachable to Unreachable, we want to tell the user. (We don't tell them about changes from Retriable to Unreachable, since that just means that a retry attempt was not successful.) Closes #627.
| * | GuardMgr: split Reachable::Unknown into Untried and RetriableNick Mathewson2022-11-172-20/+21
| |/ | | | | | | | | | | | | | | There are two cases here, and we will want to log them differently. (By removing the "Unknown" variant entirely, we ensure that we didn't miss any code that formerly checked for Unknown.)
* | GuardMgr: Add Instant to update().Nick Mathewson2022-11-162-20/+38
| | | | | | | | | | | | | | | | | | | | | | This lets us avoid calling `Instant::now()`, when `Runtime::now()` is what we want. Unfortunately, there are a bunch of functions that called `update()` that needed to change. Fortunately, none of the changes were very complicated. Fixes a `TODO pt-client` comment.
* | GuardMgr: Rename "now" arg in update() to "wallclock"Nick Mathewson2022-11-161-10/+10
|/ | | | | | | I'm about to add an `Instant` argument. By convention, when we have both, we call the Instant "now". This commit is a pure renaming.
* Allow a subset-only ChanMethod match when looking up a BridgeConfigNick Mathewson2022-11-151-1/+5
| | | | | | | | | If we have a bridge guard that is using Direct connection and it knows multiple addresses, our code to match it with a BridgeConfig is wrong, because the BridgeConfig has only one address, and our code looks for an exact match. Fixes #642.
* guardmgr: Document that guardmgr only holds a WeakIan Jackson2022-11-151-0/+5
|
* Merge branch 'make_bridges_work' into 'main'Nick Mathewson2022-11-141-0/+1
|\ | | | | | | | | Bugfix: preserve active_set when loading guards See merge request tpo/core/arti!848
| * Preserve active_set when loading guards.Nick Mathewson2022-11-141-0/+1
| |
* | Merge branch 'report_missing_descs' into 'main'Nick Mathewson2022-11-143-1/+66
|\| | | | | | | | | | | | | GuardMgr: Update desired bridge descs from 'update' function. Closes #622 See merge request tpo/core/arti!847
| * GuardMgr: Update desired bridge descs from 'update' function.Nick Mathewson2022-11-142-1/+29
| | | | | | | | | | There are some new TODOs here for us to think about, but I think this will give us something to test.
| * GuardSet: Add a method to report which bridge descs we want.Nick Mathewson2022-11-141-0/+37
| |
* | Merge branch 'guardmgr' into 'main'Ian Jackson2022-11-141-0/+2
|\ \ | |/ |/| | | | | Move guardmgr creation to arti-client, rather than within circmgr See merge request tpo/core/arti!850