Commit Graph

3096 Commits

Author SHA1 Message Date
Ian Jackson 3a1e599d5a GetMicrodescsState: Break out with_mdreceiver_for_missing 2022-03-17 15:49:29 +00:00
Ian Jackson 1c6f4aaa9b GetMicrodescsState: Dedupe slightly 2022-03-17 15:29:10 +00:00
Nick Mathewson 567995a7ca ClientCirc: Move n_hops into a new Path type.
This will help with #415
2022-03-17 10:34:06 -04:00
Nick Mathewson 85a20ae4ec Alternative API for set_isolation_group().
Instead of requiring a `Box<dyn Isolation>`, it now takes either a
`Box<dyn Isolation>`, or an arbitrary `T` that implements
`Isolation`.

This API still allows the user to pass in a `Box<dyn Isolation>` if
that's what they have, but it doesn't require them to Box the
isolation on their own.

Part of #414.
2022-03-17 09:07:08 -04:00
Nick Mathewson 2c5d985227 Update semver_status.md for isolation changes 2022-03-17 08:50:30 -04:00
Nick Mathewson 2818a3cb35 Merge branch 'test-isolation' into 'main'
new api for isolation

See merge request tpo/core/arti!377
2022-03-17 12:46:13 +00:00
Ian Jackson 40bede587c Merge branch 'config-partials-transparent' into 'main'
Absolish builders for CircMgrConfig and DirMgrConfig

See merge request tpo/core/arti!417
2022-03-17 12:30:46 +00:00
eta dd967e66b9 Merge branch 'always-ims' into 'main'
dirmgr: Always send if-modified-since on consensus documents.

Closes #403

See merge request tpo/core/arti!412
2022-03-16 21:32:48 +00:00
Ian Jackson a5ea3533c5 semver notes. 2022-03-16 19:38:12 +00:00
trinity-1686a 575792b583 replace TODOs with documentation 2022-03-16 20:33:36 +01:00
Ian Jackson a020f82de2 DirMgrConfig: abolish builder; make it transparent and exhaustive
See rationale in the comment.
2022-03-16 19:31:10 +00:00
Ian Jackson ab352881e3 Add rationale for CircMgrConfig transparency and trait 2022-03-16 19:31:08 +00:00
Ian Jackson 82aa4b902a Provide define_accessor_trait and use it to generate CircMgrConfig 2022-03-16 19:31:05 +00:00
Ian Jackson 8bde40fdd3 Make CircMgrConfig transparent (and make it a trait)
See commentary for the rationale.
2022-03-16 19:30:59 +00:00
Ian Jackson 8d54c0f073 Change type of TorClientConfig::override_net_params
Now we use NetParams.  That implies making its constructor public,
which I think it fine.

This is related to #413 but is far from completing that ticket.
2022-03-16 19:30:59 +00:00
Ian Jackson d0c71b3872 Actually honour preemptive circuits configuration
This handwritten conversion function omitted a field.  There was
nothing to spot this mistake.

IMO this shows why these particular types ought not to use builders,
but instead, should cause API breaks when things change.

Adding this line here to explicitly fix the bug, although we are about
to abolish this function completely almost right away.
2022-03-16 19:22:13 +00:00
Nick Mathewson e6fe205be3 Merge branch 'typos' into 'main'
Fix typo

See merge request tpo/core/arti!416
2022-03-16 19:11:50 +00:00
trinity-1686a 8a2b8eb9b8 add isolation to dns requests 2022-03-16 19:50:24 +01:00
Dimitris Apostolou 7353fd4397
Fix typo 2022-03-16 20:25:46 +02:00
trinity-1686a 7c606048f2 accept boxed isolation in StreamPref::set_isolation_group 2022-03-16 19:24:23 +01:00
trinity-1686a 4eb90b72c0 add trait to help test isolation related code 2022-03-16 19:24:23 +01:00
trinity-1686a 0b7c71a888 add tests on Isolation and fix conditional compilation issues
it seems I added conditional compilation without noticing it??
and there was some errors when choosing a prefered runtime depending on
feature flags
2022-03-16 19:24:23 +01:00
trinity-1686a 59bef598a3 replace IsolationMap with new Isolation trait 2022-03-16 19:24:23 +01:00
trinity-1686a 698132a762 refactor restrict_mut 2022-03-16 19:24:23 +01:00
trinity-1686a cb00ac677b replace Arc with Box and use dyn-clone
this also removes JoinResult
2022-03-16 19:24:23 +01:00
trinity-1686a 43abd119cf replace result with either 2022-03-16 19:24:23 +01:00
trinity-1686a ec7737b322 add some documentation for new traits 2022-03-16 19:24:23 +01:00
trinity-1686a 778d6f3380 replace isolated with compatible
the inverted logic was too easy to mess up
2022-03-16 19:24:23 +01:00
trinity-1686a 4826d757ac use downcast-rs instead of our own AsAny 2022-03-16 19:24:19 +01:00
trinity-1686a 234291f666 fix existing tests 2022-03-16 19:23:21 +01:00
trinity-1686a b3b27c9bd3 add a join() on Isolation 2022-03-16 19:23:21 +01:00
Trinity Pointard a1b8b4999f testing new api for isolation 2022-03-16 19:23:21 +01:00
Ian Jackson fb4111f524 Merge branch 'derive-builder' into 'main'
derive_builder: Switch to upstream 0.11

