Commit Graph

4671 Commits

Author SHA1 Message Date
Nick Mathewson b05d380ec0 Merge branch 'bridge-api-error' into 'main'
Make error from bridge descriptor provider be a trait object

See merge request tpo/core/arti!796
2022-10-21 16:07:23 +00:00
Ian Jackson 0924fb3623 tor-guardmgr: descs: Make BridgeDescError DynClone 2022-10-21 16:22:17 +01:00
Ian Jackson f4ec3e6cec tor-guardmgr: descs: Make BridgeDescError into a trait 2022-10-21 16:22:13 +01:00
Ian Jackson 77ddddb1f8 tor-error: make HasRetryTime object-safe
We could in the future provide a version of abs_retry_time which took
an &dyn closure if that turns out to be wanted.

I think this isn't a semver break because trait implementors are
allowed to relax bounds.
2022-10-21 16:08:48 +01:00
Nick Mathewson fe6ac2d9ed Merge branch 'whoops_unused_imports' into 'main'
Oops: Mark some imports as pt-client only.

See merge request tpo/core/arti!794
2022-10-21 13:15:22 +00:00
Nick Mathewson e0c1928ea0 Merge branch 'matrix-features' into 'main'
add checks for many feature combinations

Closes #303

See merge request tpo/core/arti!775
2022-10-21 12:57:36 +00:00
Nick Mathewson 1e4b1f6433 Oops: Mark some imports as pt-client only.
This causes CI problems, and is entirely my fault.
2022-10-21 08:32:02 -04:00
Nick Mathewson a12667e077 Merge branch 'no_redundant_allocation' into 'main'
tor-cell: Avoid redundant allocation

See merge request tpo/core/arti!790
2022-10-21 12:18:49 +00:00
Nick Mathewson 90a6ef122c Merge branch 'fixed_len_handshake' into 'main'
tor-cell: Rename fixed_len to fixed_len_handshake

See merge request tpo/core/arti!789
2022-10-21 12:18:12 +00:00
Emil Engler c489e1d911
tor-cell: Avoid redundant allocation
This commit changes the way how a vector with a known sized gets
allocated, by using Vec::with_capacity() instead of Vec::new().
It will eventually avoid an allocation of more memory than required.
2022-10-21 13:25:26 +02:00
Emil Engler f423721cc3
tor-cell: Rename fixed_len to fixed_len_handshake
This commit renames the fixed_len! macro to fixed_len_handshake!, in
order to indicate, that this macro is only suited for cells with
commands related to handshaking.
2022-10-21 13:14:50 +02:00
Ian Jackson db2ce541fb Merge branch 'dirclient-errors' into 'main'
Make DirResponse API not an error handling footgun

See merge request tpo/core/arti!782
2022-10-20 17:30:01 +00:00
Nick Mathewson f23adcd4c8 Merge branch 'pt-serde' into 'main'
serde support for PtTarget

See merge request tpo/core/arti!780
2022-10-20 17:13:19 +00:00
Nick Mathewson 608153cd93 Merge branch 'connect-via-proxy' into 'main'
Implement a TransportHelper to connect via a SOCKS-based pluggable transport

See merge request tpo/core/arti!776
2022-10-20 16:44:58 +00:00
Nick Mathewson 938af98b8c Remove now-needless check_doc_features exception. 2022-10-20 12:37:41 -04:00
Nick Mathewson 34aa352d16 Implement serde for PtTarget and its members.
This will let us remember bridges that use pluggable transports.
2022-10-20 12:37:41 -04:00
Nick Mathewson bc09a3fe65 Inline now-needless variant constructors for PtTargetAddr 2022-10-20 12:37:41 -04:00
Nick Mathewson 95b03dc96f Remove a now-needless `allow(dead_code)` 2022-10-20 12:37:41 -04:00
Nick Mathewson d8f9a79c4f linkspec: Always expose PT-related types.
The `PtTarget` type and its contents (`TransportName`,
`PtTargetAddr`, `PtSettings`) are now unconditionally compiled and
exposed.  This will allow us to serialize and deserialize them in
our guard-state files even when we have been built without explicit
PT support.

The `pt-client` feature controls whether `TransportName` is a
variant of `TransportId`, and whether `PtTarget` is a variant of
`ChanMethod`: this in turn means that we'll still have simpler
binary code and smaller structures when we're building without PT
support (which is what we wanted when we initially made these types
conditional).
2022-10-20 12:37:40 -04:00
Ian Jackson 7b2a0fbcb1 tor-dirclient: Provide fallible DirResponse::output and into_output 2022-10-20 17:24:53 +01:00
Ian Jackson da3351ad49 tor-dirclient: Make DirResponse be Clone
I want this for testing.  It seems friendly to provide it, though.
2022-10-20 17:24:53 +01:00
Ian Jackson b3675c76dc tor-dirclient: Introduce RequestError:HttpStatus 2022-10-20 17:24:53 +01:00
Ian Jackson e8d662ed7c tor-dirclient: Make RequestFailed its own error type (rustfmt)
Split off to assist review.
2022-10-20 17:24:53 +01:00
Ian Jackson d9375b2b8d tor-dirclient: Make RequestFailed its own error type
We're going to have functions on Response that fail by returning only
one of these.

