Nick Mathewson
7129807843
tor-linkspec: Add a constructor for UnparsedLinkSpec
2023-03-06 08:45:05 -05:00
Nick Mathewson
bc68974212
tor-linkspec: New UnparsedLinkspec type.
...
Unlike linkspec, this doesn't validate the actual contents of the
specifiers. We'll use this so we can handle the linkspec list for an
introduction point in an HsDesc, and just pass it on when
constructing our circuits.
I haven't added any accessor or constructor functions, because I
don't expect to need them.
2023-02-17 15:26:23 -05:00
Ian Jackson
a0a740ffc1
tor-linkspec: LinkSpec parsing: use read_nested_u8len (fmt)
2023-02-06 16:08:32 +00:00
Ian Jackson
5997d99a7a
tor-linkspec: LinkSpec parsing: use read_nested_u8len
...
This eliminates hardcoded length values.
2023-02-06 16:08:21 +00:00
Nick Mathewson
a6dd92843e
Allow clippy::unchecked_duration_subtraction in tests
...
This panics on error, and we're fine with a panic on misbehavior in
tests.
2023-01-27 08:28:02 -05:00
Nick Mathewson
bf04641c68
Disable clippy::unlinlined-format-args
...
This warning kind of snuck up on us! (See #748 ) For now, let's
disable it. (I've cleaned it up in a couple of examples, since
those are meant to be more idiomatic and user-facing.)
Closes #748 .
2023-01-27 08:27:47 -05:00
eta
b525fccfb0
Merge branch 'ya-lint' into 'main'
...
tor-linkspec: Fix an unused lint
See merge request tpo/core/arti!935
2023-01-06 17:16:27 +00:00
Ian Jackson
125a455bdc
test lint blocks: Add many many automatically
...
This is precisely the result of running the rune in
maint/adhoc-add-lint-blocks.
2022-12-12 18:00:30 +00:00
Ian Jackson
05ca80950e
tor-linkspec: Fix an unused lint
...
Otherwise:
cargo +stable clippy -p tor-proto --all-features --all-targets
Produces:
warning: unused import: `PtTargetAddr`
--> crates/tor-linkspec/src/traits.rs:9:28
|
9 | use crate::{ChannelMethod, PtTargetAddr, RelayIdRef, RelayIdType, RelayIdTypeIter};
| ^^^^^^^^^^^^
2022-12-12 15:08:31 +00:00
Ian Jackson
429d2c7cb7
bridge config: Rename accessors
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/904#note_2858480
2022-11-30 15:49:34 +00:00
Ian Jackson
bb6c98bdc1
BridgeAddr tests: dedupe slightly
2022-11-30 15:49:34 +00:00
Ian Jackson
199a6e0754
Separate BridgeAddr and PtTargetAddr
...
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.
2022-11-30 15:49:34 +00:00
Nick Mathewson
bdddb78828
Merge branch 'more-linkspec-tests' into 'main'
...
Add tests for a bunch of code in tor-linkspec
See merge request tpo/core/arti!867
2022-11-29 18:41:54 +00:00
Nick Mathewson
69744ef8f3
Remove deprecated aliases in tor-linkspec.
2022-11-29 10:56:59 -05:00
Nick Mathewson
45c4beff7a
Fix up compatibility issues between linkspec tests and other patches
2022-11-28 08:29:33 -05:00
Nick Mathewson
777b6bee3d
linkspec: Add some tests for ChannelMethod
2022-11-28 08:20:57 -05:00
Nick Mathewson
60bc179019
linkspec: Tests for PtTargetSettings
2022-11-28 08:19:47 -05:00
Nick Mathewson
119e5f6f75
PtTransportName: Remove unused accessors.
2022-11-28 08:19:47 -05:00
Nick Mathewson
d990a23948
linkspec: Add tests for has_any_identity.
2022-11-28 08:19:45 -05:00
Nick Mathewson
145ab3c49b
linkspec: Add test for lookup on no-ids.
2022-11-28 08:19:08 -05:00
Nick Mathewson
aa72f3d8c8
Add a test for ByRelayIds::remove_by_all_ids
2022-11-28 08:19:08 -05:00
Nick Mathewson
c62958c76f
Add a default debug_redacted impl to save space.
2022-11-28 08:01:53 -05:00
Nick Mathewson
2aa0ae4016
linkspec: Give a Redacted form for chantarget.
2022-11-28 08:01:50 -05:00
Ian Jackson
1a39a0c7e9
Make ChannelMethod non-exhaustive
...
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.
2022-11-24 17:17:36 +00:00
Ian Jackson
45a79bf725
tor-linkspec: Provide LoggedChanTarget type alias and utility method
...
This makes it easy to talk about, and construct, a
BoxSensitive<OwnedChanTarget>, which is what we'll use in errors.
2022-11-23 18:28:38 +00:00
Ian Jackson
822a6ce32b
TransportId: Fix test case for no pt-target
...
Fixes
cargo +stable clippy --manifest-path=/home/ian/Rustup/Arti/arti/Cargo.toml --locked --target-dir=target --offline -p tor-linkspec --no-default-features --all-targets
giving
446 | .method(ChannelMethod::Pluggable(PtTarget::new(
| ^^^^^^^^^ variant or associated item not found in `transport::ChannelMethod`
2022-11-22 14:59:25 +00:00
Ian Jackson
28ca346297
TransportId: Parse "bridge" as builtin transport
...
This will allow transport="bridge" in bridge configurations, etc.
Doing it at this layer means it will be recognised everywhere.
2022-11-22 14:59:25 +00:00
Ian Jackson
813f0a71c9
TransportId: Provide new_builtin and new_pluggable
...
I think normal Rustic practice is to provide a real constructor as
well as just `Default`.
2022-11-22 14:59:25 +00:00
Ian Jackson
331aa673ea
TransportId: Provide name accessor and deconstructor
...
We are maintaining the notion that at some point this thing might
grow additional variants.
2022-11-22 14:59:25 +00:00
Ian Jackson
4b8010782a
TransportId: Document and change string repr for builtin
...
* Change the Display of builtin to "-"
* Parse "" and "-" as builtin, as well as "<none>"
* Document this
2022-11-22 14:59:21 +00:00
Ian Jackson
fe0970e28e
TransportId: Add test case for builtin Display repr
2022-11-22 14:59:21 +00:00
Ian Jackson
fec66077de
BridgeAddr rename from PtTargetAddr: Update in tor-linkspec
...
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
2022-11-21 14:54:39 +00:00
Ian Jackson
224f4905e4
tor-linkspec: Provide deconstructors for PtTargetSettings and PtTarget
2022-11-21 14:54:39 +00:00
Nick Mathewson
de9f3177b0
Fix a missing import in tests.
...
I'm not sure why the CI didn't reject this the first time around.
2022-11-18 10:34:19 -05:00
Nick Mathewson
47041bd4ce
Merge branch 'refactor_into_ownedchantarget' into 'main'
...
CircMgr: Refactor DirSpecificTarget constructor
See merge request tpo/core/arti!866
2022-11-18 15:21:46 +00:00
Nick Mathewson
ec148a63cb
CircMgr: Refactor DirSpecificTarget constructor
...
This commit replaces the
`impl From<&T> for OwnedChanTarget where T:ChanTarget`
with a new `IntoOwnedChanTarget` trait. This lets us be explicit
that we're constructing an owned object, and not just converting
something.
No semver change needed, since these APIs haven't been released.
----------- (new description)
2022-11-18 09:55:46 -05:00
Nick Mathewson
95081198e5
Remove impl Display for OwnedCircTarget
...
Nothing used this; if anything wants it, it would be better off
calling `.display_chan_target()`.
2022-11-17 09:12:57 -05:00
Nick Mathewson
25702ccd9e
ChanTarget: Add a display function, with better output.
...
This change lets us display a ChanTarget's members without first
cloning them into an OwnedChanTarget.
It also resolves a reliability issue by outputting better info when
talking about connections via pluggable transports.
Closes #647
2022-11-17 09:06:08 -05:00
Nick Mathewson
d78cde7dea
Allow a subset-only ChanMethod match when looking up a BridgeConfig
...
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 .
2022-11-15 13:53:14 -05:00
Nick Mathewson
06e4e91614
Remove allow() for a false-positive warn on Rust 1.56.
2022-11-10 11:04:20 -05:00
Nick Mathewson
897bac680f
linkspec: Rename "maybe rename this?" TODOs in favor of #623
2022-11-07 12:27:50 -05:00
Nick Mathewson
f5364065f3
PtTargetSettings: Enforce correctness at lower level.
...
This resolves a number of TODOs.
2022-11-07 12:21:22 -05:00
Nick Mathewson
06972f171d
Remove a blank line
2022-11-07 12:19:02 -05:00
Nick Mathewson
bc28793166
Downgrade TODO on chan_method
...
This is not something we need to solve for 1.1.0 (and it might not
need to be solved ever).
2022-11-07 11:49:49 -05:00
Nick Mathewson
b423a40478
Remove TODO about third ChannelMethod variant.
...
We didn't find a use for this.
2022-11-07 10:39:13 -05:00
Nick Mathewson
e832a90c4b
Remove TODO about inlining PtTargetSettings.
...
Since there are (or soon will be) parsing restrictions on this type,
we don't want to inline it as a simple Vec.
2022-11-07 10:36:20 -05:00
Nick Mathewson
932fe48eaf
Run add_warnings.
2022-11-03 11:06:02 -04:00
Nick Mathewson
29c46d08b5
Merge branch 'guards_as_bridges_part2' into 'main'
...
Use ByRelayIds to hold guards in GuardSet
See merge request tpo/core/arti!808
2022-10-27 21:09:47 +00:00
Ian Jackson
a56efbfdf0
impl Hash for BridgeConfig and various PT information
...
The bridge descriptor manager wants to index data structures by the
BridgeConfig.
2022-10-27 15:57:54 +01:00
Nick Mathewson
7d313a12bc
ByRelayIds: Add additional accessor functions.
...
These are the ones that turned out to be necessary while converting
guard samples to use ByRelayIds.
2022-10-25 09:23:28 -04:00