Commit Graph

4689 Commits

Author SHA1 Message Date
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
Nick Mathewson e0bd6111a8 chanmgr: Split get_or_launch into sub-functions.
This function had grown huge and hard to reason about.  Before I
make it even worse, let's split it up.
2022-10-18 11:49:21 -04:00
Nick Mathewson 710be8d4c6 chanmgr: Refactor choose_action code into its own function. 2022-10-18 11:49:21 -04:00
Nick Mathewson 8f4ff7014a Clarify a comment about the desired structure of ChanMgr 2022-10-18 11:49:21 -04:00
Nick Mathewson c0bca7213c Comments to explain effects of return in closure. 2022-10-18 11:49:21 -04:00
Nick Mathewson c802d39b80 chanmgr: Remove "Ident" from AbstractChannel
Thanks to our previous changes, we no longer need this type, or the
methods that access it.
2022-10-18 11:49:21 -04:00
Nick Mathewson c78bacce86 chanmgr: replace the HashMap<> with a ByRelayIds.
This is necessary so that we can look up channels (open and pending)
by all of the Ids that we know about them.

The operations needed here are pretty complex: to get them right,
I've replaced most of the accessors on the inner `ChannelMap` with a
function that holds the lock while another `FnOnce` is called.  This
still gets us the invariant that we can't accidentally await while
holding the lock on the `ChannelMap`.

I've removed the tests for the accessors that are no longer there.

There are some subtleties here.  Now that we have more than one kind
of Id, it's possible to have a partial match.  I've tried to explain
all these cases in the comments.
}
2022-10-18 11:49:21 -04:00
Nick Mathewson 61a33da0ff proto: Make Channel::reparameterize take &self.
Even though channels are practically changeable, they use locks
internally so that you don't need a `&mut Channel` to send or
receive traffic.  It makes sense for reparameterizing the channel to
also use a &self reference.

I'll need this so that I can store channels in an `ByRelayIds<>`
set, and still invoke their reparameterize methods.
2022-10-18 11:49:21 -04:00
Nick Mathewson 735100455d chanmgr: Add identities to pending state in map.
This will let us migrate from `HashMap<Ed25519Identity, Entry>` to
`ByRelayIds<Entry>`.
2022-10-18 11:49:21 -04:00
Nick Mathewson e51fdbfb1b chanmgr: Require HasRelayIds for AbstractChannel::BuildSpec
This is mostly a testing only change for now too, but soon I'll use
it to deal with the fact that we need to know the IDs to actually
build a channel at all.
2022-10-18 11:49:21 -04:00
Nick Mathewson 71db8ebc2e chanmgr: Require HasRelayIds for AbstractChannel.
This is mostly a testing-only change for now, but soon I'll use it
so we can have IdMap for our channel map.
2022-10-18 11:49:21 -04:00
Nick Mathewson e94cff26e2 chanmgr: Remove the Poisoned state from the map type.
The `ByRelayIds` type doesn't have a type equivalent to
`hash_map::Entry`, since it's a set type rather than a map
type. Therefore, the only plausible way to do entry mutation will
be to remove the old entry and insert a new one.  And so, we no
longer need a "poisoned" state.
2022-10-18 11:49:21 -04:00
Nick Mathewson 96493f427d proto: Implement HasRelayIds for Channel. 2022-10-18 11:49:21 -04:00
Nick Mathewson a46e8af605 linkspec: Add ByRelayIds::remove_exact.
We need a function to remove an entry if it appears with _exactly_
the same relay Ids, but not otherwise.  This method will do that.
2022-10-18 11:49:21 -04:00
Nick Mathewson 0c8a5a1fa4 linkspec: Add an "all_overlapping" accessor to ByRelayIds.
Also, add a few tests for this and the other accessors.

We'll need this accessor to find whether we have any channels to
_any_ of the identities that we're trying to connect to.
2022-10-18 11:49:21 -04:00
trinity-1686a d08195e09c move test to dedicated job 2022-10-17 17:56:51 +02:00
eta 1a1a1af5d8 Merge branch 'id_tests' into 'main'
Add a few tests for RelayId and friends

Closes #605

See merge request tpo/core/arti!774
2022-10-17 14:00:24 +00:00
trinity-1686a 3200870079 fix doc-feature synchro 2022-10-16 21:02:10 +02:00
trinity-1686a 53016a005b add test for many features
and fix issue compiling tor-rtcompat with on ssl runtime
2022-10-16 21:02:10 +02:00
Nick Mathewson 522907ac9a Write more tests for RelayId and RelayIdRef. 2022-10-15 10:38:08 -04:00
Nick Mathewson 8e2ce9de1d Write tests for RelayIdSet. 2022-10-15 10:06:02 -04:00
Nick Mathewson ae07909a02 Fix deserialize impl for RelayId.
We need to handle String, not just str, since some deserializers
have to handle escapes and generate new strings.

Found while writing tests; fixes #605.
2022-10-15 10:04:37 -04:00
Nick Mathewson ddc5b63a19 linkspec: impl Hash for RelayIdRef 2022-10-15 09:57:45 -04:00
Jim Newsome cc8ced13ea shadow ci: Set stop time to 30m instead of 27m
This was a temporary stop-gap to work around a busy loop that seemed to
happen before. I am no longer able to reproduce any such problem.
2022-10-14 16:48:24 -05:00
Nick Mathewson dbf4765832 Merge branch 'reorganize_factory_code' into 'main'
ChanMgr: Reorganize factory, builder, transport code.

See merge request tpo/core/arti!771
2022-10-13 14:52:31 +00:00
Nick Mathewson 31528202c5 chanmgr: Edit comments, fix docs 2022-10-13 10:32:02 -04:00
Nick Mathewson 913d5b68ec chanmgr: Remove RegistryAsFactory.
Since there is no longer a blanket implementation of ChannelFactory
for TransportHelper, we no longer need a separate type here.
2022-10-13 10:15:05 -04:00
Nick Mathewson fe2d44d10a ChanMgr: Reorganize factory, builder, transport code.
There is no actual code change here: just movement.
2022-10-13 10:09:52 -04:00
Nick Mathewson a77312a6ec Merge branch 'rustdoc_fixes_20221013' into 'main'
Fix some rustdoc errors.

See merge request tpo/core/arti!770
2022-10-13 13:31:57 +00:00
Nick Mathewson 8f267ba166 Fix some rustdoc errors.
In addition to the usual "You named that method wrong!" errors, we
have a new rustdoc error that complains about bogus "HTML tags" that
are actually unquoted usage of types like `Result<Foo>`.
2022-10-13 09:08:46 -04:00
Nick Mathewson 85284ef847 Merge branch 'factory_redux' into 'main'
chanmgr: Build and use chanmgr factory APIs

See merge request tpo/core/arti!769
2022-10-13 12:58:28 +00:00
Nick Mathewson 7b58126706 Flatten TimeoutChannelFactory into ChannelBuilder. 2022-10-13 08:36:05 -04:00
Nick Mathewson 69b64a2795 chanmgr: clean up some TODO pt-client items and documentation. 2022-10-13 08:36:05 -04:00