Commit Graph

2958 Commits

Author SHA1 Message Date
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 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
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 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
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