See merge request tpo/core/arti!414
2022-03-16 17:54:53 +00:00
Ian Jackson da787d074a derive_builder: Switch to upstream 0.11
This has the different syntax for builder field attributes than what I
originally proposed in my MR, and which therefore is in the pinned
branch.

My upstream MR for the field attributes feature was morged:
  https://github.com/colin-kiegel/rust-derive-builder/issues/239
2022-03-16 16:34:44 +00:00
Ian Jackson 8a5d98f716 downgrade_dependencies: Upgrade darling
The new version of derive_builder requires a newer darling.
Ooops.  Upstream MR here:
  https://github.com/colin-kiegel/rust-derive-builder/pull/242

For now, upgrade darling.  When there's a new upstream derive_builder,
we can use it and drop this.
2022-03-16 16:34:44 +00:00
Nick Mathewson c3e74973b4 netdir: Use an even smaller rep for list of microdescs
Every time we want a microdescriptor, we know the index of that
microdesc's corresponding routerstatus within the consensus.
Therefore, we can use that index to store `Arc<Microdesc>`s in a
dense array, and not have to use a HashSet here at all.
2022-03-16 11:52:47 -04:00
Ian Jackson 644f962cfd Merge branch 'move-retry-delay' into 'main'
Move RetryDelay into tor-basic-utils

See merge request tpo/core/arti!411
2022-03-16 15:37:44 +00:00
Nick Mathewson 76df9e4014 tor-dirmgr: Remove redundant hashtable.
We were using a hashtable to keep track of missing microdescriptor
digests.  But this information is redundant with the NetDir state,
and there's now no longer any performance benefit to keeping a
separate copy.

Part of #386.
2022-03-16 11:33:19 -04:00
Nick Mathewson 3e12cf2688 Merge branch 'clippy' into 'main'
Replace a match with some as_ref and as

See merge request tpo/core/arti!413
2022-03-16 15:16:42 +00:00
Nick Mathewson 233613cd79 NetDir: Use less space in hash tables
We previously kept missing-MD entries and present-MD entries all in
the same HashSet, which resulted in using more slack space than we
need.  Now we use separate tables, so we can drop missing-MD
entries as we move forward.

Also, when constructing a NetDir, set its hash tables to their final
capacities.

This also lets us simplify some of our missing-md-listing code a
lot.
2022-03-16 11:12:15 -04:00
Nick Mathewson 09f750c2c8 RetryDelay: remove accessors.
Instead, check initial_delay in dirmgr directly.
2022-03-16 10:50:13 -04:00
Ian Jackson 7564fabd68 Replace a match with some as_ref and as
The match was doing a deref coercion.

Found by current nightly's needless_match (whose suggestion doesn't
compile, https://github.com/rust-lang/rust-clippy/issues/8551 )
2022-03-16 14:41:04 +00:00
Nick Mathewson 4ccc3af423 dirmgr: Always send if-modified-since on consensus documents.
We never want a consensus document that's super-old, since we would
reject it immediately for being too old.

Also, never send an if-modified-since that's so old that we'd reject
the response.

Closes #403
2022-03-16 09:48:37 -04:00
Nick Mathewson 11883b9e8d Remove re-export of retry-schedule in tor-dirmgr.
It wasn't necessary.
2022-03-16 08:47:02 -04:00
Nick Mathewson 90c48dc1b0 Fix up documentation on RetryDelay.
It's no longer about downloads; it's about whatever you need to
retry.
2022-03-16 08:42:46 -04:00
Nick Mathewson 67645473d5 Move RetryDelay from dirmgr to basic-utils.
This (almost) a pure code-movement commit: it also makes one public
function private in order to suppress a warning.
2022-03-16 08:31:54 -04:00
Nick Mathewson ef619ba70a RetryDelay: add accessors for state
We'll need these for our unit tests in tor-dirmgr once we move
RetryDelay into tor-basic-utils.
2022-03-16 08:26:14 -04:00
Nick Mathewson e8c63fe3e8 tor-basic-utils/Cargo.toml: reformat.
This is a separate commit to avoid putting format changes in the
next commit.
2022-03-16 08:21:44 -04:00
Ian Jackson 9593cf637a Merge branch 'testing_dns_port' into 'main'
Use port 35353 for testing, not 5353.

See merge request tpo/core/arti!408
2022-03-16 10:32:04 +00:00
Nick Mathewson 00212ed025 Merge branch 'dns' into 'main'
fix rust-nightly CI job

See merge request tpo/core/arti!409
2022-03-15 14:12:52 +00:00