aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-chanmgr: Expand docs for map::Inner dormancy fieldIan Jackson2022-08-171-0/+4
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826093
* chanmgr padding_parameters: Use OptionIan Jackson2022-08-172-40/+41
| | | | | | | | | The network consensus parameters use (0,0) to mean "no padding" (which is not the same as (0,0) means in a PADDING_NEGOTIATE cell). Representing "no padding" this way is actually quite convoluted and un-Rustic. Ensure that we convert (0,0) to None, and do the primary logic in Option.
* chanmgr: padding: Split IEFI into named functionIan Jackson2022-08-171-19/+27
| | | | | | | Roughly as suggested in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826160 IMO this is less clear, because of the way it splits the logic up.
* chanmgr: NetParamsExtract: extend docs for nf_itoIan Jackson2022-08-171-2/+2
|
* chanmgr: Get rid of final Result relating to netdir/netparamsIan Jackson2022-08-172-32/+29
| | | | No functional change. (The error tyep was Void.)
* chanmgr: Use NetDirProvider::params and Arc<dyn..Netparameters>Ian Jackson2022-08-174-85/+92
| | | | | | | | | This gets rid of many Result(). Many parameters are renamed. Test cases of the now-impossible branch are removed. Deleting the match from padding_parameters will come in a moment. I've split off that commit since it has much whitespace noise. for now, change the error type to Void.
* chanmgr: Add a TODO for renaming NetDirExtractIan Jackson2022-08-171-0/+3
|
* chanmgr set_dormancy: Remove obsolete commentIan Jackson2022-08-171-4/+0
|
* chanmgr: Extend doc comments for DormancyIan Jackson2022-08-171-0/+6
| | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2825962
* Fix typos in comments.eta2022-08-171-1/+1
|
* channel padding: Rename low_ms and high_msIan Jackson2022-08-172-9/+9
| | | | | These have the unit in the type. Putting that in the field name too is otiose.
* channel padding: Test through most of the layersIan Jackson2022-08-173-0/+366
|
* chanmgr testing: FakeChannel: retain the ChannelsParamsUpdatesIan Jackson2022-08-161-1/+4
|
* channel padding: Send negotiation cellsIan Jackson2022-08-162-5/+51
|
* channel padding: Send padding iff requiredIan Jackson2022-08-161-11/+13
| | | | | | | | | | Now all the information is plumbed to the right place, and we can actually decide if we're sending padding. Additionally, we conditionalise sending timing parameters on whether padding is actually enabled, so in dormant mode we do not generate updates (broadcast to all channels) just to reconfigure unused timing parameters.
* chanmgr configuration: Avoid sending needless initial update(s)Ian Jackson2022-08-161-2/+5
| | | | | | | | | | | Change ChannelsParams::initial_update to compare fields with their default values, and, if they're the same as the default, not to include them in the returned update. And if that update is then empty, return None. The overall effect is to avoid the call to chan.reparameterize if we're using the builtin default parameters, which is usual.
* chanmgr configuration: Initialise correctlyIan Jackson2022-08-161-2/+7
| | | | | | This arranges that the ChannelsParams we have retain, and which we send to every newly created channel, actually has the right parameters, even if they're not the default.
* chanmgr configuration: Break out parameterizeIan Jackson2022-08-161-8/+40
| | | | | | | We're going to want to call this at startup as well as during reconfigurations. Code motion.
* chanmgr configuration: Hadle lack of a NetDirIan Jackson2022-08-163-18/+11
| | | | | | Now that the code that actually handles the netdir information can cope with its lack, we can change the types of the various netdir parameters and get rid of the foolish Bugs.
* chanmgr padding: Support reduced and disabled padding (prep)Ian Jackson2022-08-161-3/+9
| | | | | | | | | | Now we actually honour the configuration variable. However, when it is set to None, we lack proper handling. This will be done bh turning None into 0,0 and then treating that as disabled. There is a TODO for that. Note that we *still* don't actually do or negotiate padding.
* chanmgr padding: Fix low vs high comparisonIan Jackson2022-08-161-3/+2
| | | | | Whoops. This bug was completely masked by the fact that we don't actually enable padding yet.
* chanmgr: Break out padding_parameters fnIan Jackson2022-08-161-33/+48
| | | | | | | | | | | | | | | | | | Move some logic out of reconfigure_general into what was update_padding_parameters_from_netdir, and rename that function. We're going to want to call this twice, shortly... * Move out the PaddingParametersBuilder * Have it handle missing netdir, though we currently always pass Ok * Have it handle the error cases It still ignores the config for now. No overall functional change. "git show -b" may be a useful way to review the changes in what becomes "padding_parameters".
* chanmgr: Postpone padding parameters computationIan Jackson2022-08-161-12/+12
| | | | | | | | Now that we make an extract from the incoming NetDir, we can move the padding parameters computation to after we take the lock. This will be necessary for it to be able to depend on the config and dormancy, records of which are protected by the chanmgr lock.
* chanmgr: Introduce NetDirExtractIan Jackson2022-08-161-16/+52
| | | | | This will allow the padding parameter computation to have access to the config, which is within the inner lock.
* chanmgr, testing: Provide config accessor for testingIan Jackson2022-08-162-0/+9
| | | | | The top-level global config is going to want to see whether its machinations have the right effect.
* channel: Introduce padding configIan Jackson2022-08-161-6/+6
| | | | | Nothing actually reads this yet, and we also want a client-global default for padding.
* Introduce ChannelConfigIan Jackson2022-08-165-11/+99
| | | | | This commit is just the necessary plumbing. The config is currently empty. We'll add something to it, for padding control, later.
* Provide ChannelUsage and plumb it all the way downIan Jackson2022-08-164-15/+38
| | | | | | | | | | | | | Channel padding depends on what the channel is being used for. We therefore need to let the channel code know this information. The implementation of the per-channel padding control logic will be in the new note_usage function, which for now is simply a stub. A future commit will introduce a `PaddingControlState` which lives in the channel frontend; consult the doc comment for that type to see why the plumbing through the channel manager terminates in the channel frontend.
* chanmgr: Introduce get_or_launch_internalIan Jackson2022-08-161-0/+10
| | | | This is going to be useful in a moment.
* channel reparameterize: Change error typeIan Jackson2022-08-163-10/+6
| | | | This is going to be able to fail in other ways too, sadly.
* dormancy: Plumb through to chanmgr reconfigure_generalIan Jackson2022-08-163-14/+63
| | | | | | | | | | | | | | | The chanmgr remembers the last dormancy state it was told. We invent a chanmgr-specific Dormancy which the arti-client code knows how to convert from the richer top-level dormant status. This avoids having to have everyone know all the variants of the top-level state. To call reconfigure_general, we must also obtain and plumb through a netdir. Right now we must return an internal error if there is in fact no netdir, because reconfigure_general does not yet cope with a missing netdir. Nothing actually *uses* the dormancy yet.
* chanmgr: reconfigure_general: Rename fn and change typesIan Jackson2022-08-163-6/+35
| | | | | | | | | | | | | | | This function is going to become the code for controlling channels, in general. (Including padding control.) Right now it doesn't do most of the things. In this commit: * Change the prototype and the name now. * Pass `()` for the dormancy and config, adding TODOs. * Provide update_netdir method on AbstractChanMgr, and call that, rather than having the ChanMgr go directly into the channel. (That will enable us to test that `update_netdir` method with test cases that don't have a complete ChanMgr.)
* channel params: Rename initial_update (from total_update)Ian Jackson2022-08-161-1/+1
| | | | The semantics of this are going to become a bit more subtle.
* chanmgr: tests: Introduce new_test_channel_mapIan Jackson2022-08-161-6/+11
| | | | This is going to change. Centralise it first.
* chanmgr: tests: Introsuce new_test_abstract_chanmgrIan Jackson2022-08-161-8/+9
| | | | This is going to change. Centralise it first.
* Final (?) API revisions for tor-linkspecNick Mathewson2022-08-103-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, each individual identity type becomes optional. The functions that expose them unconditionally are now in a "legacy" trait that only some downstream types are expected to implement. There are new convenience APIs in HasRelayIds: * to return Option<&keytype>, * to see if one identity-set contains another. This commit will break several downstream crates! For the reviewer's convenience, I will put the fixes for those crates into a series of squash! commits on this one. tor-netdir ---------- Revise tor-netdir to accept optional identities. This required some caveats and workarounds about the cases where we have to deal with a key type that the tor-netdir code does not currently recognize at all. If we start to add more identity types in the future, we may well want more internal indices in this code. tor-proto --------- In order to make tor-proto support optional identities, there were fewer changes than I thought. Some "check" functions needed to start looking at "all the ids we want" rather than at "the two known IDs"; they also needed to accommodate that case where we don't have an ID that we demand. This change will also help with bridges, since we want to be able to connect to a bridge without knowing all of its IDs up front. The protocol currently _requires_ the two current ID types in some places. To deal with that, I added a new `MissingId` error. I also removed a couple of unconditional identity accessors for chanmgr; code should use `target().identity(...)` instead. tor-chanmgr ----------- This is an incomplete conversion: it does not at all handle channel targets without Ed25519 identities yet. It still uses those identities to index its internal map from identity to channel; but it gives a new `MissingId` error type if it's given a channel target that doesn't have one. We'll want to revise the map type again down the road when we implement bridges, but I'd rather not step on the channel-padding work in progress right now. tor-guardmgr ------------ This change is mostly a matter of constructing owned identity types more sensibly, rather than unwrapping them directly. There are some places marked with TODOs where we still depend on particular identity types, because of how the directory protocol works. This will need revisiting when we add bridge support here. tor-circmgr ----------- These changes are just relatively simple API changes in the tests.
* tor-linkspec: Refactor out traits to represent a relay's ID set.Nick Mathewson2022-08-021-1/+1
| | | | | | | | | | | | | | We want the set of identities supported by a relay to be extensible in the future with minimal fuss; we'd also like to make working with these ID sets more convenient. To handle that, this commit adds a new trait for "Something that has the same IDs as a relay" and a new object for "an owned representation of a relay's IDs." This commit introduces a similar trait for "Something with a list of SocketAddr, like a relay has." There's no owned equivelent for that, since Vec<SocketAddr> is already a thing. Closes #428.
* Now that versions have bumped, remove semver.md files.Nick Mathewson2022-08-011-1/+0
|
* Bump patch versions on crates that have new APIs.Nick Mathewson2022-08-011-2/+2
| | | | | | | | | | | | | | Do _not_ bump the dependency versions on crates that have had no changes since arti 0.0.5, since those crates do not depend on the new APIs. ``` cargo set-version -p tor-basic-utils --bump patch cargo set-version -p tor-llcrypto --bump patch git restore crates/tor-checkable git restore crates/tor-consdiff git restore crates/tor-rtmock ```
* Bump minor version on crates with deps with breaking changes.Nick Mathewson2022-08-011-1/+1
| | | | | | | | | | | | | | | This performs the transitive closure of the last operation: everything that depends on a crate with a breaking change gets the version which it depends on bumped. ``` cargo set-version -p tor-proto --bump minor cargo set-version -p tor-netdoc --bump minor cargo set-version -p arti-hyper --bump minor cargo set-version -p arti-bench --bump minor cargo set-version -p arti-testing --bump minor cargo set-version -p tor-config --bump minor ```
* Bump minor versions on all crates that have had breaking changes.Nick Mathewson2022-08-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | Done with these commands: ``` cargo set-version -p fs-mistrust --bump minor cargo set-version -p tor-bytes --bump minor cargo set-version -p tor-socksproto --bump minor cargo set-version -p tor-cert --bump minor cargo set-version -p tor-linkspec --bump minor cargo set-version -p tor-cell --bump minor cargo set-version -p tor-netdir --bump minor cargo set-version -p tor-persist --bump minor cargo set-version -p tor-chanmgr --bump minor cargo set-version -p tor-guardmgr --bump minor cargo set-version -p tor-circmgr --bump minor cargo set-version -p tor-dirclient --bump minor cargo set-version -p tor-dirmgr --bump minor cargo set-version -p arti-client --bump minor cargo set-version -p arti --bump minor ```
* ChanMgr: Only update parameters from a timely directory.Nick Mathewson2022-07-261-2/+2
|
* 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-064-25/+41
| | | | | | 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.
* Bump crate and dependency versions.Nick Mathewson2022-06-241-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were done with the following commands: ``` cargo set-version -p tor-basic-utils --bump patch cargo set-version -p fs-mistrust --bump minor cargo set-version -p tor-error --bump patch cargo set-version -p tor-config --bump patch cargo set-version -p tor-units --bump patch cargo set-version -p tor-rtcompat --bump minor cargo set-version -p tor-llcrypto --bump patch cargo set-version -p tor-bytes --bump minor cargo set-version -p tor-socksproto --bump minor cargo set-version -p tor-cert --bump minor cargo set-version -p tor-cell --bump minor cargo set-version -p tor-proto --bump minor cargo set-version -p tor-netdoc --bump patch cargo set-version -p tor-netdir --bump minor cargo set-version -p tor-persist --bump patch cargo set-version -p tor-chanmgr --bump minor cargo set-version -p tor-guardmgr --bump minor cargo set-version -p tor-circmgr --bump patch cargo set-version -p tor-dirclient --bump patch cargo set-version -p tor-dirmgr --bump minor cargo set-version -p arti-client --bump patch cargo set-version -p arti --bump minor cargo set-version -p arti-bench --bump minor cargo set-version -p arti-testing --bump minor ```
* clippy: Consolidate many lints in maint/add_warningIan Jackson2022-06-241-0/+3
| | | | | | Found these by disabling the nightly dbg macro special case. Now, we have a mechanism for globally adding suppressions to tests, we can use that instead.
* maint/add_warning: Add two lints via add_warning as a test caseIan Jackson2022-06-241-0/+2
|
* maint/add_warning: Add ability maintain test lint blocksIan Jackson2022-06-241-0/+3
|
* Run maint/add_warning crates/*/src/{lib,main}.rsIan Jackson2022-06-231-0/+3
| | | | Update all lint blocks
* Merge branch 'display_source_cleanup' into 'main'eta2022-06-211-2/+2
|\ | | | | | | | | Do not include error source() in display() format. See merge request tpo/core/arti!598