summaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr/src/builder.rs
Commit message (Collapse)AuthorAgeFilesLines
* ChanMgr: errors: attribute errors to correct address.Nick Mathewson2022-07-061-3/+7
| | | | | | Even when keys are relevant, we still don't want to attribute errors to a set of addresses when we have a single address that we're connected with.
* ChanMgr: Add more contextual info to error types.Nick Mathewson2022-07-061-8/+16
| | | | | | Now each type has a peer. In some cases this peer is just an address, whereas in others (where key is relevant or address isn't yet narrowed down) it's a full OwnedChanTarget.
* channel padding: Rename ChannelsParams from ChannelsConfigIan Jackson2022-06-211-3/+3
| | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2814276 Change names and comments and docs everywhere.
* channel padding: Plumb settings from chanmgrIan Jackson2022-06-211-0/+5
|
* Plumb a SleepProvider into the channel reactorIan Jackson2022-06-081-1/+4
| | | | | The channel reactor is going to want to be able to sleep so that it can do padding, so it needs a SleepProvider.
* chanmgr: expose whether we are failing because of expired certs.Nick Mathewson2022-04-121-0/+4
|
* chanmgr: bubble ClockSkew up through the Error object.Nick Mathewson2022-04-071-3/+15
| | | | | | | | Fortunately, we don't need a separate type here: authenticated clock skew can only come attached to a `tor_proto::Error`. We also remove skew from `tor_proto::Error::HandshakeCertsExpired`, since it would now be redundant.
* chanmgr: add a test for AbstractChannel::duration_unusedNick Mathewson2022-04-021-1/+9
|
* chanmgr: add tests for connect_one.Nick Mathewson2022-04-021-2/+84
|
* tor-proto: add a backend to detect reported clock skew.Nick Mathewson2022-03-231-1/+4
| | | | | | | | | | | | | | | | NETINFO cells, which are sent in every handshake, may contain timestamps. This patch adds an accessor for the timestamp in the Netinfo messages, and teaches the tor-proto code how to compute the minimum clock skew in the code. The computation isn't terribly precise, but it doesn't need to be: Tor should work fine if your clock is accurate to within a few hours. This patch also notes a Y2038 problem in the protocol: see torspec#80. Part of #405.
* Implement a basic form of RFC 8305 ("happy eyeballs") for channelseta2022-03-071-21/+75
| | | | | | | | | | | | This makes Arti usable in IPv6-only environments (arti#92) by letting us attempt multiple connections to a given relay using all of its addresses instead of just using the first (probably IPv4) one, using the strategy from RFC 8305 ยง 5. This isn't a complete implementation of Happy Eyeballs; ideally, we'd sort the address list before doing concurrent connections. However, it works (and has been tested inside an IPv6-only container inside eta's network :p)
* tor-chanmgr: use Bug types.Nick Mathewson2022-02-161-5/+5
|
* Merge branch 'error-improvements' into 'main'eta2022-02-081-3/+5
|\ | | | | | | | | Hopefully uncontroversial improvements to new Error code See merge request tpo/core/arti!291
| * Make SpawnError wrappers contain a 'spawning' stringNick Mathewson2022-02-041-3/+5
| | | | | | | | | | (By our convention, these errors should say what we were trying to spawn when the error occurred.)
* | Expire channels that have been unused for too longYuan Lyu2022-02-041-0/+4
|/
* channel errors: Include what we were doingIan Jackson2022-02-041-6/+13
|
* tor-chanmgr: Handle IO errora in the new styleIan Jackson2022-02-041-5/+15
| | | | | Two ? in the tests become expects, which will do. That avoids having to construct a proper error with context here.
* tor-chanmgr: Add bootstrap/status reporting.Nick Mathewson2022-01-181-3/+37
| | | | | | | | | | | | | | | | | | The information is pretty basic here: we use "have we been able to connect/TLS-handshake/Tor-handshake" as a proxy for "are we on the internet? Are we on a reasonably unfiltered part of the internet?" Eventually we'll want to make the information gathered and exported more detailed: I've noted a few places in the code. For now, however, this is about as good as C Tor does today, and it should be a good starting point. This uses a slightly different design from tor-dirmgr. Instead of exporting an entire state structure via `postage::watch`, it exports only the parts of that structure which the user is supposed to read. I think that's more reasonable in this case because most of the possible internal transitions in the tor-chanmgr state don't cause a change in the exposed status.
* chanmgr: get rid of Arc around ChannelIan Jackson2022-01-131-5/+2
|
* tor-chanmgr: Fix happy eyeballs comment grammar in builder.rsNeel Chauhan2021-12-141-3/+3
|
* Make TlsConnector wrap TCP connections, not create its owneta2021-12-071-2/+5
| | | | | | | | | | | | | | | | | | | | `tor-rtcompat`'s `TlsConnector` trait previously included a method to create a TLS-over-TCP connection, which implied creating a TCP stream inside that method. This commit changes that, and makes the function wrap a TCP stream, as returned from the runtime's `TcpProvider` trait implementation, instead. This means you can actually override `TcpProvider` and have it apply to *all* connections Arti makes, which is useful for issues like arti#235 and other cases where you want to have a custom TCP stream implementation. This required updating the mock TCP/TLS types in `tor-rtmock` slightly; due to the change in API, we now store whether a `LocalStream` should actually be a TLS stream inside the stream itself, and check this property on reads/writes in order to detect misuse. The fake TLS wrapper checks this property and removes it in order to "wrap" the stream, making reads and writes work again.
* Get rid of tor-proto's ChannelImpl, and use the reactor more insteadeta2021-11-031-1/+3
| | | | | | | | | | | | | | | | | | | Instead of awkwardly sharing the internals of a `tor-proto` `Channel` between the reactor task and any other tasks, move most of the internals into the reactor and have other tasks communicate with the reactor via message-passing to allocate circuits and send cells. This makes a lot of things simple, and has convenient properties like not needing to wrap the `Channel` in an `Arc` (though some places in the code still do this for now). A lot of test code required tweaking in order to deal with the refactor; in fact, fixing the tests probably took longer than writing the mainline code (!). Importantly, we now use `tokio`'s `tokio::test` annotation instead of `async_test`, so that we can run things in the background (which is required to have reactors running for the circuit tests). This is an instance of #205, and also kind of #217.
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-0/+1
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+190
This will cause some pain for now, but now is really the best time to do this kind of thing.