aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-linkspec/src/transport.rs
Commit message (Collapse)AuthorAgeFilesLines
* hscrypto, linkspec, llcrypto: Use new redaction helpersNick Mathewson2026-06-101-2/+5
| | | | This eliminates some string slicing.
* everywhere: Add #[allow(clippy::string_slice)]Clara Engler2026-06-091-0/+1
| | | | | | | | This commit adds #[allow(clippy::string_slice)] to all functions in the code where string slices are used, alongside a TODO comment. We do this add the function header to have it consistent, as things like expression based allow's are still experimental.
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* Fix typosTobias Stoeckmann2026-03-241-1/+1
| | | | Typos found with codespell
* tor-chanmgr: add base64ct dependency and docsNihal2026-03-181-1/+1
|
* proto: Implement Display for PeerAddrDavid Goulet2026-03-031-0/+10
| | | | | | This required to implement Display for PtTarget. Signed-off-by: David Goulet <[email protected]>
* linkspec: Add missing feature gateDavid Goulet2026-02-191-0/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Enforce that channel method as unique SocketAddrDavid Goulet2026-02-121-0/+20
| | | | | | | | | | | | | During the channel handshake, we require the peer IP address for the canonicity check which requires the exact peer IP we are connected to. This commit adds a function that enforces this requirement on a ChannelMethod so anything else results in an error. It is to basically have stronger guarantee on the channel method we use in the handshake. Signed-off-by: David Goulet <[email protected]>
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* tor-linkspec: Change HasAddrs::addrs to return an Iterator (fmt)Ian Jackson2025-10-061-1/+3
|
* tor-linkspec: Change HasAddrs::addrs to return an IteratorIan Jackson2025-10-061-9/+19
| | | | | | | | This will let us model the actual structure of routerstatus entries in netdocs more closely. They don't have the addresses in a single list. When this code was written this would have been much more awkward, but now we have RPITIT.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* educe: Use std's default for enums where default variant is unitIan Jackson2024-02-121-3/+2
| | | | | | | | | | | | | Since Rust 1.66, std's default works properly for enums, provided that the default variant is a unit. Review all uses of `#[educe(default)]` on enums and replace them with std where possible, which is most of them. In 1.66 and later, std's `#[derive(Default)]` doesn't infer any generic bounds on the derived impl, where it's an enum - since the unit variant can always be constructed. So this change doesn't add any generic bounds and is not API-visible.
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* tor-linkspec: impl AsRef<str> for PtTransportNameIan Jackson2023-07-201-0/+6
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Additional documentation around bridges/PT configurationNick Mathewson2023-07-031-4/+7
| | | | | | | This tries to flesh out some of the details for users who may be new to bridges and PTs. Closes #706.
* linkspec: Add a missing ; in tests.Nick Mathewson2023-04-061-1/+1
|
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+8
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* bridge config: Rename accessorsIan Jackson2022-11-301-2/+2
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/904#note_2858480
* BridgeAddr tests: dedupe slightlyIan Jackson2022-11-301-12/+11
|
* Separate BridgeAddr and PtTargetAddrIan Jackson2022-11-301-35/+207
| | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/issues/668#note_2858220 This commit is difficult to split up. The innards of BridgeAddr and PtTargetAddr are still a bit entangled.
* Merge branch 'more-linkspec-tests' into 'main'Nick Mathewson2022-11-291-13/+130
|\ | | | | | | | | Add tests for a bunch of code in tor-linkspec See merge request tpo/core/arti!867
| * Fix up compatibility issues between linkspec tests and other patchesNick Mathewson2022-11-281-5/+5
| |
| * linkspec: Add some tests for ChannelMethodNick Mathewson2022-11-281-0/+84
| |
| * linkspec: Tests for PtTargetSettingsNick Mathewson2022-11-281-0/+46
| |
| * PtTransportName: Remove unused accessors.Nick Mathewson2022-11-281-13/+0
| |
* | Add a default debug_redacted impl to save space.Nick Mathewson2022-11-281-4/+0
| |
* | linkspec: Give a Redacted form for chantarget.Nick Mathewson2022-11-281-0/+15
|/
* Make ChannelMethod non-exhaustiveIan Jackson2022-11-241-1/+1
| | | | | | | | | 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.
* TransportId: Parse "bridge" as builtin transportIan Jackson2022-11-221-3/+8
| | | | | This will allow transport="bridge" in bridge configurations, etc. Doing it at this layer means it will be recognised everywhere.
* TransportId: Provide new_builtin and new_pluggableIan Jackson2022-11-221-0/+15
| | | | | I think normal Rustic practice is to provide a real constructor as well as just `Default`.
* TransportId: Provide name accessor and deconstructorIan Jackson2022-11-221-0/+26
| | | | | We are maintaining the notion that at some point this thing might grow additional variants.
* TransportId: Document and change string repr for builtinIan Jackson2022-11-221-6/+16
| | | | | | * Change the Display of builtin to "-" * Parse "" and "-" as builtin, as well as "<none>" * Document this
* TransportId: Add test case for builtin Display reprIan Jackson2022-11-221-0/+2
|
* BridgeAddr rename from PtTargetAddr: Update in tor-linkspecIan Jackson2022-11-211-28/+28
| | | | | | | | | | | | | | And the error too. We need this for the API for BridgeConfigBuilder, where the user can specify any kind of target "address", even a hostname. It's already non-conditional, it's just that the name is too limiting. In this commit: * Change in tor-linkspec * Export transitional aliases * Add TODOs to remove the transitional aliases
* tor-linkspec: Provide deconstructors for PtTargetSettings and PtTargetIan Jackson2022-11-211-0/+10
|
* Allow a subset-only ChanMethod match when looking up a BridgeConfigNick Mathewson2022-11-151-0/+15
| | | | | | | | | 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.
* linkspec: Rename "maybe rename this?" TODOs in favor of #623Nick Mathewson2022-11-071-2/+0
|
* PtTargetSettings: Enforce correctness at lower level.Nick Mathewson2022-11-071-19/+49
| | | | This resolves a number of TODOs.
* Remove a blank lineNick Mathewson2022-11-071-1/+0
|
* Remove TODO about third ChannelMethod variant.Nick Mathewson2022-11-071-2/+0
| | | | We didn't find a use for this.
* Remove TODO about inlining PtTargetSettings.Nick Mathewson2022-11-071-7/+0
| | | | | Since there are (or soon will be) parsing restrictions on this type, we don't want to inline it as a simple Vec.
* impl Hash for BridgeConfig and various PT informationIan Jackson2022-10-271-3/+3
| | | | | The bridge descriptor manager wants to index data structures by the BridgeConfig.
* linkspec: Remove now-useless declared_peer_addrNick Mathewson2022-10-241-5/+0
| | | | The singleton variation here is almost never what we want.
* guardmgr: Refactor the interior of FirstHop.Nick Mathewson2022-10-241-11/+79
| | | | | | | | | | | | | 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".
* Implement serde for PtTarget and its members.Nick Mathewson2022-10-201-5/+19
| | | | 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
|