summaryrefslogtreecommitdiff
path: root/crates/tor-linkspec
Commit message (Collapse)AuthorAgeFilesLines
...
* guardmgr: Refactor the interior of FirstHop.Nick Mathewson2022-10-243-26/+89
| | | | | | | | | | | | | Now it contains either an `OwnedChanTarget` or an `OwnedCircTarget`, which will let `GuardMgr` return bridges that can be used to make circuits. As part of this change, it was necessary to revise some address-modification functions that applied to filters and `OwnedChanTarget`. Now they do the smart thing, and remove only the address that are in the `ChanMethod`. This means that the addresses from HasAddrs are still accurate about which addresses the relay "has".
* linkspec: Add compare-by-relay-ids function to HasRelayIdsNick Mathewson2022-10-213-3/+74
|
* Merge branch 'pt-serde' into 'main'Nick Mathewson2022-10-203-72/+25
|\ | | | | | | | | serde support for PtTarget See merge request tpo/core/arti!780
| * Implement serde for PtTarget and its members.Nick Mathewson2022-10-202-5/+20
| | | | | | | | This will let us remember bridges that use pluggable transports.
| * Inline now-needless variant constructors for PtTargetAddrNick Mathewson2022-10-201-22/+2
| |
| * Remove a now-needless `allow(dead_code)`Nick Mathewson2022-10-201-1/+0
| |
| * linkspec: Always expose PT-related types.Nick Mathewson2022-10-202-46/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `PtTarget` type and its contents (`TransportName`, `PtTargetAddr`, `PtSettings`) are now unconditionally compiled and exposed. This will allow us to serialize and deserialize them in our guard-state files even when we have been built without explicit PT support. The `pt-client` feature controls whether `TransportName` is a variant of `TransportId`, and whether `PtTarget` is a variant of `ChanMethod`: this in turn means that we'll still have simpler binary code and smaller structures when we're building without PT support (which is what we wanted when we initially made these types conditional).
* | Merge branch 'bridge-internal-apis' into 'main'Ian Jackson2022-10-201-1/+7
|\ \ | |/ |/| | | | | Use BridgeConfig to identify bridges in two places See merge request tpo/core/arti!781
| * tor-linkspec: impl From<&ChanTarget> for OwnedChanTargetIan Jackson2022-10-201-1/+7
| | | | | | | | | | | | This lets us write functions which can either take an existing owned OwnedChanTarget, or copy out of some other kind of ChanTarget passed by reference.
* | impl HasAddrs for PtChannelAddr and ChannelMethodIan Jackson2022-10-201-0/+29
| |
* | HasAddrs: Make it clear that the set of addresses can be emptyIan Jackson2022-10-201-1/+4
|/ | | | Eg, a PT bridge may not have an address.
* linkspec: Fix typo in error messages.Nick Mathewson2022-10-181-2/+2
|
* linkspec: Add ByRelayIds::remove_exact.Nick Mathewson2022-10-181-0/+65
| | | | | We need a function to remove an entry if it appears with _exactly_ the same relay Ids, but not otherwise. This method will do that.
* linkspec: Add an "all_overlapping" accessor to ByRelayIds.Nick Mathewson2022-10-183-1/+117
| | | | | | | Also, add a few tests for this and the other accessors. We'll need this accessor to find whether we have any channels to _any_ of the identities that we're trying to connect to.
* Write more tests for RelayId and RelayIdRef.Nick Mathewson2022-10-151-0/+138
|
* Write tests for RelayIdSet.Nick Mathewson2022-10-152-0/+121
|
* Fix deserialize impl for RelayId.Nick Mathewson2022-10-151-1/+1
| | | | | | | We need to handle String, not just str, since some deserializers have to handle escapes and generate new strings. Found while writing tests; fixes #605.
* linkspec: impl Hash for RelayIdRefNick Mathewson2022-10-152-1/+3
|
* Fix some rustdoc errors.Nick Mathewson2022-10-131-1/+1
| | | | | | In addition to the usual "You named that method wrong!" errors, we have a new rustdoc error that complains about bogus "HTML tags" that are actually unquoted usage of types like `Result<Foo>`.
* Merge branch 'factory_redux' into 'main'Nick Mathewson2022-10-131-0/+33
|\ | | | | | | | | chanmgr: Build and use chanmgr factory APIs See merge request tpo/core/arti!769
| * Add several accessors to ChannelMethod.Nick Mathewson2022-10-121-0/+33
| | | | | | | | | | | | * Get `TransportId` * Get the target address (of any type) * Ask, "is this a direct connection"?
* | cargo fmt to remove blank linesIan Jackson2022-10-121-1/+0
| | | | | | | | | | | | | | Apparently cargo fmt doesn't like these, which my perl rune didn't delete. This commit is precisely the result of `cargo fmt`.
* | Replace all README copies in src/lib.rs with includesIan Jackson2022-10-121-55/+1
|/ | | | | | | | The feature we want is `#[doc = include_str!("README.md")]`, which is stable since 1.54 and our MSRV is now 1.56. This commit is precisely the result of the following Perl rune: perl -i~ -0777 -pe 's{(^//!(?!.*\@\@).*\n)+}{#![doc = include_str!("../README.md")]\n}m' crates/*/src/lib.rs
* Fix a warning that I reintroduced.Nick Mathewson2022-10-111-0/+1
| | | | | It looks like this got fixed, but my branch for !759 reintroduced it by refactoring.
* Change multiplicity of ChannelMethod and addressesNick Mathewson2022-10-114-34/+35
| | | | | | | Now each `ChanTarget` has at most one `ChannelMethod`, and only `Direct` `ChannelMethods` can have multiple addresses. Closes #600.
* Allow two useless pattern matches that are going to be not uselessIan Jackson2022-10-111-0/+1
|
* Clarify limits on socket address from ChannelMethodNick Mathewson2022-10-061-2/+8
|
* Move two users of HasAddrs to HasChannelMethodsNick Mathewson2022-10-061-2/+4
| | | | All the other users of HasAddrs are correct.
* tor-linkspec: Remove the old OwnedFoo::new() functionsNick Mathewson2022-10-061-56/+21
| | | | These are now builders.
* ChannelMethod: Add method to access the (optional) SocketAddrNick Mathewson2022-10-061-0/+18
|
* Add builders for OwnedChanTarget/OwnedCircTargetNick Mathewson2022-10-063-13/+63
| | | | | This will become the preferred way to make one of these objects, and insulate us against future API changes.
* Begin revising HasAddr and its relationship to ChanTargetNick Mathewson2022-10-064-15/+62
| | | | | | | | | | | | | | | | | | | 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.
* tor-linkspec: ByRelayIds<> type to hold a set of HasRelayIdsNick Mathewson2022-10-045-1/+68
| | | | | This is based on the type generated with n_key_set, with a couple of extra methods to take advantage of RelayId and RelayIdRef.
* Merge branch 'bridge-parse' into 'main'Ian Jackson2022-10-032-10/+83
|\ | | | | | | | | Parse (and format) bridge lines See merge request tpo/core/arti!745
| * pt: transport ID error: Fix style to remove full stopIan Jackson2022-10-031-1/+1
| |
| * pt: Check PT key=value syntaxIan Jackson2022-10-031-2/+27
| | | | | | | | | | 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-032-3/+19
| | | | | | | | | | | | It has its own error type PtTargetInvalidSetting. In check_doc_features, adjust suppression to new code.
| * pt: PtTransportAddr: change None string to "-"Ian Jackson2022-10-031-2/+2
| | | | | | | | | | This is going to appear in config files etc. We don't want the user to have to type "<none>" in a bridge line.
| * pt: Provide accessors for PtTargetIan Jackson2022-09-301-1/+15
| |
| * pt: Make some more types EqIan Jackson2022-09-301-3/+3
| | | | | | | | I wanted this for testing. I think it's reasonable to promise this.
| * pt: Provide constructors for PtTargetIan Jackson2022-09-301-5/+23
| | | | | | | | | | | | | | | | Make PtTargetSettings be Default. No longer wrap it in Arc. We want to be able to update it here during construction. If we want to save memory with copies of the same bridge line, we should do this for the whole Bridge I think.
* | Remove semver.md files now that arti 1.0.1 is out.Nick Mathewson2022-10-031-1/+0
| |
* | Bump crates that have had backward compatible API changes.Nick Mathewson2022-10-031-2/+2
| |
* | Update README.md files.Nick Mathewson2022-09-301-0/+18
|/
* Mark all bridge and pt features as experimental for now.Nick Mathewson2022-09-292-0/+20
| | | | | | Also, document the features. Closes #588.
* pt: Reject a pluggable transport named BridgeIan Jackson2022-09-271-0/+5
| | | | https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/91
* Remove docsrs thing which is in wrong place?Ian Jackson2022-09-271-1/+0
|
* pt: Try to fix docsrs problemIan Jackson2022-09-271-0/+1
|
* pt: Use PtTransportName in PtTargetIan Jackson2022-09-271-1/+1
|
* pt: Use PtTransportName in TransportIdIan Jackson2022-09-271-2/+2
|