summaryrefslogtreecommitdiff
path: root/crates/tor-netdir/src/params.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-netdir: Resolve an XXXX about type uglinessNick Mathewson2021-12-081-1/+1
| | | | | | | | | | | | | | | We had no function to infallibly convert BoundedInt32<{0 or 1},H> into a u32, even though we could have. Because of that, we were treating weight_scale as an i32 when logically it's a u32 or a NonZeroU32. Moreover, it turns out we were using an incorrect minimum for the bwweightscale param, which would in theory have allowed the authorities to make us divide by zero. This patch introduces the necessary From<> implementation and uses it. It corrects the binimum bwweightscale, and prevents a division-by-zero issue in case weight_scale is zero.
* Remove a couple of spec-related XXXXs in tor-netdir.Nick Mathewson2021-12-081-2/+0
| | | | | I've opened torspec!54 to fill in the missing parts of the spec about these issues.
* add semicolons if nothing returnedDaniel Eades2021-11-251-1/+1
|
* More typo fixes that I forgot to save :(Nick Mathewson2021-11-241-2/+2
|
* Allow type of timeout estimator to change at runtime.Nick Mathewson2021-10-201-0/+9
| | | | | | This is a big change, but it does simplify the type of Builder a little, and isolates locking across different (potential) timeout estimator types.
* Initial backend implementation for guard node manager.Nick Mathewson2021-10-071-4/+14
| | | | | | | There are some missing parts here (like persistence and tests) and some incorrect parts (I am 90% sure that the "exploratory circuit" flag is bogus). Also it is not integrated with the circuit manager code.
* Typo fix in comment.Nick Mathewson2021-09-291-1/+1
|
* Suppress a cognitive-complexity lint in testsNick Mathewson2021-09-091-0/+1
|
* Add guard-related network parameters.Nick Mathewson2021-09-091-3/+118
|
* Use macros and traits to simplify the declaration of parameters.Nick Mathewson2021-09-091-135/+144
| | | | | | | | | | | | | | | | Previously, we'd have to declare the field for a parameter in one place, its default in a second, and its consensus key in a third. That's error-prone and not so fun! This patch changes the way we declare parameters so that we declare a structure once, and macros expand it to all do the right thing. This required a few new traits and implementations to ensure uniformity across the types that can go in parameters: We need every parameter type to implement TryFrom<i32> and to implement SaturatingFromInt32. Eventually we might want SaturatingFromInt32 to be a more generic SaturatingFrom, but that's not for now.
* Fix/suppress a few more clippy lints in tests.Nick Mathewson2021-09-081-0/+1
| | | | | I'm alright with allowing cognitive-complexity violations in the tests.
* Merge remote-tracking branch 'origin/mr/71'Nick Mathewson2021-09-081-1/+1
|\
| * fix/silence clippy lints in test modulesDaniel Eades2021-09-081-1/+1
| |
* | Check for correct-ish decoding of all parameters.Nick Mathewson2021-09-081-4/+77
|/
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+350
This will cause some pain for now, but now is really the best time to do this kind of thing.