aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/congestion/params.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-proto: change some instances of `sendme_inc` to u8Steven Engler2026-08-121-6/+4
|
* hsclient: Support protocol negotiation for CGO and flowctrl-ccNick Mathewson2026-07-021-0/+6
|
* proto: Add a test helper function for building a CircNetParametersDavid Goulet2026-04-141-0/+55
| | | | | | | | | We can't access `NetParameters` in this crate to build from consensus default value so instead add a `defaults_for_tests()` gated function for each parameters object which puts in the defaults from the spec. We'll need CircNetParameters in order to build create request handler for unit tests hence why it is in src/circuit.rs.
* tor-proto: derive `strum::EnumDiscriminants` for `Algorithm`Steven Engler2026-04-081-1/+4
|
* proto: Pass owned CongestionWindowParams to CongestionControl::new.Gabriela Moldovan2025-09-041-0/+1
| | | | | | | We no longer need to clone `CongestionWindowParams` now that it implements `Copy`. Resolves a clippy warning.
* proto: Derive Copy for CongestionWindowParams.Gabriela Moldovan2025-09-041-1/+1
| | | | | These will likely always just be a collection of integers (lightweight to copy).
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-1/+1
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* Rename and invert the sense of requires_stream_level_sendmes.Nick Mathewson2025-07-231-4/+8
| | | | | Instead call it compatible_with_cgo, which is what we actually care about in this context.
* proto: Send extensions as appropriate to negotiate CGO.Nick Mathewson2025-07-231-0/+11
| | | | Let's see if it works!
* tor-proto: Remove no-longer needed clone()s.Gabriela Moldovan2025-06-111-1/+1
| | | | | | This doesn't really change anything, but removing the `.clone()` makes it a bit more obvious that copying the `*Params` is a lightweight operation.
* tor-proto: Derive Copy for FixedWindowParams.Gabriela Moldovan2025-06-111-1/+1
|
* tor-proto: Derive Copy for VegasParams.Gabriela Moldovan2025-06-111-2/+2
|
* proto: Refactor cc fallback.Nick Mathewson2025-06-101-4/+4
| | | | | The fallback CC algorithm is _always_ fixed-window, and we should only use it when the selected CC algorithm is not supported.
* Move responsibility for choosing extensions into tor-protoNick Mathewson2025-06-101-1/+1
| | | | | | | | | Now tor-circmgr no longer needs to check which Protover capabilities are enabled, or construct a separate CircParameters for each hop. Instead, tor-proto decides whether to use the fallback CC mode, based on whether the target supports FLOWCTRL_CC. Closes #1967.
* proto: Split CircParameters and NegotiatedHopSettingsNick Mathewson2025-06-101-8/+5
| | | | | | | | | | | One type will now represent _the kind of hop we are asking tor-proto to negotiate_; the other will represent _the state of such negotiation_. This doesn't simplify the code much yet, but it will be helpful as we add more and more negotiable settings. Part of #1967
* tor-proto: expand docs for `CongestionWindowParams::set_sendme_inc`Steven Engler2025-04-231-1/+5
|
* tests: Add CC ntorv3 negotiation unit testDavid Goulet2025-04-231-0/+23
| | | | | | | | Also add one for the sendme_inc validity function. Part of #1817 Signed-off-by: David Goulet <[email protected]>
* circ: Apply possible subprotocol changes to circ paramsDavid Goulet2025-04-231-1/+5
| | | | | | | | | | | | | Congestion control can change the circuit parameters if the relay we are negotiating with doesn't support FlowCtrl=2. This commit adds a function in the circuit builder that will apply any changes to the circuit parameters of the hop based on the hop protocol values. For now, only congestion control applies. Part of #1817 Signed-off-by: David Goulet <[email protected]>
* congestion: Setup a fallback algorithm in the paramsDavid Goulet2025-04-231-0/+7
| | | | | | | | | | | | | | | | CircParameters is built before path selection and thus once we start building the hops, we can't access the consensus values that were used to build it in the first place. For congestion control, we require a fallback algorithm in case the hop doesn't support FlowCtrl=2. This commit adds a "fallback_alg" to the CC parameters which will be used for this exact case. Part of #1817 Signed-off-by: David Goulet <[email protected]>
* circ: Set the negotiated CC sendme_inc from handshakeDavid Goulet2025-04-231-0/+38
| | | | | | | | | | | When receiving the congestion control response extension, evaluate our state and set the sendme_inc if valid in our circuit parameters. For this, a series of helper functions is needed. Part of #1817 Signed-off-by: David Goulet <[email protected]>
* fix: fix typosDimitris Apostolou2025-01-301-1/+1
|
* congestion: Use getters for all parametersDavid Goulet2025-01-161-33/+52
| | | | | | Allows us to remove the pub. Signed-off-by: David Goulet <[email protected]>
* congestion: Remove Default from every parametersDavid Goulet2025-01-161-24/+4
| | | | | | | Important to enforce that every field is explicitely set so we avoid forgetting fields. Signed-off-by: David Goulet <[email protected]>
* congestion: Make the cc_alg values a caret_int for better code semanticDavid Goulet2025-01-161-0/+14
| | | | Signed-off-by: David Goulet <[email protected]>
* congestion: Remove FixedWindow start window default valueDavid Goulet2025-01-161-11/+2
| | | | | | | | In unit tests, we set a 1000 by default but else, we don't set a default so our implementation doesn't forget to set the right value from the consensus. Signed-off-by: David Goulet <[email protected]>
* proto: Add Vegas congestion control algorithmDavid Goulet2025-01-161-0/+60
| | | | | | | | | | | The big one! This is the Vegas algorithm implementation that is hooked to the CongestionControl object by implementing the algorithm trait. Still, at this commit, nothing is being used by the circuit reactor yet. Related #534 Signed-off-by: David Goulet <[email protected]>
* proto: New CongestionControl object and fixed window algorithmDavid Goulet2025-01-161-0/+50
| | | | | | | | | | | | | | | | | | | | | | | Add the top level CongestionControl object that will allow the circuit reactor to use it in order to decide if a cell can be sent or not. In order to be used, it is configured with an algorithm that implements the CongestionControlAlgorithm trait. The Fixed Window algorithm is also added which essentially implements the SENDME logic as arti knows it today with a fixed window size. The SENDME code has been refactor in two different logical steps in order to accomodate the future Vegas algorithm for which the congestion window logic and SENDME validity is seperated. There is now a SENDME validator that takes care of tracking the tags (authenticated SENDMEs) and validating them upon reception. Then, if valid, the window management is passed down the congestion control algorithm, at this commit, FixedWindow object. Related #534 Signed-off-by: David Goulet <[email protected]>
* proto: Add generic objects for congestion controlDavid Goulet2025-01-161-0/+68
This commit adds the congestion window object, a round trip estimator (RTT) and a state enum. These 3 entities are used by congestion control in a generic way that is they are passed and used by any algorithm. At this commit, they are not used hence the allow deadcode attribute for now in order to minimize the build warnings. We also introduce the params.rs file containing the parameters, taken from consensus, used to configure these objects. They will be exposed to the tor-cirmgr crate to build the CircParameters. More will come. This also introduces the congestion/ directory that will contain more code in future commits. Related #534 Signed-off-by: David Goulet <[email protected]>