trinity-1686a
39fffd8d03
make use of 1.60 opt dependancy features
2022-11-30 21:24:04 +01:00
Nick Mathewson
38bef96b99
Bump the minor version of every crate.
...
We made this job easy this time around: by incrementing our MSRV, we
have forced ourselves to do at least a minor bump everywhere.
2022-11-30 15:10:16 -05:00
Nick Mathewson
82f877ec79
Hang onto a PT object after it is launched
...
If we don't do this, then snowflake's stdin will get closed and
it will exit immediately.
Found while investigating #333 .
2022-11-30 14:44:14 -05:00
Nick Mathewson
903571353b
Merge branch 'renaming' into 'main'
...
Renaming a couple of items for arti 1.1.0
Closes #623
See merge request tpo/core/arti!916
2022-11-30 18:58:37 +00:00
Nick Mathewson
6bd0f92c15
Downgrade a "TODO pt-client" comment
2022-11-30 13:22:54 -05:00
Nick Mathewson
ed08cce1b5
Rename for_circuit_usage => as_relay_with_desc
2022-11-30 13:16:51 -05:00
Nick Mathewson
acc2de7b31
Rename TransportHelper => TransportImplHelper.
2022-11-30 13:05:46 -05:00
Ian Jackson
17ba4a1cc2
Merge branch 'redacted_test_serial' into 'main'
...
safelog: Apply #[serial] to test_redacted()
Closes #675
See merge request tpo/core/arti!914
2022-11-30 17:38:12 +00:00
eta
e13f2cf7d9
Merge branch 'ptmgr-todos' into 'main'
...
Dispose of ptmgr TODOs (and remove a dead variable)
See merge request tpo/core/arti!912
2022-11-30 17:37:47 +00:00
Nick Mathewson
a0e1b3d651
Merge branch 'bridge-addr-2' into 'main'
...
Separate BridgeAddr and PtTargetAddr
See merge request tpo/core/arti!904
2022-11-30 17:36:50 +00:00
eta
5c2847e1d0
Merge branch 'fix_pt_protocol' into 'main'
...
Resolve two bugs in our pt-socks implementation
Closes #676
See merge request tpo/core/arti!913
2022-11-30 17:25:31 +00:00
Ian Jackson
8157cf059e
Merge branch 'abolish-set-default-transport' into 'main'
...
Abolish ChanMgr::set_default_transport
See merge request tpo/core/arti!910
2022-11-30 17:05:36 +00:00
Nick Mathewson
4688ee9165
safelog: Apply #[serial] to test_redacted()
...
Closes #675 .
2022-11-30 12:00:17 -05:00
Nick Mathewson
e835bd4c4c
PT protocol: pt-spec conformance with password field
...
pt-spec says:
```
If the encoded argument list is less than 255 bytes in
length, the "PLEN" field must be set to "1" and the "PASSWD"
field must contain a single NUL character.
```
This is a very silly thing to say, but some PTs enforce it.
Fixes #676 .
2022-11-30 11:53:38 -05:00
Nick Mathewson
475d9af34a
connect_via_proxy: Actually send initial handshake.
...
Our previous code would make a TCP connection to the proxy, then
wait forever for it to say something. Whoops!
Part of a fix for #676 .
2022-11-30 11:53:27 -05:00
Ian Jackson
fa676ce577
ptmgr todo: Remove dead code allow
2022-11-30 16:42:40 +00:00
Ian Jackson
fe33112923
ptmgr: No need for state_dir in PtMgr
...
This is used exclusively by the reactor.
2022-11-30 16:42:18 +00:00
Ian Jackson
1521f63bf1
ptmgr todo: Tolerate exposing the Vec for now
...
We may want to change this later, but this API is in a low level
crate, so this isn't a blocker.
2022-11-30 16:40:45 +00:00
Ian Jackson
4afe128189
PT SOCKS tests: add a few more tests
2022-11-30 16:35:04 +00:00
Ian Jackson
596e67f588
PT SOCKS tests: test name that only fits in V4
2022-11-30 16:35:04 +00:00
Nick Mathewson
a5cdf88fdc
Merge branch 'pt-todo-highlevel' into 'main'
...
Dispose of all TODO pt-client in arti-*
See merge request tpo/core/arti!909
2022-11-30 16:22:46 +00:00
eta
f122b4b1ee
Merge branch 'no_empty_select' into 'main'
...
ptmgr: Do not construct an empty select_all future.
Closes #672 and #670
See merge request tpo/core/arti!907
2022-11-30 16:01:58 +00:00
Ian Jackson
ab74506dc9
Abolish ChanMgr::set_default_transport
...
The comment says
// TODO pt-client: It's not clear to me that we really need this method.
and empirically, deleting it, and its callee, is fine.
2022-11-30 16:00:31 +00:00
Ian Jackson
e068c5c2bc
Merge branch 'ptmgr-errs' into 'main'
...
ptmgr: error fixes
See merge request tpo/core/arti!906
2022-11-30 15:58:26 +00:00
Ian Jackson
e6d721c497
arti: transports parsing: Record this as a ticket
2022-11-30 15:56:16 +00:00
Ian Jackson
598f4e2e28
arti: BridgesConfig is evidently not too high up
...
Since apparently it was possible to write all the other code without
moving it.
2022-11-30 15:51:10 +00:00
Ian Jackson
e4ac39e638
bridge config: Add a TODO about a redundant clone
2022-11-30 15:49:34 +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
117bee5808
bridge config: Use unreachable, not None.expect
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/904#note_2858479
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
Ian Jackson
a74ee097f5
arti: pt mgr spawns the task itself in new
2022-11-30 15:48:31 +00:00
Ian Jackson
455295457f
Merge branch 'redaction_fix' into 'main'
...
Fix a logic error in Redacted.
Closes #671
See merge request tpo/core/arti!905
2022-11-30 15:39:41 +00:00
Nick Mathewson
d853fdb5cb
ptmgr: Do not construct an empty select_all future.
...
Closes #670 .
Closes #672 .
2022-11-30 10:22:09 -05:00
Ian Jackson
1e63a89ce8
ptmgr: change error UnconfiguredTransportDueToConcurrentReconfiguration
...
Rename it from UnconfiguredTransport. Change descriptions, kind, and
retry. Add a TODO.
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/901#note_2858455
2022-11-30 15:21:49 +00:00
Ian Jackson
d705454313
ptmgr: Clarify E::NotAFile
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/901#note_2858454
2022-11-30 15:21:39 +00:00
Ian Jackson
f19d8e0397
ptmgr: Fix kind for E::StatedirCreateFailed
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/901#note_2858456
2022-11-30 15:21:39 +00:00
Nick Mathewson
80d9248b50
Merge branch 'merge_ptreactor' into 'main'
...
Merge PtReactor, resolve a few of my comments.
See merge request tpo/core/arti!903
2022-11-30 15:21:13 +00:00
Nick Mathewson
f0084e3fd4
Fix a logic error in Redacted.
...
Previously it was redacting exactly when safelogging was _disabled_,
which obviously isn't correct.
Fixes #671 . Regression test included.
2022-11-30 09:07:33 -05:00
Nick Mathewson
dacb3eafda
ptmgr: report an error if PT transports don't match requested.
...
(I think this may be impossible now, since we check in ipc.rs, but
IMO it's best to check.)
2022-11-29 20:01:19 -05:00
Nick Mathewson
5f0f5f81b1
arti-client: Try to take ownership of state earlier.
...
There's no harm in doing this, since we'll try to take ownership of
the state soon as soon as we use it: We just want to try early, so
that we'll get it before we decide that we're using bridges.
Fixes bug #669 ; bug introduced by !889 .
2022-11-29 19:58:42 -05:00
Nick Mathewson
fdc49b1fed
Register transport in pt reactor even if it has no pending requests
2022-11-29 19:35:38 -05:00
Nick Mathewson
9765fdc2e6
ptmgr: Use anonymize_home when displaying paths in errors
2022-11-29 19:30:50 -05:00
Nick Mathewson
f6311c83f7
ptmgr: Use PluggableTransport::identity in logs.
...
This lets us avoid logging the user's path.
2022-11-29 19:20:44 -05:00
Nick Mathewson
bb0749cd42
Centralize the "find an identifier for the pt name" logic in one place.
2022-11-29 19:13:32 -05:00
Nick Mathewson
21e7e52ad5
Merge remote-tracking branch 'eta/ptreactor-v1' into merge_ptreactor
...
Resolved several conflicts while doing so; mostly with !893 and
!895 .
2022-11-29 18:55:49 -05:00
eta
9b4fc50625
tor-ptmgr: add PtReactor
...
This fleshes out the PtReactor that was previously a stub, making it
actually do reactor-ey things. Note that this is entirely untested, and
might not work at all. Hopefully it does, though.
2022-11-29 20:13:32 +00:00
Nick Mathewson
7ef9dde99c
Merge branch 'todos-chanmgr' into 'main'
...
chanmgr: resolve several remaining "TODO pt-client" issues
See merge request tpo/core/arti!897
2022-11-29 19:31:48 +00:00
Nick Mathewson
dc5551114c
Merge branch 'list-builder-lint' into 'main'
...
tor-basic-utils: list_builder: Use standard test lint block
See merge request tpo/core/arti!900
2022-11-29 19:25:07 +00:00
Ian Jackson
f3c8b0433b
tor-basic-utils: list_builder: Use standard test lint block
...
This gets rid of a spurious warning on nightly about the use of dbg!
2022-11-29 18:41:56 +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
8cc09c2728
chanmgr: Distinguish failure to connect to proxy from other IO failures
2022-11-29 13:41:35 -05:00
Ian Jackson
c3bdb30025
Merge branch 'ptmgr-optional-dep-test' into 'main'
...
MultilineListBuilder etc.: add serde tests
See merge request tpo/core/arti!899
2022-11-29 18:37:43 +00:00
Ian Jackson
b36a23cfd3
Merge branch 'ptmgr-optional-dep' into 'main'
...
Support building without pluggable transports
Closes #649
See merge request tpo/core/arti!898
2022-11-29 18:26:30 +00:00
Ian Jackson
303fafe81b
Merge branch 'll-todo-fixes' into 'main'
...
Fix and resolve TODO pt-client comments in guardmgr, linkspec.
See merge request tpo/core/arti!896
2022-11-29 18:14:25 +00:00
Ian Jackson
cdc1e574f9
tor-config MultilineListBuilder: Test deserialisation
2022-11-29 17:53:04 +00:00
Ian Jackson
255f3b6bf6
tor-config MultilineListBuilder: Print line number starting at 1, not 0
2022-11-29 17:53:04 +00:00
Ian Jackson
ef07c2e99d
tor-config list_builder tests: Move Outer up a level
...
We're going to reuse this.
2022-11-29 17:53:04 +00:00
Ian Jackson
211a832f6d
Clarify internal error.
2022-11-29 17:22:16 +00:00
Ian Jackson
143b331ef7
arti-client: Make ptmgr actually optional
2022-11-29 16:32:14 +00:00
Ian Jackson
1bd606ab5c
guardmgr: Conditionalise DisplayRule::Redacted
...
This is unused in bridgeless configs. Fixes a compiler warning.
2022-11-29 16:32:14 +00:00
Ian Jackson
c92dcb5f50
arti, arti-client: Conditionalise various things on pt-client
2022-11-29 16:32:14 +00:00
Ian Jackson
d05d383fa5
arti cfg tests: Add some more debug output
2022-11-29 16:32:14 +00:00
Ian Jackson
71e81bf7b4
MultilineListBuilder: Use a manual implementation of Deserialize
...
The error message from `#[serde(untagged)]` would otherwise start to
appear when we try to deserialise unsupported PT configurations, when
compiled with bridge but not PT support.
2022-11-29 16:32:14 +00:00
Nick Mathewson
c6aa587dc8
chanmgr: remove a now-stale TODO.
2022-11-29 11:15:36 -05:00
Nick Mathewson
4fff9f9dda
chanmgr: Report Pt errors correctly.
...
We were panicking if the PtMgr gave us an error, which isn't so
good.
2022-11-29 11:10:26 -05:00
Nick Mathewson
6b12c5d1de
guardmgr: remove todo about bridge::config::Inner members
...
We've revised this a few times; now it seems plausible.
2022-11-29 11:03:44 -05:00
Nick Mathewson
0c0f3d1faf
guardmgr: Remove now-unneeded #[allow(unnecessary_wraps)]
2022-11-29 11:00:27 -05:00
Nick Mathewson
69744ef8f3
Remove deprecated aliases in tor-linkspec.
2022-11-29 10:56:59 -05:00
Nick Mathewson
75cba2ce80
ptmgr: Refine RetryTime for ChildSpawnFailed.
2022-11-29 10:44:09 -05:00
Nick Mathewson
29ea66ecb9
ptmgr: Rename ClientTransportFailed, document, and correct its RetryTime.
2022-11-29 10:42:26 -05:00
Nick Mathewson
d9dc30bc13
ptmgr: Replace StdioUnavailable with a PtError.
2022-11-29 10:36:51 -05:00
Nick Mathewson
7f923b9dfe
Rename LocalLoginFailed to ExternalToolFailed.
2022-11-29 10:32:59 -05:00
Nick Mathewson
eebfe8300e
Document better what LocalProtocolViolation does not cover.
2022-11-29 10:29:54 -05:00
Nick Mathewson
f08cfb6567
Merge branch 'ptmgr-cleanup' into 'main'
...
Post-merge cleanups for PtMgr
Closes #667 and #659
See merge request tpo/core/arti!893
2022-11-29 14:46:55 +00:00
Nick Mathewson
9a17a6a8aa
Switch from sha-1 back to sha1.
...
As near as I can tell, the rust-crypto SHA1 crate was called `sha-1`
for a while because of a conflict with a different SHA1 crate. Now
they apparently have the `sha1` name back and have deprecated the
`sha-1` name.
2022-11-29 08:24:58 -05:00
eta
3a0f0a909d
Spelling fix in arti_client::err
2022-11-29 12:31:50 +00:00
Ian Jackson
8835c1b170
Merge branch 'redacted' into 'main'
...
Define a "redactable" trait, and use it when logging guard info
Closes #648 and #627
See merge request tpo/core/arti!882
2022-11-29 12:29:48 +00:00
Ian Jackson
d78295929b
Merge branch 'more_netdoc_tests' into 'main'
...
tor-netdoc: More tests for routerdesc accessors and parsing.
See merge request tpo/core/arti!870
2022-11-29 11:11:47 +00:00
Nick Mathewson
1f4a385d7d
Temporarily make ptmgr required for arti-client :/
2022-11-28 17:29:32 -05:00
Nick Mathewson
820657b6bc
PtMgr: Use a persistent state directory for PT state.
...
This makes a `pt_state` directory inside .local/share/arti (or the
local equivalent), right next to our existing `state` dir.
Ideally we would use a separate directory for each PT, but we have a
very fuzzy "what is a specific PT" notion.
Closes #667
2022-11-28 17:29:32 -05:00
Nick Mathewson
1a9c4c722b
Integrate PtMgr into arti-client.
...
If support is available at compile-time, then we construct a PtMgr
and register it with the ChanMgr. We keep a handle to it ourself so
that we can reconfigure it as needed.
Closes #659 .
2022-11-28 17:29:32 -05:00
Nick Mathewson
3db0e05b39
Fix ChanMgr APIs for setting PtMgr etc to match what TorClient wants.
2022-11-28 17:29:23 -05:00
Nick Mathewson
3fa86f41a6
Revise the API of "PtMgr::reconfigure"
...
I prefer that it not take `&mut self`, since PtMgr already has
interior mutability.
I also need it to take `tor_config::Reconfigure` argument, in case
it gains any more smarts about validation in the future.
2022-11-28 17:29:23 -05:00
Nick Mathewson
c99017b0d6
ptmgr: Note a TODO issue around TempDir.
2022-11-28 17:29:23 -05:00
Nick Mathewson
4b5be3685f
ptmgr: Fill in some error-related code; resolve TODOs.
2022-11-28 17:29:23 -05:00
Nick Mathewson
1fa9296f9c
ptmgr: clear up unused_import exceptions.
2022-11-28 17:29:23 -05:00
Nick Mathewson
6bde90ce01
PtMgr: New features section in README.md
...
Per convention, have a `full` feature.
Also, downgrade the 'TODO pt-client' entries in README::limitations,
since they are not blockers for 1.1.0.
2022-11-28 17:29:23 -05:00
Nick Mathewson
8d0ac9bdc8
ptmgr: Mark PtMessage and next_message as experimental-api.
...
These are implementation details and we don't want to mark them as
stable.
To do this, I needed to apply some additional options to the example
code's configuration in Cargo.toml.
2022-11-28 17:29:23 -05:00
eta
a3c9fc5b1a
tor-chanmgr: Introduce the BootstrapReporter API, publicize ChanBuilder
...
This commit makes the `ChanBuilder` type in `tor-chanmgr` usable by
consumers outside of that crate, like the doc comment for
`ChannelFactory` says you need to be able to do in order to turn your
`TransportHelper` into something useful.
As part of doing this, the `event_sender` its constructor takes needed
to be dealt with, since it was a crate-internal type that came from
inside the `ChanMgr`.
Enter `BootstrapReporter`: an opaque wrapper around that sender, now
provided as an additional argument to
`ChannelFactory::connect_via_transport`. You can now construct a
`ChanBuilder` outside this crate, and it'll still be able to report its
bootstrap status by unwrapping this new type that's threaded through
from the `ChanMgr`. (This was a fair deal of manually threading the type
through all the layers in this crate!)
Note that you cannot implement bootstrap updating using something that
isn't `ChanBuilder` yet due to the type being entirely opaque (but, of
course, we can figure out exactly what API the reporter should have
later, and add that capability in).
2022-11-28 13:52:21 -05:00
eta
3b41c78d6f
Draft: Pluggable transport manager
...
This commit implements `PtMgr`, a pluggable transport manager
responsible for keeping track of spawned PTs and spawning them to
satisfy client requests on demand.
It does this in two parts: the `PtMgr` type exported to the rest of the
code, and the background `PtReactor` that actually does the spawning;
this design ensures that only one attempt to spawn a PT is active at a
time, and will prove useful later for implementing e.g. timeouts.
A few changes were necessary to the rest of the code in order to make
this all work out. Namely:
- `TransportRegistry`'s API didn't make any sense for two reasons:
- It wasn't feasible for implementors to implement `ChannelFactory`,
since that'd require constructing a `ChanBuilder` (which requires a
bootstrap reporting event sender).
- Treating the PT manager as a registry is over-general; it's only
necessary for it to spawn pluggable transports, so saddling it with
other concerns didn't make any sense.
- (It's possible to get extensibility for arbitrary user customization
by just letting the user swap in a new `ChannelFactory`, anyway.)
- Therefore, the `PtMgr` implements the new `AbstractPtMgr` trait, which
is far more narrowly focused; this only exists to solve a dependency
loop, and is documented as such.
- This provides a `TransportHelper` instead of a `ChannelFactory`.
2022-11-28 13:52:21 -05:00
Nick Mathewson
5d6044f3fc
Rustdoc fix: escape []s.
2022-11-28 09:36:15 -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
a77172e20d
safelog: Make MaybeRedacted<T> opaque.
2022-11-28 08:01:53 -05:00
Nick Mathewson
cf9f29158f
GuardMgr: Treat Guards as sensitive and Bridges as redacted.
...
This machinery is a bit inelegant, but it is all confined to
be within the GuardMgr crate, so IMO it should be fine for now.
2022-11-28 08:01:53 -05:00
Nick Mathewson
c62958c76f
Add a default debug_redacted impl to save space.
2022-11-28 08:01:53 -05:00
Nick Mathewson
29f903bdac
Display guards in redacted form in guard status messages.
...
Closes #627 , again.
Closes #648 .
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
Nick Mathewson
8d36fa9996
llcrypto: Make key id types Redactable.
2022-11-28 08:01:10 -05:00
Nick Mathewson
f2c91ef56e
safelog: Add a MaybeRedacted wrapper too.
...
This is super helpful for cases where we want to write two nearly
identical implementations to format a type.
2022-11-28 08:01:10 -05:00
Nick Mathewson
f91218c78d
safelog: implement Redactable for network addr types.
2022-11-28 08:01:10 -05:00
Nick Mathewson
d3f4956728
safelog: Define a "Redactable" trait
...
A "redactable" object is one that can be _partially_ scrubbed in
sensitive contexts. This can be very helpful for UX, but is not
risk-free: see comments.
2022-11-28 08:01:10 -05:00
Nick Mathewson
8cf9e2a6a4
Merge branch 'chanmethod-non-exhaustive' into 'main'
...
Make ChannelMethod non-exhaustive
See merge request tpo/core/arti!891
2022-11-27 19:36:22 +00:00
Nick Mathewson
984bd6012a
Merge branch 'reconfig-bridges-bad' into 'main'
...
Require state ownership when using bridges
Closes #612
See merge request tpo/core/arti!889
2022-11-27 19:30:00 +00:00
trinity-1686a
fda17829d5
fix deprecation warnings from rustls
2022-11-26 10:23:05 +01:00
trinity-1686a
0a917a1abc
upgrade rustls to 0.20, ignoring all deprecation warnings
2022-11-26 10:23:05 +01: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
04082ab7a9
tor-guardmgr: rustfmt for recent changes
...
Left unsquashed for ease of review
2022-11-24 14:31:05 +00:00
Ian Jackson
ecd0e121a8
tor-guardmgr: NoLock error: add TODO for trying to get lock
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/889#note_2856874
2022-11-24 14:31:05 +00:00
Ian Jackson
112e28d88e
tor-config: Rename to ReconfigureError::UnsupportedSituation
...
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.
2022-11-24 14:31:03 +00:00
Ian Jackson
fa918446ac
tor-config: Rename to ConfigBuildError::NoCompileTimeSupport
...
From Unsupported. Following one of the suggestions here
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/889#note_2856873
This was added in 2c37116149
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.
2022-11-24 14:30:58 +00:00
Ian Jackson
90a1a10b3c
Merge branch 'sensitive-error' into 'main'
...
Scrub channel target information in errors
See merge request tpo/core/arti!890
2022-11-23 20:18:17 +00:00
Ian Jackson
dc13c93491
Merge branch 'bdm-dormant' into 'main'
...
bridge desc mgr: Honour specified dormancy
Closes #630
See merge request tpo/core/arti!861
2022-11-23 20:13:29 +00:00
Ian Jackson
6a39cdfe57
Merge branch 'watch-drop-option' into 'main'
...
tor-basic-utils: DropNotifyWatchSender: use DropNotifyEofSignallable
See merge request tpo/core/arti!853
2022-11-23 18:55:32 +00:00
Ian Jackson
ef5a58e158
tor-dirclient: Replace OwnedChanTarget with LoggedChanTarget in SourceInfo
...
SourceInfo primarily appears in errors, here and in (indirectly)
tor-dirmgr.
This
1. Makes the errors smaller
2. Redacts (currently, scrubs) the chantarget when safe logging is enabled
This commit therefore deals with both tor-dirmgr and tor-dirclient
errors, from the pov of error information that should become sensitive
as part of bridge support.
The error pyaloads directly in tor_dirmgr/src/err.rs don't seem to
contain anything in that category.
2022-11-23 18:28:38 +00:00
Ian Jackson
b822e2ebe9
tor-cirmgr: Replace OwnedChanTarget with LoggedChanTarget in errors
...
This
1. Makes the errors smaller
2. Redacts (currently, scrubs) the chantarget when safe logging is enabled
The other error variants in tor-circmgr::Error don't seem to contain
information that should become sensitive as part of bridge support.
2022-11-23 18:28:38 +00:00
Ian Jackson
e635383dfb
tor-chanmgr: Invent [Box]ChanSensitive for two error payloads
...
This
1. Makes the errors smaller (in the case of Io's PtTargetAddr;
ChannelBuild's addresses are already indirected in a Vec).
2. Redacts (currently, scrubs) the PtTargetAddr and SocketAddr
when safe logging is enabled
These are the remaining error variants in tor-chanmgr that contain
information that should become sensitive as part of bridge support.
2022-11-23 18:28:38 +00:00
Ian Jackson
32357b3de7
tor-chanmgr: Replace OwnedChanTarget with LoggedChanTarget in errors
...
This
1. Makes the errors smaller
2. Redacts (currently, scrubs) the chantarget when safe logging is enabled
This commit doesn't treat other should-be-sensitive inforemation in
errors just yet. That will come in a moment.
2022-11-23 18:28:38 +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
bbc84bf9f4
safelog: Provide BoxSensitive
2022-11-23 18:28:38 +00:00
Ian Jackson
4f193f1017
safelog: Remove type argument from `impl_display_traits`
...
We're going to have this same macro implement the same traits for a
second type. And its function is specific to `Sensitive`, so have it
know that.
2022-11-23 18:28:34 +00:00
Ian Jackson
b77fd893a4
safelog: Provide some more accessors
...
We're about to use `.as_inner()` in a few places, and `.as_ref()` (by
analogy with `Option`) seems obviously necessary.
2022-11-23 18:28:34 +00:00
Ian Jackson
1c085cf401
bridge desc mgr: Add dormancy comment to effective_parallelism
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/861#note_2856922
2022-11-23 18:20:58 +00:00
Ian Jackson
68acedccfd
bridge desc mgr: Test dormancy
2022-11-23 18:20:58 +00:00
Ian Jackson
e0c4eed549
bridge desc mgr: Honour specified dormancy
...
Fixes #630
2022-11-23 18:20:58 +00:00
Ian Jackson
a33df9a5f5
bridge desc mgr: Introduce effective_parallelism helper
2022-11-23 18:20:58 +00:00
Ian Jackson
2c98351e2d
bridge desc mgr: Move set_dormancy to impl that is for mock too
2022-11-23 18:20:58 +00:00
Nick Mathewson
ce0f8f41cb
Merge branch 'bridge-config-arc' into 'main'
...
Make BridgeConfig be Arc, so no Arc<BridgeConfig>
Closes #635
See merge request tpo/core/arti!885
2022-11-23 17:52:26 +00:00
Ian Jackson
fbd4b88044
Merge branch 'test-config' into 'main'
...
tor-guardmgr: Fix visibility of TestConfig with no features enabled
See merge request tpo/core/arti!875
2022-11-23 17:51:05 +00:00
Ian Jackson
4d502bd818
arti-client: Add comment about Option DormantMode
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/852#note_2854090
(ftaod, that is a different MR to this one)
2022-11-23 17:50:05 +00:00
Ian Jackson
c82cda85d6
tor-basic-utils: DropNotifyWatchSender: use DropNotifyEofSignallable
...
This will help avoid the programmer making the mistake I made here:
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/852#note_2854029
2022-11-23 17:50:05 +00:00
Nick Mathewson
c0a6fb3e0f
Merge branch 'stability' into 'main'
...
arti-client, tor-config: Remove stability warning from top-level docs
See merge request tpo/core/arti!878
2022-11-23 17:50:01 +00:00
Ian Jackson
63a799a118
tor-basic-utils: DropNotifyWatchSender test: introduce I
...
We do want to test this with a non-Option type, but we are going to
have to wrap it up.
2022-11-23 17:50:01 +00:00
Nick Mathewson
e25ed00fd1
Merge branch 'remove_deadcode_allow' into 'main'
...
guardmgr: Remove a now-unneeded "allow(dead_code)"
See merge request tpo/core/arti!862
2022-11-23 17:45:26 +00:00
Nick Mathewson
3f5699b95a
ChanMgr: Another attempt to build on CI.
2022-11-23 11:25:15 -05:00
Nick Mathewson
74ebc904e3
ChanMgr: Rename Factory -> CompoundFactory
2022-11-23 11:10:34 -05:00
Nick Mathewson
1249bedbb0
ChanMgr: Fix a few more conditional-compilation issues
2022-11-23 11:10:34 -05:00
Nick Mathewson
2fb36f5585
ChanMgr: Remove Arc aliases.
2022-11-23 11:10:34 -05:00
Nick Mathewson
f8e103bb94
Mark set-default-factory API as experimental.
2022-11-23 11:10:34 -05:00
Nick Mathewson
c04aa9baed
Make ChannelFactory and AbstractPtMgr require Send+Sync
2022-11-23 11:10:34 -05:00
Nick Mathewson
bc1de60d6d
ChanMgr: Implement functions that replace channel factories.
...
This commit makes it possible to replace the default channel factory
(used when there is no PtMgr), and to replace the PtMgr.
This is part of #659 .
2022-11-23 11:10:34 -05:00
Ian Jackson
ecaf8b23b8
tor-guardmgr: Refuse to configure bridges if we don't have the lock
...
Fixes #612
2022-11-23 13:03:14 +00:00
Ian Jackson
c0b297c99c
tor-guardmgr: make replace_bridge_config fallible
...
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.
2022-11-23 13:00:10 +00:00
Ian Jackson
8cddb0a06a
tor-guardmgr: Replace a let _ignore with a typed version
...
`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.
2022-11-23 13:00:05 +00:00
Nick Mathewson
a688e4afc9
ChanMgr: move the AbstractChanFactory into MgrState.
...
We will want the freedom to replace this, so it needs to go behind a
lock. We need to be able to Clone it cheaply now, so we're using an
Arc instead of a Box.
2022-11-22 14:41:44 -05:00
Nick Mathewson
fc74bb8bb4
Merge branch 'retire_on_guard_cfg_change' into 'main'
...
CircMgr: retire all circuits if bridge configuration changes.
Closes #650
See merge request tpo/core/arti!880
2022-11-22 19:00:20 +00:00
Nick Mathewson
09092394a8
Merge branch 'main' into 'abstract-pt-mgr'
...
# Conflicts:
# crates/tor-chanmgr/src/factory.rs
2022-11-22 18:12:25 +00:00
eta
2f75702cec
Replace TransportRegistry with AbstractPtMgr
...
It doesn't make much sense to have the pluggable transport manager be a
registry, so replace its interface with a more narrowly defined, less generic
version.
Other changes:
- instead of returning a &-reference, it returns an owned Arc, which
should make the ptmgr easier to implement while allowing efficient
reuse
- provision for error handling is added, but will probably be revised in
a future commit pending discussion
- tor-ptmgr code that would generate warnings as a result of this change
is temporarily removed
This is a split out version of arti!886, intended so work on arti#659
can proceed.
2022-11-22 18:09:06 +00:00
Nick Mathewson
f2121101d1
Even more comments explaining circuit cancellation.
2022-11-22 12:53:32 -05:00
Nick Mathewson
e7c942c918
Improve notes surrounding circuit cancellation.
...
It turns out that bug #656 is not a real bug, but it was easy to
overlook the code that prevented it.
Closes #656 .
2022-11-22 12:53:32 -05:00
Nick Mathewson
c0aa10d409
CircMgr: retire all circuits if bridge configuration changes.
...
Closes #650 .
2022-11-22 12:53:32 -05:00
Ian Jackson
ee87097dc1
BridgeConfig: Replace all Arc<BridgeConfig> with BridgeConfig
...
BridgeConfig is itself an Arc now, so these are redundant.
2022-11-22 15:33:21 +00:00
Ian Jackson
3caf7aafc0
BridgeConfig: Make it be a newtype around Arc<Inner>
...
This leaves the external API of this type unchanged, but now it's much
smaller and quite cheap to clone.
2022-11-22 15:33:21 +00:00
Ian Jackson
5d8d3f79fa
bridge config: Remove a done TODO
...
This was done by !874 and #604 closed accordingly.
2022-11-22 15:08:28 +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
8406474435
bridge config parsing tests: Show expected error message in asssrt
2022-11-22 14:59:25 +00:00
Ian Jackson
987f67d7f6
bridge config parsing: Parse transport as TransportId (fmt)
2022-11-22 14:59:25 +00:00
Ian Jackson
e57d3061db
bridge config parsing: Parse transport as TransportId
...
Fixes #653
2022-11-22 14:59:25 +00:00
Ian Jackson
6b2940bb7d
bridge config parsing: Move unsupported block
...
This will make the next commit textually smaller.
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
17002c7462
bridge non-support: Add doc notes to GuardMgrConfig::bridges_enabled
2022-11-21 16:46:19 +00:00
Ian Jackson
ec7f058cfd
bridge non-support: Test that we reject configs
2022-11-21 16:46:19 +00:00
Ian Jackson
b2607fd8c8
bridge non-support: De-cfg the primary bridge config fields
...
We now parse the `bridges.enabled` BoolOrAuto, and the
`bridges.bridges` list.
The `bridges.bridges` list is Vec<()> in the builder, and Vec<Void> in
the built config. Ie, it is simply a count, and vanishes in the built
config.
But this count triggers us to try to call build(), to try to parse
bridges, and to try to set and honour the enablement boolean.
The result is that the type system now ensures that if bridges are
disabled, but specified (either by listing them in the config, or
writing `enabled=true`), we inevitably try to insist that we have a
non-empty Vec<Void>, which is of course impossible.
There will be a test case too for those who think this too abstract a
way to guarantee this property :-).
2022-11-21 16:46:19 +00:00
Ian Jackson
939d11c034
bridge non-support: Provide a better BridgeConfigBuilder
...
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.
2022-11-21 16:46:19 +00:00
Ian Jackson
c4a3b0b5c4
bridge config: Feature-gate the error variants
...
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.
2022-11-21 16:46:19 +00:00
Ian Jackson
5800b1cdc9
bridge config: Move error to its own file
...
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.
2022-11-21 16:46:19 +00:00
Ian Jackson
f087c7121d
bridge non-support: Move dummy bridge module into own file
...
A bit more stuff is going to appear here, so it's getting to be rather
much for an inline module.
2022-11-21 16:46:19 +00:00
Ian Jackson
7688973fd4
arti cfg test: Break out expect_err_contains function
...
Maybe this will want to be in tor-error or something but put it here
for now.
2022-11-21 16:46:19 +00:00
Ian Jackson
fa4f842340
bridge non-support: Disable the test for now
...
This test will start to fail if you compile without bridge support,
because we'll start rejecting the test configurations with bridges
specified.
We'll add a proper test for this later.
2022-11-21 16:46:19 +00:00
Ian Jackson
2c37116149
tor-config: introduce ConfigBuildError::Unsupported
...
And use it in bridge configuration parsing.
2022-11-21 15:46:53 +00:00
Ian Jackson
ac4869633a
tor-config: ConfigBuildError::within: Introduce add_prefix
2022-11-21 15:46:53 +00:00
Ian Jackson
681b4062ff
bridge config builder: Introduce error constructor helpers (fmt noise)
2022-11-21 15:46:53 +00:00
Ian Jackson
85d7651827
bridge config builder: Introduce error constructor helpers
...
Prompted by
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/874/diffs?commit_id=12d13428d8fcc68b7b0f231bac9fc130b3eeb18b#d53209cbcd12771c549f3a130379ecb65dd60145_100_193
2022-11-21 15:46:53 +00:00
Ian Jackson
b0bd9b3fb3
bridge config builder: Document one id of each type restriction
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/874/diffs?commit_id=620cc90f6dcdad20f49a001a9e04d191a323e904#d53209cbcd12771c549f3a130379ecb65dd60145_100_124
2022-11-21 14:58:24 +00:00
Ian Jackson
897d8a0ee3
bridge config builder: Document PT one address restriction
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/874/diffs?commit_id=620cc90f6dcdad20f49a001a9e04d191a323e904#d53209cbcd12771c549f3a130379ecb65dd60145_100_121
2022-11-21 14:58:24 +00:00
Ian Jackson
58710b9635
Make the bridge list in the builder be a list of BridgeConfigBuilder
...
By changing MultilineListBuilder.
2022-11-21 14:58:24 +00:00
Ian Jackson
9aa1c56fc9
BridgeConfigBuilder: Allow (de)ser to/from bridge lines
...
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.
2022-11-21 14:58:24 +00:00
Ian Jackson
91536da10a
tor-basic-utils: Provide helper for serde flexible parsing
2022-11-21 14:58:24 +00:00
Ian Jackson
345d8e130b
BridgeConfigBuilder: Implement FromStr
2022-11-21 14:58:24 +00:00
Ian Jackson
cd2070b3ba
BridgeConfigBuilder: Introduce build() function
...
And test cases for it, and its errors.
2022-11-21 14:58:24 +00:00
Ian Jackson
589f74a78f
BridgeConfigBuilder: Introduce the struct with the dictionary repr
...
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)
2022-11-21 14:58:24 +00:00
Ian Jackson
2327c7657c
tor-basic-utils: list_builder: Introduce DirectDefaultEmptyListBuilderAccessors
...
This trait can have this ludicrously long name because no-one needs to
import it.
2022-11-21 14:54:39 +00:00
Ian Jackson
88b60a1fa7
BridgeAddr rename: update tor_guardmgr::bridge::config
...
Here is where my motivation is and I'm working on this code now, so do
this renaming cleanup now.
2022-11-21 14:54:39 +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
Ian Jackson
0b14b93f76
arti-client, tor-config: Remove stability warning from top-level docs
...
Ticket #285 is closed and most of this is stable now we think.
(There are still a couple of stability warnings for specific types in
tor-config, which aren't exposed at the arti-client level.)
2022-11-21 12:06:27 +00:00
Ian Jackson
113341e397
cfg compilation: Add two allows
2022-11-18 18:50:00 +00:00
Ian Jackson
285a7988bb
Merge branch 'fix_nightly_20221118' into 'main'
...
Fix warnings and breakage in nightly (2022-11-18 edition)
See merge request tpo/core/arti!872
2022-11-18 16:43:16 +00:00
Ian Jackson
7ec52057dc
tor-guardmgr: Fix visibility of TestConfig with no features enabled
...
Without this, tor-guardmgr tests don't build when run without the
crate's own testing feature enabled.
2022-11-18 16:30:46 +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
829cb708e2
Fix a couple of rustdoc issues.
...
These slipped in while nightly was broken.
2022-11-18 10:19:54 -05:00
Nick Mathewson
d51162e55b
Fix a bunch of "needless borrow" warnings on nightly
...
It looks like, despite a few false starts, they've got this warning
right; there weren't any false positives.
2022-11-18 10:12:05 -05: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
c666133be4
Merge branch 'mark-bridges-not-experimental' into 'main'
...
Mark bridge and PT-related APIs as non-experimental.
Closes #643
See merge request tpo/core/arti!865
2022-11-18 14:22:31 +00:00
Nick Mathewson
76e41b8bf6
circmgr: make some imports conditional
...
This resolves an "unused import" warning when bridges are not
enabled.
2022-11-18 08:53:47 -05:00
Nick Mathewson
2c366927cc
arti-client: make bridge-client depend on dirmgr/bridge-client
...
This resolves some errors when building with `bridge-client` but not
with `--all-features`.
2022-11-18 08:53:47 -05:00
Nick Mathewson
b0e337d22d
arti: Mark bridge and pt support non-experimental, and on-by-default
2022-11-18 08:53:47 -05:00
Nick Mathewson
9229e1a59b
arti: Split long lines in Cargo.toml
...
This will make the next commit easier to review.
2022-11-18 08:53:47 -05:00
Nick Mathewson
f1f6005474
arti-client: Mark "bridge-client" and "pt-client" as non-experimental
2022-11-18 08:53:47 -05:00
Nick Mathewson
09591bcc5a
arti-client: split long lines in Cargo.toml
...
Doing this separately to make the next commit easier to read.
2022-11-18 08:53:47 -05:00
Nick Mathewson
9f661e264f
dirmgr: make "bridge-client" non-experimental.
2022-11-18 08:53:47 -05:00
Nick Mathewson
471cdc77f2
guardmgr: Make bridge-client and pt-client non-experimental
2022-11-18 08:53:47 -05:00
Nick Mathewson
1928fd0b72
circmgr: Make "specific-relay" non-experimental.
2022-11-18 08:53:47 -05:00
Nick Mathewson
b5a9e0b475
chanmgr: Make "pt-client" non-experimental.
2022-11-18 08:53:47 -05:00
Nick Mathewson
c441853cb8
Merge branch 'log_guard_status' into 'main'
...
GuardMgr: Log significant guard/bridge status changes at info/warn
Closes #627
See merge request tpo/core/arti!869
2022-11-18 13:51:42 +00:00
Ian Jackson
c0fa78fd4d
Merge branch 'display_chan_target' into 'main'
...
ChanTarget: Add a display function, with better output.
Closes #647
See merge request tpo/core/arti!868
2022-11-18 13:19:10 +00:00
Ian Jackson
fc047b4b3c
Merge branch 'inst_as_arg' into 'main'
...
GuardMgr: Resolve a `TODO pt-client` by having `update` take an `Instant`.
See merge request tpo/core/arti!863
2022-11-18 12:42:02 +00:00
Nick Mathewson
cb3a790084
netdoc: Add a test for routerdesc family parsing.
2022-11-17 14:40:15 -05:00
Nick Mathewson
5655b95b54
netdoc: Correct and test some tricky routerdesc errors
...
These required hex-editing identity certificates :P
2022-11-17 14:35:40 -05:00
Nick Mathewson
c0bc7bb11e
netdoc: Add tests for routerdesc accessors.
2022-11-17 13:43:32 -05:00
Nick Mathewson
9f53a79ddf
Netdoc: use a different desc in tests.
...
This is from Akka, which ahf runs.
2022-11-17 13:25:05 -05:00
Nick Mathewson
8dfbbca4e5
GuardMgr: Log when a guard status changes (significantly).
...
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 .
2022-11-17 12:32:57 -05:00
Nick Mathewson
6c5dd05698
GuardMgr: split Reachable::Unknown into Untried and Retriable
...
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.)
2022-11-17 12:21:06 -05:00
Nick Mathewson
effd53510d
ChanMgr: Log every conection attempt at debug.
2022-11-17 12:01:57 -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
cf152c5ed6
linkspec: Make "pt-client" non-experimental.
2022-11-16 12:26:31 -05:00
Nick Mathewson
7d4691e402
chanmgr: rename new_test_channel_map to new_test_state.
2022-11-16 12:07:47 -05:00
Nick Mathewson
b466e24235
chanmgr::mgr::*: misc spelling fixes and normali[sz]ations
2022-11-16 12:05:20 -05:00
Nick Mathewson
53c401af65
Fix up documentation that referred to a ChannelMap.
2022-11-16 12:02:02 -05:00
Nick Mathewson
5804f0f350
ChanMgr: Rename map.rs to state.rs
...
This is another pure renaming.
2022-11-16 11:46:11 -05:00
Nick Mathewson
8271037d37
ChanMgr: Rename ChannelMap to MgrState
...
We're doing this because the type now holds "all the mutable state
in a ChanMgr", not just the map.
This is a pure renaming; no documentation has been updated.
Part of #606 .
2022-11-16 11:32:49 -05:00
Nick Mathewson
76a89fb178
GuardMgr: Add Instant to update().
...
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.
2022-11-16 09:56:51 -05:00
Nick Mathewson
fd2253cd44
GuardMgr: Rename "now" arg in update() to "wallclock"
...
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.
2022-11-16 09:40:25 -05:00
Nick Mathewson
4a1b3d8954
guardmgr: Remove a now-unneeded "allow(dead_code)"
2022-11-16 09:22:23 -05:00
eta
09b918515c
Merge branch 'ptmgr-config' into 'main'
...
tor-ptmgr: make configuration use builders, plumb into arti-client
See merge request tpo/core/arti!823
2022-11-16 12:12:35 +00:00
Ian Jackson
b46d1600e7
Merge branch 'real_netdoc_pos' into 'main'
...
Replace `Option<Pos>` with `Pos` in `ParseError`.
Closes #640
See merge request tpo/core/arti!859
2022-11-16 11:50:20 +00:00
Ian Jackson
d7dc02968f
pt config, arti cfg test: Expect bridges.transports to be missing
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/823#note_2854365
2022-11-16 11:39:25 +00:00
Ian Jackson
4fe5e8fcaa
arti cfg test: Coalesce expect_missing
...
If there are subkeys which are covered by also expected_missing
superkeys, delete them, since we expect the superkey to be missing, so
the subkey won't show up.
2022-11-16 11:39:25 +00:00
eta
1c9f6fb179
tor-ptmgr: make configuration use builders, plumb into arti-client
...
This brings the draft configuration mechanisms in tor-ptmgr in line with
the config in other crates, using builders. It also plumbs the config
type through into the main `arti-client` config, and adds some example
lines to `arti-example-config.toml`.
2022-11-16 11:39:25 +00:00
Nick Mathewson
7a42cb0e45
Remove a `TODO pt-client` in netdoc.
...
This issue is now torspec!94.
2022-11-15 17:19:26 -05:00
Nick Mathewson
39615516fd
Replace `Option<Pos>` with `Pos` in `ParseError`.
...
We already have `Pos::Unknown` for an error at an unknown
location and `Pos::None` for an error where no location is
sensible. There's no reason to have an additional `Option` here.
Additionally, the use of `Option` gave us a bug where our old
`ParseError::at_pos()` method didn't actually set the position
unless the position was already set. That's not what we want!
Fixes #640 .
Finally, we have to fix a test that was a bit broken because it was
working around #640 .
2022-11-15 16:58:23 -05:00
Nick Mathewson
0378a14014
Merge branch 'fix_bridgeconf_lookup' into 'main'
...
Allow a subset-only ChanMethod match when looking up a BridgeConfig
Closes #642
See merge request tpo/core/arti!858
2022-11-15 19:18:51 +00:00
Ian Jackson
86c7a2da7f
Merge branch 'cfg-doc' into 'main'
...
arti cfg test: Add more documentation
See merge request tpo/core/arti!856
2022-11-15 19:05:12 +00:00
Nick Mathewson
2bd422663e
Resolve a dead-code warning.
2022-11-15 13:53:14 -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
Ian Jackson
67242a2986
arti cfg test: Document exhaustive_1 and comment exhaustive
2022-11-15 18:25:39 +00:00
Nick Mathewson
db9440464b
Remove a spurious log that I committed by mistake. Whoops.
2022-11-15 13:15:32 -05:00
eta
5eccaf008b
Merge branch 'fix_parse' into 'main'
...
netdoc: Allow empty lines at the end of router descriptors
Closes #637
See merge request tpo/core/arti!857
2022-11-15 17:41:29 +00:00
Nick Mathewson
050eab9bba
Implement more cases for `DirSpecificTarget`.
...
Without this fix, any attempt to actually use a circuit for a
`DirSpecificTarget` will fail, since supports() will say false, and
`restrict_mut()` will say `NotSupported`.
2022-11-15 11:42:54 -05:00
Nick Mathewson
89be046466
netdoc: Allow empty lines at the end of a router descriptor.
2022-11-15 11:27:43 -05:00
Nick Mathewson
bc7780bffd
tor-netdoc: Add a new ErrorKind for EmptyLine.
...
Empty lines were previously reported as BadKeyword, which is
confusing.
2022-11-15 11:27:43 -05:00
Ian Jackson
46c272e293
arti cfg test: Break out CONFIG_KEYS_EXPECT_NO_EXAMPLE
...
Giving this a name will allow us to refer to it docs in a moment.
2022-11-15 15:38:47 +00:00
Ian Jackson
c7087d3679
arti cfg test: Drop a redundant allow
...
This allow is also present in the standard lint block at the start of
the test inline module.
2022-11-15 15:11:25 +00:00
Ian Jackson
232e82491d
guardmgr: Document that guardmgr only holds a Weak
2022-11-15 14:39:00 +00:00
Ian Jackson
fdeb2db1c2
arti-client: Retain a strong reference to the inner Arc<BridgeDescMgr>
...
Fixes #636 .
2022-11-15 14:36:02 +00:00
Ian Jackson
b7441c9804
bridges: Create and install a BridgeDescMgr when we bootstrap
2022-11-15 12:08:21 +00:00
Ian Jackson
a565e3381f
arti-client: Store a handle to the DirMgrStore in TorClient (fmt)
...
rustfmt only.
2022-11-15 12:08:21 +00:00
Ian Jackson
63c463944d
arti-client: Store a handle to the DirMgrStore in TorClient
...
We'll need this shortly.
2022-11-15 12:08:21 +00:00
Ian Jackson
647610f2f9
arti-client: Store a handle to the guardmgr in TorClient
...
We'll need this shortly.
2022-11-15 12:08:20 +00:00
Nick Mathewson
79a09ae379
Merge branch 'make_bridges_work' into 'main'
...
Bugfix: preserve active_set when loading guards
See merge request tpo/core/arti!848
2022-11-14 19:40:26 +00:00
Nick Mathewson
2f5f066d85
Merge branch 'report_missing_descs' into 'main'
...
GuardMgr: Update desired bridge descs from 'update' function.
Closes #622
See merge request tpo/core/arti!847
2022-11-14 19:15:12 +00:00
Nick Mathewson
ec2e432bee
Preserve active_set when loading guards.
2022-11-14 13:50:59 -05:00
Nick Mathewson
92115aa366
GuardMgr: Update desired bridge descs from 'update' function.
...
There are some new TODOs here for us to think about, but I think
this will give us something to test.
2022-11-14 13:36:10 -05:00
Nick Mathewson
0f4c7a477a
GuardSet: Add a method to report which bridge descs we want.
2022-11-14 13:36:10 -05:00
Ian Jackson
b41becec56
Merge branch 'guardmgr' into 'main'
...
Move guardmgr creation to arti-client, rather than within circmgr
See merge request tpo/core/arti!850
2022-11-14 17:01:31 +00:00
Ian Jackson
58fc19dc8d
Merge branch 'store3' into 'main'
...
dirmgr: Expopse DirMgrStore
See merge request tpo/core/arti!851
2022-11-14 17:01:10 +00:00
Ian Jackson
7efbc600c0
Merge branch 'bdm-dormant' into 'main'
...
bridge descriptor dormancy: Define an enum and semantics
See merge request tpo/core/arti!845
2022-11-14 17:00:40 +00:00
Ian Jackson
ed4006c87c
Move GuardMgr::new call to arti_client::TorClient (fmt)
...
rustfmt only, broken out to ease review.
2022-11-14 15:52:30 +00:00
Ian Jackson
525c452e77
Move GuardMgr::new call to arti_client::TorClient
...
Having this done within circmgr was irregular - most of our other key
buildup functions are done in TorClient::create_inner.
It is also inconvenient, as it buries the guardmgr within the circmgr.
2022-11-14 15:50:07 +00:00
Ian Jackson
92939439a6
dirmgr Store: Have constructors take DirMgrStore
...
Now the Store is constructed by arti_client, solving the problem
described here
https://gitlab.torproject.org/tpo/core/arti/-/issues/631#note_2853665
but in a different way.
2022-11-14 15:48:17 +00:00
Ian Jackson
5e16c55f9e
dirmgr Store: Introduce DirMgrStore and use for BridgeDescMgr (fmt)
...
rustfmt only, broken out to ease review.
2022-11-14 15:48:17 +00:00
Ian Jackson
cf362f9806
dirmgr Store: Introduce DirMgrStore and use for BridgeDescMgr
...
We are going to change DirMgr's constructors to also take a DirMgrStore.
2022-11-14 15:48:17 +00:00
Ian Jackson
d9f231e099
dirmgr Store: Abolish redundant trait impl
2022-11-14 15:47:04 +00:00
Ian Jackson
527ab06376
dirmgr Store: Use `**` syntax and deref to trait objects
...
This will allow us to get rid of a needless trait impl.
2022-11-14 15:47:04 +00:00
Ian Jackson
bf7d45b7b9
dirmgr Store: Move Send and 'static bounds to Store trait
...
This seems tidier to me.
(It saved a lot of typing when I was trying to make some complicated
pub supertrait with sealed private supertrait, but apparently not
now.)
2022-11-14 15:33:58 +00:00
arnabanimesh
91be995588
Fix Windows shortcut target
2022-11-13 16:05:24 +00:00
Ian Jackson
9ecda958a4
Document Clone semantics of GuardMgr and DirMgr
2022-11-11 16:55:56 +00:00
Ian Jackson
9a979cf2c4
cfg-ify an import
2022-11-11 16:54:01 +00:00
Ian Jackson
c6234428e3
bridge descriptor dormancy: Accept the dormancy value
...
But right now, don't do anything with it. That will come in a future MR.
2022-11-11 15:34:35 +00:00
Ian Jackson
eeb6d52678
bridge descriptor dormancy: Add a TODO for this enum
2022-11-11 15:26:42 +00:00
eta
b1cc1e2065
Merge branch 'workaround_545' into 'main'
...
Temporarily disable it_cancels_delayed_firings.
See merge request tpo/core/arti!846
2022-11-11 11:16:33 +00:00
Nick Mathewson
9c9f9bbd25
Merge branch 'guardmgr-todo-misc' into 'main'
...
Resolve most "TODO pt-client" comments in GuardMgr
See merge request tpo/core/arti!840
2022-11-10 17:50:34 +00:00
Nick Mathewson
b91f7d61b3
GuardMgr: Explain why we timestamp BridgeSets as we do.
2022-11-10 12:11:28 -05:00
Nick Mathewson
f5a5e310a8
GuardMgr: Downgrade a pt-client TODO about an internal API
2022-11-10 12:11:28 -05:00
Nick Mathewson
8cf04d2a38
GuardMgr Document why a BridgeSet has trivial weight thresholds.
...
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.
2022-11-10 12:11:28 -05:00
Nick Mathewson
01def7cf86
GuardMgr: once more, fix our n_primary_dir_info check.
...
Have the check only apply to non-bridge universes, and explain why
in a bunch more comments.
2022-11-10 12:11:28 -05:00
Nick Mathewson
11e83d8069
GuardMgr: remove redundant call to extend_sample_as_needed
...
Previously we would call extend_sample_as_needed in only two places,
one of which called the other unconditionally. That's obviously not
necessary.
I've selected just one of them (`update_guardset_internal`) since it
fits better with the theme if that function. I've added comments
explaining what is going on.
This commit also introduces a yes/no enum for "were any guards added
while extending this set". Formerly we had a boolean, but it got
passed around so many times that I think its intent became obscure.
2022-11-10 12:11:28 -05:00
Nick Mathewson
1d4db04e4e
GuardMgr: rename n_primary_without_dir_info
...
What this function actually does is return the number of primary
guards whose presence (by identity) is ambiguous in a current
universe. The new name and documentation should help avoid
confusion.
The method's old name had led me astray when identifying whether it
should apply to bridges in one case. This commit also removes the
corresponding `TODO pt-client`.
2022-11-10 12:11:28 -05:00
Nick Mathewson
1ad45f164e
Remove TODO to rename for_circuit_usage in favor of #623
2022-11-10 12:11:28 -05:00
Nick Mathewson
b8792307ac
GuardMgr: Remove TODO to move `mod bridge` to another crate
...
The code seems happy enough here for now.
2022-11-10 12:11:28 -05:00
Nick Mathewson
942dfc8487
Resolve todo!()s and TODOs around BridgeRelay::HasAddrs.
...
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.
2022-11-10 12:11:28 -05:00
Nick Mathewson
dcfb4d0956
RouterDesc: Add an or_ports method.
2022-11-10 12:11:28 -05:00
Nick Mathewson
71510fbd96
Temporarily disable it_cancels_delayed_firings.
...
This test is timing-dependent in a way that seems to fail on heavily
loaded CI machines. See #545 .
2022-11-10 11:58:35 -05:00
Nick Mathewson
e5c26a123f
Actually, require rsa 0.7.1.
...
rsa 0.7.0 has been yanked.
2022-11-10 11:26:35 -05:00
Nick Mathewson
0a1141db32
tor-persist: use map_while
...
It was introduced in Rust 1.57.
2022-11-10 11:04:20 -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
e19ff0ec21
Upgrade rsa to 0.7. Closes #613 .
2022-11-10 11:04:20 -05:00
Nick Mathewson
34ae02e75f
Upgrade to serde_with 2, phf 0.11. Closes #526 .
2022-11-10 11:04:18 -05:00
Nick Mathewson
2c13a78c57
Upgrade to tinystr 0.7. Closes #591 .
2022-11-10 10:57:33 -05:00
Nick Mathewson
936920b26e
bump rust-version to 1.60 in every crate.
2022-11-10 10:57:33 -05:00
Ian Jackson
eacb5dc2e3
bridge descriptor dormancy: Define an enum and semantics
...
This is part of #630 .
2022-11-10 15:17:36 +00:00
Nick Mathewson
d9788c16b3
Merge branch 'bridge-error' into 'main'
...
Use ErrorKind::TorAccessFailed for misbehaving bridges
See merge request tpo/core/arti!842
2022-11-10 13:50:47 +00:00
Nick Mathewson
3c29dfd99d
Merge branch 'bdm-process-doc-test' into 'main'
...
bridge descs: Add tests for process_document
See merge request tpo/core/arti!841
2022-11-10 13:50:23 +00:00
Nick Mathewson
6454896d95
Merge branch 'bdm-params' into 'main'
...
Remove TODO re BridgeDescDownloadConfig defaults
See merge request tpo/core/arti!839
2022-11-10 13:49:54 +00:00
trinity-1686a
614cf34284
Check more targets
2022-11-10 13:34:17 +00:00
Ian Jackson
42dd5d7746
bridge desc: Drop a done TODO
...
We have a separate BridgeDescMgr, rather than reusing DirMgr, so we
will not be implementing BridgeDescProvider for DirMgr.
2022-11-08 18:54:31 +00:00
Ian Jackson
8fbff3a27f
Use ErrorKind::TorAccessFailed for misbehaving bridges
...
(Use semantic linefeed for the doc comment.)
2022-11-08 18:52:57 +00:00
Ian Jackson
d808f70a13
bridge descs: Add tests for process_document
2022-11-08 18:42:34 +00:00
Ian Jackson
f1f4ca56a8
Remove TODO re BridgeDescDownloadConfig defaults
2022-11-08 17:34:25 +00:00
Ian Jackson
05cad7c0eb
bridge desc: todo re config: weaken and reference a new ticket
2022-11-08 17:34:13 +00:00
Ian Jackson
4f893648b8
Merge branch 'clap-v3' into 'main'
...
Upgrade to clap 3
Closes #616
See merge request tpo/core/arti!830
2022-11-08 17:11:04 +00:00
Nick Mathewson
9dcfc2bb65
GuardMgr: Docs for BridgeDescProvider
2022-11-08 11:35:35 -05:00
Nick Mathewson
91cfd7ea4a
GuardMgr: Remove a TODO pt-client comment.
...
The BridgeSet type does not necessarily need further changes... and
if it gets them, it won't be because of this comment.
2022-11-08 11:35:35 -05:00
Ian Jackson
8efcfb64af
Merge branch 'misc-todo-ptclient' into 'main'
...
Downgrade and/or remove a few misc "TODO pt-client" comments
See merge request tpo/core/arti!838
2022-11-08 16:21:30 +00:00
Nick Mathewson
ec9e9c86e7
Merge branch 'store' into 'main'
...
Persistently cache bridge descriptors
Closes #619
See merge request tpo/core/arti!831
2022-11-08 15:10:21 +00:00
Ian Jackson
46286dddd4
Merge branch 'todo-ptclient-linkspec-1' into 'main'
...
Resolve `TODO pt-client` entries in linkspec
See merge request tpo/core/arti!836
2022-11-08 15:01:02 +00:00
Ian Jackson
ea369e8385
bridge descs: Rename BridgeDescMgr from BridgeDescManager
...
This is more consistent with our naming elsewhere.
Suggested-by: Nick Mathewson <nickm@torproject.org>
2022-11-08 14:40:28 +00:00
eta
53f62eb8be
Merge branch 'store-yak-misc' into 'main'
...
Small misc yaks for bridge descriptor persistence
See merge request tpo/core/arti!828
2022-11-08 14:28:14 +00:00
Nick Mathewson
3bcb85bd59
Merge branch 'guards_as_bridges_part4' into 'main'
...
GuardMgr: Almost finish wiring Bridges in as a guard substitute
See merge request tpo/core/arti!832
2022-11-08 13:48:27 +00:00
Nick Mathewson
6b422b1c4d
circmgr: downgrade TODO pt-client comments
...
These are structure-internal things we can solve later, if ever.
2022-11-08 08:31:59 -05:00
Nick Mathewson
c99976fabc
ChanMgr: downgrade and remove a few TODO-ptclient comments
...
renamings are now #623 . Code movement can happen later.
2022-11-08 08:27:19 -05:00
Ian Jackson
d9d9cdeac9
bridge descs: Apply sensitive() to bridge identity in error log msg
2022-11-08 13:19:42 +00:00
Nick Mathewson
ada3acf6b8
Try to explain exactly what lookup_bridge_circ_target does
2022-11-08 08:10:15 -05:00
Nick Mathewson
0fd41a7faf
GuardMgr: Try to explain what is going on with update()
...
This explanation is slightly complicated by the fact that I think
that one of the calls to update_guardset_internal() is possibly
unnecessary, and that one of the calls that it makes is potentially
ill-advised.
I'm not going to make those changes right now, however, because they
are potentially a little destabilizing.
2022-11-08 08:10:15 -05:00
Nick Mathewson
6591842458
Refactor configured_bridges
...
Now it is an Option, and is set to None if bridges aren't enabled.
This simplifies `replace_bridge_config` a bit, and forces us to
check for `None` in a few more places.
2022-11-08 08:10:15 -05:00
Nick Mathewson
2a5b4d21e3
GuardMgr: Document that providers should only be installed once.
...
Enforce this with assert!() and a documented panics section.
2022-11-08 08:10:15 -05:00
Nick Mathewson
9fda8d17c4
GuardMgr: Fix build with bridge-client disabled.
2022-11-08 08:10:15 -05:00
Nick Mathewson
6bcce19655
GuardMgr: Remove no-longer-relevant `TODO pt-client` comments
...
Also remove a bunch of now-unnecessary `allow(dead_code)`
annotations.
2022-11-08 08:10:15 -05:00
Nick Mathewson
1418ec13a8
GuardMgr: Rename an error variant
2022-11-08 08:10:15 -05:00
Nick Mathewson
3943c6cd1e
GuardMgr: Spelling fixes and normalizations.
2022-11-08 08:10:15 -05:00
Nick Mathewson
3f3d82ee48
GuardMgr: do not use fallbacks when in bridge mode.
2022-11-08 08:10:15 -05:00
Nick Mathewson
5c3bb3d7e1
GuardMgr: When possible, return a FirstHop that can be a CircTarget
...
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).
2022-11-08 08:10:15 -05:00
Nick Mathewson
25d7924832
GuardMgr: Refactor UniverseRef to contains Arcs.
...
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.
2022-11-08 08:10:15 -05:00
Nick Mathewson
7fa08140cf
GuardMgr: Remove an outdated "Limitations" comment.
...
Found while grepping for NetDir.
2022-11-08 08:10:15 -05:00
Nick Mathewson
e1ef939ebd
GuardMgr: do not block netdir if we are using bridges
...
The `GuardMgr` code has functionality to tell the DirMgr "Hey,
don't switch to the new NetDir yet: we still need more guard
information!" But we never want to do that if we're selecting
bridges, since they don't come from the NetDir.
2022-11-08 08:10:15 -05:00
Nick Mathewson
1a4fbb2c3f
GuardMgr: Add UniverseType to make code more explicit.
...
Instead of duplicating the logic about which guard sample uses which
universe, we explicitly ask it, and then use that universe. This
will avoid trouble if/when we introduce more samples.
2022-11-08 08:10:15 -05:00
Nick Mathewson
d395ae75a5
GuardMgr: Launch a background task to keep the list of bridge
...
descriptors updated as appropriate.
2022-11-08 08:10:15 -05:00
Nick Mathewson
e93ee14270
GuardMgr: Exit keep-netdir-updated task early if GuardMgr disappears.
2022-11-08 08:10:15 -05:00
Nick Mathewson
697a355a21
GuardMgr: Pass correct universe to "Bridges" `GuardSet`.
...
This can probably be done in a simpler way, but for the moment I
would prefer to try to minimize the amount of code I'm changing
here.
2022-11-08 08:10:15 -05:00
Nick Mathewson
f4149cd133
GuardMgr: Change BridgeSet, BridgeRelay to use more references
...
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.
2022-11-08 08:10:15 -05:00
Nick Mathewson
51a98883c8
GuardMgr: Store bridge configuration.
...
I'm using an Arc<[]> here though I think that there's a chance
that a simple Vec<> would suffice. Since it's an internal type,
nothing will break if we change it later.
Also, we now switch into and out of the Bridges guard sample
as needed. However, that selection is not (yet) built from the
list of bridges. That will come soon.
2022-11-08 08:10:15 -05:00
Nick Mathewson
188b9c0f86
GuardMgr: Remove duplicate code in set_filter
2022-11-08 08:10:15 -05:00
Nick Mathewson
04bcf69749
GuardMgr: Clarify intent with update_active_set.
...
Also fix its behavior when using bridges.
2022-11-08 08:10:15 -05:00
Nick Mathewson
ad47b28f2f
GuardMgr: Split `update_internal` into two functions.
...
The first part changes which guard set is active based on based on
the parameters, which always come from a NetDir; the second changes
the contents of the active guard set, based on a Universe.
2022-11-08 08:10:15 -05:00
Nick Mathewson
95a95076a7
Refactor external guardmgr APIs: Stop taking NetDir arguments.
...
These arguments were used only for legacy (testing) purposes; the
tests now use `TestNetDirProvider`. This lets us simplify our
internal logic for passing a `NetDir` to our samples, and prepare
for having a `BridgeSet` to pass there instead.
This is a breaking change to `guardmgr` and `circmgr`.
2022-11-08 08:10:15 -05:00
Nick Mathewson
339bd8bde0
Mock implementation of a NetDirProvider for testing.
...
I'm about to remove the old testing APIs from GurdMgr that took in a
NetDir in each function: adding this will make that possible.
2022-11-08 08:10:15 -05:00
Nick Mathewson
6b94bc5e4c
Add an accessor for the latest BridgeDescList.
2022-11-08 08:10:15 -05:00
Nick Mathewson
faf51702ac
Implement GuardMgr::install_bridge_desc_provider
2022-11-08 08:10:15 -05:00
Nick Mathewson
5cb9e1987e
Require Send+Sync for BridgeDescProvider
...
We require these for NetDirProvider, so this shouldn't be a big reach.
2022-11-08 08:10:11 -05:00
Ian Jackson
93a150229a
sqlite cache: Document reasoning about timestamps
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/831#note_2851764
2022-11-08 13:00:51 +00: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
d448809e49
Merge branch 'hilev_spelling' into 'main'
...
Spelling fixes and normalizations on some high-level crates
See merge request tpo/core/arti!835
2022-11-07 15:48:06 +00: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
b295518a42
Spelling fixes and normalizations on some high-level crates
2022-11-07 10:21:58 -05:00
Ian Jackson
85035c7c5a
bridge desc: Make BridgeDescProvider DynClone
...
This allows the use of Box<dyn BridgeDescProvider> in callers,
since Box<dyn BridgeDescProvider> is now Clone.
2022-11-07 11:56:41 +00:00
Dimitris Apostolou
9c7d1802f5
Fix typos
2022-11-06 06:51:58 +02:00
Ian Jackson
5b66a5e199
bridge desc tests: Test caching and if-modified-since
2022-11-04 19:08:32 +00:00
Ian Jackson
78f7916a88
bridge desc tests: Break out queues_are_empty helper
2022-11-04 19:08:32 +00:00
Ian Jackson
40c21b7d19
bridge desc tests: Provide a sqlite connection
...
The current test case doesn't use this.
2022-11-04 19:08:32 +00:00
Ian Jackson
636bff3193
bridge desc: Implement storage functions at the DB layer
2022-11-04 19:08:32 +00:00
Ian Jackson
6bb2eb9902
bridge desc: Make Downloaded be Debug
2022-11-04 19:08:32 +00:00
Ian Jackson
5bc1d40a2b
bridge desc: Implement cache reuse logic and if-modified-since
...
This introduces the new API functions to Store.
But currently they are all no-ops.
So all this machinery doesn't actually do anything.
Also, it changes the API to the mockable downloader, to allow it to
support if-modified-since. So this isn't used either. But it is more
convenient to do this all at once in BridgeDescManager, since care
needs to be taken about the intraction between if-modified-since and
the persistent cache.
2022-11-04 19:08:32 +00:00
Ian Jackson
279a169031
bridge desc: Rename one more variable to text
2022-11-04 19:02:23 +00:00
Ian Jackson
eaaa61a8e2
bridge desc: Catch panics in the download functionality
2022-11-04 19:02:23 +00:00
Ian Jackson
3f3f27193c
bridge desc: Provide a Store to the bridge desc manager
...
We use the one in the dirmgr. That means that our constructor now has
to take a dirmgr. And, the dirmgr must have a circmgr.
This is all rather odd, TBH.
Add .. to the binding of the return values from setup, as
future-proofing.
The tests now need to provide a Store too. Make the sqlite::new_empty
function pub(crate) so we can use it.
We must retain the _db_tmp_dir, since when it goes away the tmp
directory is deleted and the db goes readonly.
2022-11-04 19:02:23 +00:00
Ian Jackson
1fa9dd62b3
bridge desc tests: Apply tracing_test::traced_test
...
This lets us see the log messages. They look fine, as it happens.
2022-11-04 19:02:23 +00:00
Ian Jackson
9424b0970d
tor-dirmgr: impl AsRef<dyn Error> for Error
...
This allows use with tor_error::Report.
2022-11-04 19:01:24 +00:00
Ian Jackson
f3957a50b6
tor-netdoc: RouterDesc: Add published accessor
...
The bridge descriptor manager is going to want this.
2022-11-04 19:01:24 +00:00
Ian Jackson
dcdd8053b4
dirmgr: Make store be in an Arc
...
This will let us share it with the bridge descriptor manager.
(As discussed with Nick.)
2022-11-04 19:01:24 +00:00
Ian Jackson
9a285ec4ad
dirmgr sqlite store: Improve schema updates
...
* Centralise applying the schema updates, in a closure
* Make the schema update SQL texts be in an array so we can loop
* Make the version update statement generic, not cloned-and-hacked
This will make it possible to add another schema version without
error-prone conditions etc.
2022-11-04 19:01:24 +00:00
Gabriel de Perthuis
21a3808684
Upgrade to clap 3: replace deprecated functions
...
Also replace Arg::takes_value with Arg::action to configure flags
that don't take parameters vs options that do.
This makes it easy to upgrade to clap 4.
Tested deprecations with:
cargo check --workspace --all-features --features clap/deprecated
2022-11-04 19:28:40 +01:00
Gabriel de Perthuis
bc08ea48f7
Upgrade to clap 3 with minimal changes
...
This removes the last cargo audit override (for the unmaintained
ansi_term).
Don't mark options as required when they have default values:
see <https://github.com/clap-rs/clap/pull/3793 >.
2022-11-04 19:28:38 +01:00
Ian Jackson
bf563f3bdf
bridgedesc: Rename "text" from "output"
...
This was confusing, because it's the output of the donwload, but
nowhere near the output of the whole process. And it's going to
become even less so.
2022-11-03 19:00:47 +00:00
Ian Jackson
17ceae724e
bridgedesc: Make process_document into a free function
...
It deserves this treatment, I think.
2022-11-03 18:59:50 +00:00
Ian Jackson
c7a7ce5c20
bridgedesc: Introduce Downloaded
...
This gives names to things and makes things clearer, and this will be
even more true in a moemnt.
2022-11-03 18:59:50 +00:00
Ian Jackson
d2b31f7796
bridgedesc: download: Break out process_document
...
We're going to want to reuse this for handling cached stuff.
2022-11-03 18:57:40 +00:00
Ian Jackson
6fbf3059cd
bridgedesc: Prepare Mockable trait for if-modified-since
2022-11-03 18:57:40 +00:00
Nick Mathewson
7d079ade3b
Merge branch 'warning' into 'main'
...
tor-guardmgr: use imported WeightThreshold in one place
See merge request tpo/core/arti!825
2022-11-03 16:25:37 +00:00
Ian Jackson
7d6f5d5eab
guardmgr config: Provide bridge information to new and reconfigure
2022-11-03 15:48:07 +00:00
Ian Jackson
aa375e2e09
tor-guardmgr: use imported WeightThreshold in one place
...
Without this, an unused import warning is generated when building
without features.
2022-11-03 15:44:32 +00:00
Ian Jackson
5bc3934fb4
bridges config: Provide uninhabited placeholder
...
This will avoid having to make bridge-related trait features in
GuardMgr conditional, which would be non-additive.
2022-11-03 15:43:41 +00:00
Ian Jackson
3dde9f8a05
bridges config: Check that bridges aren't enabled with no bridges
...
This is the validation which is called for by the documentation.
2022-11-03 15:43:41 +00:00
Ian Jackson
6c64be06a6
guardmgr config: Introduce and require new GuardMgrConfig trait
...
It doesn't seem to me like it makes sense to provide the backward
compatibility here.
2022-11-03 15:43:41 +00:00
Ian Jackson
f50da3efa1
define_accessor_trait: Allow specification of other items
2022-11-03 15:43:41 +00:00
Ian Jackson
64de9f74be
define_accessor_trait: Allow specification of supertraits
2022-11-03 15:43:41 +00:00
Ian Jackson
2bfce54959
guardmgr config: Pass fallback list from config by reference
...
This does involve additional cloning. However, soon it will mean that
we can pass the whole `TorClientConfig` by reference.
2022-11-03 15:43:41 +00:00
Nick Mathewson
1179c39859
Suppress two clippy::large_enum_variant warnings
...
These are newly present on 1.65. We can address them later.
2022-11-03 11:09:51 -04:00
Nick Mathewson
932fe48eaf
Run add_warnings.
2022-11-03 11:06:02 -04:00
eta
c77cecd5b3
Merge branch 'edition-2021' into 'main'
...
set all crate edition to 2021
See merge request tpo/core/arti!822
2022-11-03 14:39:24 +00:00
Ian Jackson
70b420adf8
bridge descriptors tests: Fix flaky test
2022-11-03 11:46:20 +00:00
Ian Jackson
daf7eac60a
bridge descriptors tests: Test set_bridges more thoroughly (fix)
...
The RetryDelays are being triggered for the 2nd time here, so their
timeouts can be longer. We must bump the sleep to make sure we don't
have a flaky test.
2022-11-03 11:37:30 +00:00
Ian Jackson
7a99601721
bridge descriptors: logging: Log addition and removal (fmt)
...
Worsify formatting as demanded by rustfmt.
2022-11-03 11:37:30 +00:00
Ian Jackson
269808336e
bridge descriptors: logging: Log addition and removal
...
This involves breaking the calls to `new_bridges.remove` into a helper
that does the logging.
2022-11-03 11:37:30 +00:00
Ian Jackson
17c766fde4
bridge descriptors: logging: Log download start and outcome
2022-11-03 11:37:30 +00:00
Ian Jackson
1ccd9db9af
bridge descriptors tests: Test set_bridges more thoroughly
...
Prior to the previous commit, set_bridges would malfunction if there
were bridges which where (i) in current (ii) in queued or running
(iii) in the new bridge set.
This test failed then and passes now.
2022-11-03 11:37:30 +00:00
Ian Jackson
4a830e1ac2
bridge descriptors: Rewrite set_bridges
...
This was fundamentally confused and irregular. Now it is more
regular: it does the same things to all the elements of Tracked,
and a simple filtering on current.
This fixes a bug, for which I'm about to add a test case.
2022-11-03 11:37:30 +00:00
Ian Jackson
0571674a64
bridge descriptors tests: Add another couple of test cases
2022-11-03 11:37:30 +00:00
Ian Jackson
6db3403820
bridge descriptors tests: stream_drain_ready returns event count
...
We'll use this in a moment.
2022-11-03 11:37:30 +00:00
Ian Jackson
53c1cf0c6d
bridge descriptors tests: Break out bad_bridge helper function
2022-11-03 11:37:30 +00:00
Ian Jackson
42b1b08fdf
bridge descriptors: Change default max_refetch
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/820#note_2850269
2022-11-03 11:37:30 +00:00
Ian Jackson
2ae8a52371
bridge descriptors: Add clarification about bridge states
2022-11-03 11:37:30 +00:00
Ian Jackson
ad39873782
bridge descriptors: Improve and fix docs for consider_launching
2022-11-03 11:37:30 +00:00
Ian Jackson
d44bc1d0f8
bridge descriptors: Add comments where StateGuard is dropped
2022-11-03 11:37:30 +00:00
Ian Jackson
54e51cdba5
bridge descriptors: Document `changed` and `earliest_timeout` Options
2022-11-03 11:37:30 +00:00
Ian Jackson
fb4ffb76fd
bridge descriptors: Document updates argument to timeout_task
2022-11-03 11:37:30 +00:00
Ian Jackson
48f48841e1
Require derive_more 0.99.3
...
0.99.[012] have a bug https://github.com/JelteF/derive_more/issues/114
which makes the Deref derive for bridgedesc::StateGuard not work
and therefore breaks minimal-versions CI.
It seems simpler to require the newer version everywhere.
2022-11-03 11:37:23 +00:00
Ian Jackson
8eb7c731a2
bridge descriptors: Tests
2022-11-03 11:37:05 +00:00
Ian Jackson
3a185d61df
bridge descriptors: Provide a consistency check function
...
This is really part of the tests, but I put it here so that it can be
compiled-in if someone wants it during debugging.
2022-11-03 11:37:05 +00:00
Ian Jackson
51b4588cc0
bridge descriptors: Provide an implementation of BridgeDescProvider
...
Tests will come in a moment.
2022-11-03 11:37:05 +00:00
Ian Jackson
0fb535ba28
tor-dirclient: Response: Provide into_output_string
...
This is the missing one of the full set. It turns out that I wanted
this rather than the non-consuming output_string.
2022-11-03 11:37:05 +00:00
Ian Jackson
42f9651b8e
Copy tor-netdoc/testdata/routerdesc1.txt into tor-dirmgr
...
This seems better than having tor_netdoc export a `#[cfg(test)]`
public constant.
2022-11-03 11:37:05 +00:00
Nick Mathewson
66f34ee774
Merge branch 'guards_as_bridges_part3' into 'main'
...
GuardMgr: decouple NetDir from guards and sample code.
See merge request tpo/core/arti!815
2022-11-02 12:41:03 +00:00
Nick Mathewson
c2ed381c99
Refactor CandidateStatus API to simplify code in descs.
...
This removes some duplication.
2022-11-02 08:07:32 -04:00
Nick Mathewson
fc0c12510a
GuardMgr: Fix and improve comments based on review.
2022-11-02 08:07:32 -04:00
Nick Mathewson
6828178dec
guardmgr: fix rustdoc references.
2022-11-02 08:07:32 -04:00
Nick Mathewson
08473872ab
guardmgr: Refactor candidate info; add `full_dir_info`
...
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.
2022-11-02 08:07:11 -04:00
Nick Mathewson
5867318a35
guardmgr: Implement Universe for bridges.
...
Now we can use a group of bridges as the basis for a sample of
guards.
2022-11-02 08:06:43 -04:00
Nick Mathewson
79dade342a
guardmgr: Universe API should look up by ChanTarget
...
This will be necessary for bridges.
2022-11-02 08:06:43 -04:00
Nick Mathewson
82e9a57012
guardmgr: take sampled guards from Universe.
...
This is a trickier case, since we have to deal with weights.
2022-11-02 08:06:43 -04:00
Nick Mathewson
7733146c8c
guardmgr: Continue porting porting code to use Universe.
...
Two more simple cases that can use Universe instead of Netdir.
2022-11-02 08:06:20 -04:00
Nick Mathewson
fbcacea993
guardmgr: Begin to decouple guards from NetDir.
...
In this and the upcoming commits I'll be changing how guards related
to `NetDir` and to `Relay`. Previously, a guard could only come
from (or be updated from) a `Relay` in a `NetDir`. Soon it will be
able to be built from a bridge as well.
To do this, I'm defining a `Universe` trait (name negotiable) that
represents a set of things that may be guards. I'm going to
continue extending its functionality until there are no more
methods in guard.rs or sample.rs that take `NetDir`.
This commit removes most of the usage of `NetDir` and `Relay` in
`guard.rs`.
2022-11-02 08:05:51 -04:00
Nick Mathewson
b5f498021d
guardmgr: Rename microdescriptor_missing to dir_info_missing
2022-11-02 07:59:56 -04:00
Nick Mathewson
39ea0518ee
guardmgr: Allow guards to be constructed from any ChanTarget.
2022-11-02 07:59:56 -04:00
Nick Mathewson
1cb6ea1e77
guardmgr: Include PtTarget in guards.
...
Use a vector, since we may (someday) want to allow a Guard to have
multiple PtTargets.
2022-11-02 07:59:56 -04:00
Ian Jackson
0489d2d4be
Merge branch 'notify' into 'main'
...
refactor config reload triggering
Closes #562
See merge request tpo/core/arti!819
2022-11-01 13:31:17 +00:00
trinity-1686a
c487de6c46
debounce reload cfg events
2022-11-01 13:42:05 +01:00
trinity-1686a
d29f38603d
set all crate edition to 2021
2022-11-01 00:17:33 +01:00
trinity-1686a
ce886e209f
rename unused field
2022-10-30 12:36:13 +01:00
trinity-1686a
5cf2933d33
update some strings
2022-10-30 12:31:07 +01:00
trinity-1686a
5abddfb579
use iife so we can try! instead of custom error handling
2022-10-30 12:31:07 +01:00
trinity-1686a
66c08c967e
refactor so events always indicate reload
2022-10-30 12:31:07 +01:00
trinity-1686a
749746a609
depends less on notify types
2022-10-30 12:31:07 +01:00
trinity-1686a
e6e064ac8a
remove unused dependancies
2022-10-29 13:29:55 +02: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
Nick Mathewson
557a07677e
guardmgr: Rename and clarify of non-persistent-state copy fns
...
These will need a bigger overhaul: see #612 and #611 .
2022-10-27 16:40:35 -04:00
Ian Jackson
4f171acaf7
Clarify fix_consistency
2022-10-27 16:40:35 -04:00
Ian Jackson
7180079112
Clarify what it means to be "an identity" for a primary guard.
2022-10-27 16:40:35 -04:00
Ian Jackson
15d464a929
tor-guardmgr: Add big doc comment about guard id handling
2022-10-27 16:40:35 -04:00
Ian Jackson
4a59d384b6
tor-dirmgr: impl Default for FlagPublisher
2022-10-27 15:57:57 +01:00
Ian Jackson
94325cd456
tor-dirmgr: impl FlagEvent for BridgeDescEvent
2022-10-27 15:57:57 +01:00
Ian Jackson
26a7aa9aa6
BridgeDescProvider: Make BridgeDescEvent repr(u16) and derive traits
...
This will enable us to impl FlagEvent for it.
2022-10-27 15:57:54 +01: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
Ian Jackson
a89daba1c8
tor-guardmgr: bridges: export BridgeDescError at toplevel
2022-10-27 15:57:54 +01:00
eta
84a2624401
Merge branch 'fuzz_ptmgr_ipc' into 'main'
...
ptmgr: Add a fuzzer for ptmessage.
See merge request tpo/core/arti!814
2022-10-27 14:51:35 +00:00