Sadly this diff is quite noisy.
2022-10-20 17:24:53 +01:00
Ian Jackson 3b1af05851 tor-dirclient Response: Rename output methods
These don't check errors and are therefore quite hazardous.
I'm going to introduce a more cooked version in a moment.
2022-10-20 17:24:50 +01:00
Ian Jackson 803131c1ea Merge branch 'bridge-internal-apis' into 'main'
Use BridgeConfig to identify bridges in two places

See merge request tpo/core/arti!781
2022-10-20 16:14:14 +00:00
Ian Jackson 4588c0f729 Merge branch 'bridge-hasaddrs' into 'main'
impl ChanTarget for BridgeConfig

See merge request tpo/core/arti!783
2022-10-20 16:04:58 +00:00
Ian Jackson 9c7ea41322 impl ChanTarget etc. for BridgeConfig 2022-10-20 14:16:34 +01:00
Ian Jackson 6193bed788 impl HasAddrs for PtChannelAddr and ChannelMethod 2022-10-20 14:16:34 +01:00
Ian Jackson c93500e14c tor-linkspec: impl From<&ChanTarget> for OwnedChanTarget
This lets us write functions which can either take an existing
owned OwnedChanTarget, or copy out of some other kind of ChanTarget
passed by reference.
2022-10-20 13:29:07 +01:00
Ian Jackson ef5e60c879 circmgr: Plumbing for direct to target directory circuits
The target is identified by Into<OwnedChanTarget>.
We introduce corresponding TargetCircUsage and SupportedCircUsage.
2022-10-20 13:28:30 +01:00
Ian Jackson 11c61a3d7f bridge descriptors: Change types of the descriptor cache
Now keyed by Arc<BridgeConfig>, and the values can be errors.

Currently there is no implementation so there can't be any errors,
but the error enum will become nonempty.
2022-10-20 13:28:23 +01:00
Nick Mathewson 05913f9720 transport: Escape = signs in keys only.
This is a compromise between C tor (never escapes = signs) and the
spec (calls for escaping all = signs).  In C tor there is no way to
actually construct a key with an = sign in it, so this difference
should be undetectable.
2022-10-20 08:11:05 -04:00
Nick Mathewson 40b9b57884 Clarify comment on ExternalProxyPlugin. 2022-10-20 08:11:05 -04:00
Nick Mathewson 27f53f241d transport: rename "ExtraneousData" to "UnexpectedData" 2022-10-20 08:11:05 -04:00
Nick Mathewson f39157f8c3 chanmgr: Add the code necessary to use SOCKS PTs via a TransportHelper
This is mostly a matter of encoding parameters in the format used
for socks authentication.
2022-10-20 08:11:00 -04:00
Nick Mathewson 50b65b217d chanmgr: Begin a socks-client implementation.
This code is _not_ conditional, since we want to support running
with a proxy even if we don't support pluggable transports.

We may eventually want to refactor this into a new create.
2022-10-20 08:09:18 -04:00
Nick Mathewson dcf27f2457 socksproto: Make a method conditional. 2022-10-20 08:09:18 -04:00
Nick Mathewson d1e70d9479 socksproto: impl Clone for Error. 2022-10-20 08:09:18 -04:00
Ian Jackson a5eba71edd HasAddrs: Make it clear that the set of addresses can be empty
Eg, a PT bridge may not have an address.
2022-10-20 12:47:50 +01:00
Jim Newsome 8600ba7325 integration-shadow: "shadow-small" tag -> "tpa"
The "shadow-small" tag no longer exists, and all "tpa" x86-64 runners can now run Shadow.         https://gitlab.torproject.org/tpo/tpa/team/-/issues/40833#note_2835576
2022-10-19 19:18:40 +00:00
Nick Mathewson 1cc27a39e2 Merge branch 'update-shadow-stop-time' into 'main'
shadow ci: Set stop time to 30m instead of 27m

See merge request tpo/core/arti!772
2022-10-19 13:50:38 +00:00
Nick Mathewson 0c2cdd3fe7 Merge branch 'guard_spelling' into 'main'
fix a couple of spelling errors in guardmgr

See merge request tpo/core/arti!778
2022-10-19 12:17:25 +00:00
Nick Mathewson 2845ee24bf fix a couple of spelling errors in guardmgr 2022-10-19 07:49:39 -04:00
Nick Mathewson bba1532bd3 Merge branch 'spelling_20221008' into 'main'
Several spelling fixes.

See merge request tpo/core/arti!777
2022-10-18 20:16:49 +00:00
Nick Mathewson 5786637b4f Fix various typos (using typos tool and hand-inspection) 2022-10-18 15:39:33 -04:00
Nick Mathewson 3975d0db7e linkspec: Fix typo in error messages. 2022-10-18 15:01:54 -04:00
Nick Mathewson 2e08775395 Merge branch 'channel_map' into 'main'
ChanMgr: Revise code to tolerate multiple identities

See merge request tpo/core/arti!773
2022-10-18 16:21:25 +00:00
Nick Mathewson 06132d9f35 chanmgr: Add an error case if a final_attempt neither succeeds or fails
This can happen in weird corner cases, so it's probably best to
report it rather than having an "internal error."
2022-10-18 11:49:21 -04:00
Nick Mathewson 4b0c28014d Refactor flow control in get_or_launch.
Now, instead of duplicate checks in various cases, we simply go
through the loop one last time.

This allows us to simplify some of our other logic around here.
2022-10-18 11:49:21 -04:00