aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-guardmgr/src/bridge
Commit message (Collapse)AuthorAgeFilesLines
...
* 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-211-5/+122
| | | | | | | | | | | 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.
* 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: Update desired bridge descs from 'update' function.Nick Mathewson2022-11-141-1/+1
| | | | | There are some new TODOs here for us to think about, but I think this will give us something to test.
* GuardMgr: Explain why we timestamp BridgeSets as we do.Nick Mathewson2022-11-101-8/+7
|
* GuardMgr Document why a BridgeSet has trivial weight thresholds.Nick Mathewson2022-11-101-0/+4
| | | | | | This is the only way I could find in which parameter interpretation differs between bridge guards and relay guards; with it documented, I can remove a TODO about identifying such ways.
* Remove TODO to rename for_circuit_usage in favor of #623Nick Mathewson2022-11-101-1/+0
|
* Resolve todo!()s and TODOs around BridgeRelay::HasAddrs.Nick Mathewson2022-11-101-15/+35
| | | | | | | Also, add a bunch of reminders around these implementations that `HasAddrs` returns all the address associated with you for GeoIp or family purposes, even if they are _not_ ones that we should actually contact you at.
* GuardMgr: Docs for BridgeDescProviderNick Mathewson2022-11-081-2/+12
|
* GuardMgr: Remove a TODO pt-client comment.Nick Mathewson2022-11-081-2/+0
| | | | | The BridgeSet type does not necessarily need further changes... and if it gets them, it won't be because of this comment.
* Merge branch 'store' into 'main'Nick Mathewson2022-11-081-2/+2
|\ | | | | | | | | | | | | Persistently cache bridge descriptors Closes #619 See merge request tpo/core/arti!831
| * bridge descs: Rename BridgeDescMgr from BridgeDescManagerIan Jackson2022-11-081-2/+2
| | | | | | | | | | | | This is more consistent with our naming elsewhere. Suggested-by: Nick Mathewson <[email protected]>
* | GuardMgr: Remove no-longer-relevant `TODO pt-client` commentsNick Mathewson2022-11-082-12/+0
| | | | | | | | | | Also remove a bunch of now-unnecessary `allow(dead_code)` annotations.
* | GuardMgr: Rename an error variantNick Mathewson2022-11-081-2/+2
| |
* | GuardMgr: Spelling fixes and normalizations.Nick Mathewson2022-11-081-2/+2
| |
* | GuardMgr: When possible, return a FirstHop that can be a CircTargetNick Mathewson2022-11-081-1/+1
| | | | | | | | | | | | We do this by checking the FirstHops we're about to return, and when they correspond to bridges, looking up an appropriate BridgeRelay in the current BridgeSet (if we can).
* | GuardMgr: Refactor UniverseRef to contains Arcs.Nick Mathewson2022-11-081-8/+8
| | | | | | | | | | | | We already _have_ these Arc<>s whenever we construct a UniverseRef, so there's no real point in using &refs and making these so hard to construct.
* | GuardMgr: Change BridgeSet, BridgeRelay to use more referencesNick Mathewson2022-11-082-29/+27
| | | | | | | | | | | | | | This will match our needs better and help avoid some `Arc<>`s. It will be especially helpful for avoiding `Arc`s we don't actually have.
* | Require Send+Sync for BridgeDescProviderNick Mathewson2022-11-081-1/+1
| | | | | | | | We require these for NetDirProvider, so this shouldn't be a big reach.
* | bridge desc: Make BridgeDescProvider DynCloneIan Jackson2022-11-071-1/+3
|/ | | | | This allows the use of Box<dyn BridgeDescProvider> in callers, since Box<dyn BridgeDescProvider> is now Clone.
* Refactor CandidateStatus API to simplify code in descs.Nick Mathewson2022-11-021-26/+31
| | | | This removes some duplication.
* guardmgr: Refactor candidate info; add `full_dir_info`Nick Mathewson2022-11-021-5/+12
| | | | | | | Previously we always set `dir_info_missing` to `false` for new guards, since new guards could only be taken from ones that were present in the NetDir. But for bridges, we don't download their info until _after_ we have chosen them as guards.
* guardmgr: Implement Universe for bridges.Nick Mathewson2022-11-022-1/+160
| | | | | Now we can use a group of bridges as the basis for a sample of guards.
* BridgeDescProvider: Make BridgeDescEvent repr(u16) and derive traitsIan Jackson2022-10-271-1/+6
| | | | This will enable us to impl FlagEvent for it.
* impl Hash for BridgeConfig and various PT informationIan Jackson2022-10-271-1/+1
| | | | | The bridge descriptor manager wants to index data structures by the BridgeConfig.
* BridgeDescEvent: Change the sole variant to SomethingChangedIan Jackson2022-10-251-5/+17
| | | | And explain what this all means.
* tor-guardmgr: descs: Make BridgeDescError DynCloneIan Jackson2022-10-211-1/+4
|
* tor-guardmgr: descs: Make BridgeDescError into a traitIan Jackson2022-10-211-4/+15
|
* Merge branch 'bridge-internal-apis' into 'main'Ian Jackson2022-10-201-3/+12
|\ | | | | | | | | Use BridgeConfig to identify bridges in two places See merge request tpo/core/arti!781
| * bridge descriptors: Change types of the descriptor cacheIan Jackson2022-10-201-3/+12
| | | | | | | | | | | | | | Now keyed by Arc<BridgeConfig>, and the values can be errors. Currently there is no implementation so there can't be any errors, but the error enum will become nonempty.
* | impl ChanTarget etc. for BridgeConfigIan Jackson2022-10-201-1/+17
|/
* struct BridgeConfig: Rename from BridgeIan Jackson2022-10-122-16/+16
| | | | Fixes #599
* struct Bridge: add ref to ticketIan Jackson2022-10-121-1/+1
|
* Allow "clippy::single_char_pattern" in tests.Ian Jackson2022-10-121-0/+1
| | | | | | | This lint exists for perf reasons, and this is rarely relevant in tests. Using double quoted str is generally cognitively less burdensome.
* Change multiplicity of ChannelMethod and addressesNick Mathewson2022-10-112-8/+14
| | | | | | | Now each `ChanTarget` has at most one `ChannelMethod`, and only `Direct` `ChannelMethods` can have multiple addresses. Closes #600.
* tor-guardmgr: Fix build without pt-client featureIan Jackson2022-10-111-1/+3
|
* Begin revising HasAddr and its relationship to ChanTargetNick Mathewson2022-10-061-1/+15
| | | | | | | | | | | | | | | | | | | HasAddr used to mean "Here are addresses that I have, at which I can be contacted." But "Where (and how) can I be contacted?" is now a question for HasChannelMethod to answer. (We still need to have "HasAddr", though, so we can answer things like "what country is this relay in" and "are these relays in the same /8?") So this commit introduces: * A new trait for adding an implementation of HasChannelMethod in terms of HasAddr. * A requirement on ChanTarget that it needs to implement HasChannelMethod. There is some temporary breakage here, marked with "TODO pt-client", that I'll fix later in this branch.
* Extend some comments about bridge descriptorsNick Mathewson2022-10-062-2/+11
|
* Add a temporary HasAddrs for BridgeRelayNick Mathewson2022-10-041-1/+10
| | | | See comment for an explanation of the next issue here.
* BridgeRelay: Implement more traits.Nick Mathewson2022-10-041-1/+56
| | | | | | Also add a BridgeRelayWithDesc type (name tbd) to guarantee that a bridge relay really does have a known descriptor before you try to build a circuit with it.
* Start on a new BridgeRelay type.Nick Mathewson2022-10-041-0/+38
| | | | | | | | This is the one we'll actually use to connect to bridges. It has a `Bridge` line, and an optional `BridgeDesc`. Maybe this will turn into a `BridgeRelay<'a>` by analogy to `Relay` some time; I'm not sure.
* Implement HasRelayIds for Bridge.Nick Mathewson2022-10-041-1/+11
|
* Implement BridgeDesc and BridgeDescList.Nick Mathewson2022-10-041-58/+41
| | | | | | | | | | BridgeDesc is a separate type to make sure that we do not confuse bridges' descriptors with the descriptors from other routers down the road. (Bridges' descriptors need to be used differently, and treated as more private.) With this code, BridgerDescList is now just an alias for `ByRelayIds<BridgeDesc>`, which is pretty keen.
* pt: bridge line parsing: overhaul errorsIan Jackson2022-10-031-36/+107
| | | | | | | | | | | | | Include the offending word in all the applicable errors. Always print it with {word:?}. As a consequence, there are no From impls any more and error generation/conversion is by hand in all cases. Clarify InvalidPtOrAddr vs InvalidIAddrorPt, and don't make the attempted parse be a source error for those. Where we still have source errors, don't print them in Display.
* pt: Check PT key=value syntaxIan Jackson2022-10-031-3/+0
| | | | | This is not perfect but it at least ensures that our own parsing and printing code works correctly with all the values we accept.
* pt: Make PtTarget::push_setting fallible, and take IntoIan Jackson2022-10-031-3/+8
| | | | | | It has its own error type PtTargetInvalidSetting. In check_doc_features, adjust suppression to new code.
* pt: bridge line parsing: Add commentaryIan Jackson2022-10-031-0/+26
|
* pt: Document Bridge line syntaxIan Jackson2022-10-031-0/+31
|