Nick Mathewson
bc28793166
Downgrade TODO on chan_method
...
This is not something we need to solve for 1.1.0 (and it might not
need to be solved ever).
2022-11-07 11:49:49 -05:00
Nick Mathewson
d448809e49
Merge branch 'hilev_spelling' into 'main'
...
Spelling fixes and normalizations on some high-level crates
See merge request tpo/core/arti!835
2022-11-07 15:48:06 +00:00
Nick Mathewson
b423a40478
Remove TODO about third ChannelMethod variant.
...
We didn't find a use for this.
2022-11-07 10:39:13 -05:00
Nick Mathewson
e832a90c4b
Remove TODO about inlining PtTargetSettings.
...
Since there are (or soon will be) parsing restrictions on this type,
we don't want to inline it as a simple Vec.
2022-11-07 10:36:20 -05:00
Nick Mathewson
b295518a42
Spelling fixes and normalizations on some high-level crates
2022-11-07 10:21:58 -05:00
Ian Jackson
85035c7c5a
bridge desc: Make BridgeDescProvider DynClone
...
This allows the use of Box<dyn BridgeDescProvider> in callers,
since Box<dyn BridgeDescProvider> is now Clone.
2022-11-07 11:56:41 +00:00
Dimitris Apostolou
9c7d1802f5
Fix typos
2022-11-06 06:51:58 +02:00
Ian Jackson
5b66a5e199
bridge desc tests: Test caching and if-modified-since
2022-11-04 19:08:32 +00:00
Ian Jackson
78f7916a88
bridge desc tests: Break out queues_are_empty helper
2022-11-04 19:08:32 +00:00
Ian Jackson
40c21b7d19
bridge desc tests: Provide a sqlite connection
...
The current test case doesn't use this.
2022-11-04 19:08:32 +00:00
Ian Jackson
636bff3193
bridge desc: Implement storage functions at the DB layer
2022-11-04 19:08:32 +00:00
Ian Jackson
6bb2eb9902
bridge desc: Make Downloaded be Debug
2022-11-04 19:08:32 +00:00
Ian Jackson
5bc1d40a2b
bridge desc: Implement cache reuse logic and if-modified-since
...
This introduces the new API functions to Store.
But currently they are all no-ops.
So all this machinery doesn't actually do anything.
Also, it changes the API to the mockable downloader, to allow it to
support if-modified-since. So this isn't used either. But it is more
convenient to do this all at once in BridgeDescManager, since care
needs to be taken about the intraction between if-modified-since and
the persistent cache.
2022-11-04 19:08:32 +00:00
Ian Jackson
279a169031
bridge desc: Rename one more variable to text
2022-11-04 19:02:23 +00:00
Ian Jackson
eaaa61a8e2
bridge desc: Catch panics in the download functionality
2022-11-04 19:02:23 +00:00
Ian Jackson
3f3f27193c
bridge desc: Provide a Store to the bridge desc manager
...
We use the one in the dirmgr. That means that our constructor now has
to take a dirmgr. And, the dirmgr must have a circmgr.
This is all rather odd, TBH.
Add .. to the binding of the return values from setup, as
future-proofing.
The tests now need to provide a Store too. Make the sqlite::new_empty
function pub(crate) so we can use it.
We must retain the _db_tmp_dir, since when it goes away the tmp
directory is deleted and the db goes readonly.
2022-11-04 19:02:23 +00:00
Ian Jackson
1fa9dd62b3
bridge desc tests: Apply tracing_test::traced_test
...
This lets us see the log messages. They look fine, as it happens.
2022-11-04 19:02:23 +00:00
Ian Jackson
9424b0970d
tor-dirmgr: impl AsRef<dyn Error> for Error
...
This allows use with tor_error::Report.
2022-11-04 19:01:24 +00:00
Ian Jackson
f3957a50b6
tor-netdoc: RouterDesc: Add published accessor
...
The bridge descriptor manager is going to want this.
2022-11-04 19:01:24 +00:00
Ian Jackson
dcdd8053b4
dirmgr: Make store be in an Arc
...
This will let us share it with the bridge descriptor manager.
(As discussed with Nick.)
2022-11-04 19:01:24 +00:00
Ian Jackson
9a285ec4ad
dirmgr sqlite store: Improve schema updates
...
* Centralise applying the schema updates, in a closure
* Make the schema update SQL texts be in an array so we can loop
* Make the version update statement generic, not cloned-and-hacked
This will make it possible to add another schema version without
error-prone conditions etc.
2022-11-04 19:01:24 +00:00
Gabriel de Perthuis
21a3808684
Upgrade to clap 3: replace deprecated functions
...
Also replace Arg::takes_value with Arg::action to configure flags
that don't take parameters vs options that do.
This makes it easy to upgrade to clap 4.
Tested deprecations with:
cargo check --workspace --all-features --features clap/deprecated
2022-11-04 19:28:40 +01:00
Gabriel de Perthuis
bc08ea48f7
Upgrade to clap 3 with minimal changes
...
This removes the last cargo audit override (for the unmaintained
ansi_term).
Don't mark options as required when they have default values:
see <https://github.com/clap-rs/clap/pull/3793 >.
2022-11-04 19:28:38 +01:00
Ian Jackson
bf563f3bdf
bridgedesc: Rename "text" from "output"
...
This was confusing, because it's the output of the donwload, but
nowhere near the output of the whole process. And it's going to
become even less so.
2022-11-03 19:00:47 +00:00
Ian Jackson
17ceae724e
bridgedesc: Make process_document into a free function
...
It deserves this treatment, I think.
2022-11-03 18:59:50 +00:00
Ian Jackson
c7a7ce5c20
bridgedesc: Introduce Downloaded
...
This gives names to things and makes things clearer, and this will be
even more true in a moemnt.
2022-11-03 18:59:50 +00:00
Ian Jackson
d2b31f7796
bridgedesc: download: Break out process_document
...
We're going to want to reuse this for handling cached stuff.
2022-11-03 18:57:40 +00:00
Ian Jackson
6fbf3059cd
bridgedesc: Prepare Mockable trait for if-modified-since
2022-11-03 18:57:40 +00:00
Nick Mathewson
7d079ade3b
Merge branch 'warning' into 'main'
...
tor-guardmgr: use imported WeightThreshold in one place
See merge request tpo/core/arti!825
2022-11-03 16:25:37 +00:00
Ian Jackson
7d6f5d5eab
guardmgr config: Provide bridge information to new and reconfigure
2022-11-03 15:48:07 +00:00
Ian Jackson
aa375e2e09
tor-guardmgr: use imported WeightThreshold in one place
...
Without this, an unused import warning is generated when building
without features.
2022-11-03 15:44:32 +00:00
Ian Jackson
5bc3934fb4
bridges config: Provide uninhabited placeholder
...
This will avoid having to make bridge-related trait features in
GuardMgr conditional, which would be non-additive.
2022-11-03 15:43:41 +00:00
Ian Jackson
3dde9f8a05
bridges config: Check that bridges aren't enabled with no bridges
...
This is the validation which is called for by the documentation.
2022-11-03 15:43:41 +00:00
Ian Jackson
6c64be06a6
guardmgr config: Introduce and require new GuardMgrConfig trait
...
It doesn't seem to me like it makes sense to provide the backward
compatibility here.
2022-11-03 15:43:41 +00:00
Ian Jackson
f50da3efa1
define_accessor_trait: Allow specification of other items
2022-11-03 15:43:41 +00:00
Ian Jackson
64de9f74be
define_accessor_trait: Allow specification of supertraits
2022-11-03 15:43:41 +00:00
Ian Jackson
2bfce54959
guardmgr config: Pass fallback list from config by reference
...
This does involve additional cloning. However, soon it will mean that
we can pass the whole `TorClientConfig` by reference.
2022-11-03 15:43:41 +00:00
Nick Mathewson
1179c39859
Suppress two clippy::large_enum_variant warnings
...
These are newly present on 1.65. We can address them later.
2022-11-03 11:09:51 -04:00
Nick Mathewson
932fe48eaf
Run add_warnings.
2022-11-03 11:06:02 -04:00
eta
c77cecd5b3
Merge branch 'edition-2021' into 'main'
...
set all crate edition to 2021
See merge request tpo/core/arti!822
2022-11-03 14:39:24 +00:00
Ian Jackson
70b420adf8
bridge descriptors tests: Fix flaky test
2022-11-03 11:46:20 +00:00
Ian Jackson
daf7eac60a
bridge descriptors tests: Test set_bridges more thoroughly (fix)
...
The RetryDelays are being triggered for the 2nd time here, so their
timeouts can be longer. We must bump the sleep to make sure we don't
have a flaky test.
2022-11-03 11:37:30 +00:00
Ian Jackson
7a99601721
bridge descriptors: logging: Log addition and removal (fmt)
...
Worsify formatting as demanded by rustfmt.
2022-11-03 11:37:30 +00:00
Ian Jackson
269808336e
bridge descriptors: logging: Log addition and removal
...
This involves breaking the calls to `new_bridges.remove` into a helper
that does the logging.
2022-11-03 11:37:30 +00:00
Ian Jackson
17c766fde4
bridge descriptors: logging: Log download start and outcome
2022-11-03 11:37:30 +00:00
Ian Jackson
1ccd9db9af
bridge descriptors tests: Test set_bridges more thoroughly
...
Prior to the previous commit, set_bridges would malfunction if there
were bridges which where (i) in current (ii) in queued or running
(iii) in the new bridge set.
This test failed then and passes now.
2022-11-03 11:37:30 +00:00
Ian Jackson
4a830e1ac2
bridge descriptors: Rewrite set_bridges
...
This was fundamentally confused and irregular. Now it is more
regular: it does the same things to all the elements of Tracked,
and a simple filtering on current.
This fixes a bug, for which I'm about to add a test case.
2022-11-03 11:37:30 +00:00
Ian Jackson
0571674a64
bridge descriptors tests: Add another couple of test cases
2022-11-03 11:37:30 +00:00
Ian Jackson
6db3403820
bridge descriptors tests: stream_drain_ready returns event count
...
We'll use this in a moment.
2022-11-03 11:37:30 +00:00
Ian Jackson
53c1cf0c6d
bridge descriptors tests: Break out bad_bridge helper function
2022-11-03 11:37:30 +00:00
Ian Jackson
42b1b08fdf
bridge descriptors: Change default max_refetch
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/820#note_2850269
2022-11-03 11:37:30 +00:00
Ian Jackson
2ae8a52371
bridge descriptors: Add clarification about bridge states
2022-11-03 11:37:30 +00:00
Ian Jackson
ad39873782
bridge descriptors: Improve and fix docs for consider_launching
2022-11-03 11:37:30 +00:00
Ian Jackson
d44bc1d0f8
bridge descriptors: Add comments where StateGuard is dropped
2022-11-03 11:37:30 +00:00
Ian Jackson
54e51cdba5
bridge descriptors: Document `changed` and `earliest_timeout` Options
2022-11-03 11:37:30 +00:00
Ian Jackson
fb4ffb76fd
bridge descriptors: Document updates argument to timeout_task
2022-11-03 11:37:30 +00:00
Ian Jackson
48f48841e1
Require derive_more 0.99.3
...
0.99.[012] have a bug https://github.com/JelteF/derive_more/issues/114
which makes the Deref derive for bridgedesc::StateGuard not work
and therefore breaks minimal-versions CI.
It seems simpler to require the newer version everywhere.
2022-11-03 11:37:23 +00:00
Ian Jackson
8eb7c731a2
bridge descriptors: Tests
2022-11-03 11:37:05 +00:00
Ian Jackson
3a185d61df
bridge descriptors: Provide a consistency check function
...
This is really part of the tests, but I put it here so that it can be
compiled-in if someone wants it during debugging.
2022-11-03 11:37:05 +00:00
Ian Jackson
51b4588cc0
bridge descriptors: Provide an implementation of BridgeDescProvider
...
Tests will come in a moment.
2022-11-03 11:37:05 +00:00
Ian Jackson
0fb535ba28
tor-dirclient: Response: Provide into_output_string
...
This is the missing one of the full set. It turns out that I wanted
this rather than the non-consuming output_string.
2022-11-03 11:37:05 +00:00
Ian Jackson
42f9651b8e
Copy tor-netdoc/testdata/routerdesc1.txt into tor-dirmgr
...
This seems better than having tor_netdoc export a `#[cfg(test)]`
public constant.
2022-11-03 11:37:05 +00:00
Nick Mathewson
66f34ee774
Merge branch 'guards_as_bridges_part3' into 'main'
...
GuardMgr: decouple NetDir from guards and sample code.
See merge request tpo/core/arti!815
2022-11-02 12:41:03 +00:00
Nick Mathewson
c2ed381c99
Refactor CandidateStatus API to simplify code in descs.
...
This removes some duplication.
2022-11-02 08:07:32 -04:00
Nick Mathewson
fc0c12510a
GuardMgr: Fix and improve comments based on review.
2022-11-02 08:07:32 -04:00
Nick Mathewson
6828178dec
guardmgr: fix rustdoc references.
2022-11-02 08:07:32 -04:00
Nick Mathewson
08473872ab
guardmgr: Refactor candidate info; add `full_dir_info`
...
Previously we always set `dir_info_missing` to `false` for new
guards, since new guards could only be taken from ones that were
present in the NetDir. But for bridges, we don't download their
info until _after_ we have chosen them as guards.
2022-11-02 08:07:11 -04:00
Nick Mathewson
5867318a35
guardmgr: Implement Universe for bridges.
...
Now we can use a group of bridges as the basis for a sample of
guards.
2022-11-02 08:06:43 -04:00
Nick Mathewson
79dade342a
guardmgr: Universe API should look up by ChanTarget
...
This will be necessary for bridges.
2022-11-02 08:06:43 -04:00
Nick Mathewson
82e9a57012
guardmgr: take sampled guards from Universe.
...
This is a trickier case, since we have to deal with weights.
2022-11-02 08:06:43 -04:00
Nick Mathewson
7733146c8c
guardmgr: Continue porting porting code to use Universe.
...
Two more simple cases that can use Universe instead of Netdir.
2022-11-02 08:06:20 -04:00
Nick Mathewson
fbcacea993
guardmgr: Begin to decouple guards from NetDir.
...
In this and the upcoming commits I'll be changing how guards related
to `NetDir` and to `Relay`. Previously, a guard could only come
from (or be updated from) a `Relay` in a `NetDir`. Soon it will be
able to be built from a bridge as well.
To do this, I'm defining a `Universe` trait (name negotiable) that
represents a set of things that may be guards. I'm going to
continue extending its functionality until there are no more
methods in guard.rs or sample.rs that take `NetDir`.
This commit removes most of the usage of `NetDir` and `Relay` in
`guard.rs`.
2022-11-02 08:05:51 -04:00
Nick Mathewson
b5f498021d
guardmgr: Rename microdescriptor_missing to dir_info_missing
2022-11-02 07:59:56 -04:00
Nick Mathewson
39ea0518ee
guardmgr: Allow guards to be constructed from any ChanTarget.
2022-11-02 07:59:56 -04:00
Nick Mathewson
1cb6ea1e77
guardmgr: Include PtTarget in guards.
...
Use a vector, since we may (someday) want to allow a Guard to have
multiple PtTargets.
2022-11-02 07:59:56 -04:00
Ian Jackson
0489d2d4be
Merge branch 'notify' into 'main'
...
refactor config reload triggering
Closes #562
See merge request tpo/core/arti!819
2022-11-01 13:31:17 +00:00
trinity-1686a
c487de6c46
debounce reload cfg events
2022-11-01 13:42:05 +01:00
trinity-1686a
d29f38603d
set all crate edition to 2021
2022-11-01 00:17:33 +01:00
trinity-1686a
ce886e209f
rename unused field
2022-10-30 12:36:13 +01:00
trinity-1686a
5cf2933d33
update some strings
2022-10-30 12:31:07 +01:00
trinity-1686a
5abddfb579
use iife so we can try! instead of custom error handling
2022-10-30 12:31:07 +01:00
trinity-1686a
66c08c967e
refactor so events always indicate reload
2022-10-30 12:31:07 +01:00
trinity-1686a
749746a609
depends less on notify types
2022-10-30 12:31:07 +01:00
trinity-1686a
e6e064ac8a
remove unused dependancies
2022-10-29 13:29:55 +02:00
Nick Mathewson
29c46d08b5
Merge branch 'guards_as_bridges_part2' into 'main'
...
Use ByRelayIds to hold guards in GuardSet
See merge request tpo/core/arti!808
2022-10-27 21:09:47 +00:00
Nick Mathewson
557a07677e
guardmgr: Rename and clarify of non-persistent-state copy fns
...
These will need a bigger overhaul: see #612 and #611 .
2022-10-27 16:40:35 -04:00
Ian Jackson
4f171acaf7
Clarify fix_consistency
2022-10-27 16:40:35 -04:00
Ian Jackson
7180079112
Clarify what it means to be "an identity" for a primary guard.
2022-10-27 16:40:35 -04:00
Ian Jackson
15d464a929
tor-guardmgr: Add big doc comment about guard id handling
2022-10-27 16:40:35 -04:00
Ian Jackson
4a59d384b6
tor-dirmgr: impl Default for FlagPublisher
2022-10-27 15:57:57 +01:00
Ian Jackson
94325cd456
tor-dirmgr: impl FlagEvent for BridgeDescEvent
2022-10-27 15:57:57 +01:00
Ian Jackson
26a7aa9aa6
BridgeDescProvider: Make BridgeDescEvent repr(u16) and derive traits
...
This will enable us to impl FlagEvent for it.
2022-10-27 15:57:54 +01:00
Ian Jackson
a56efbfdf0
impl Hash for BridgeConfig and various PT information
...
The bridge descriptor manager wants to index data structures by the
BridgeConfig.
2022-10-27 15:57:54 +01:00
Ian Jackson
a89daba1c8
tor-guardmgr: bridges: export BridgeDescError at toplevel
2022-10-27 15:57:54 +01:00
eta
84a2624401
Merge branch 'fuzz_ptmgr_ipc' into 'main'
...
ptmgr: Add a fuzzer for ptmessage.
See merge request tpo/core/arti!814
2022-10-27 14:51:35 +00:00
eta
b3d8f3b5ee
Merge branch 'simpler_quote_skipping' into 'main'
...
ptmgr::ipc: Try an alternate approach to initial quotes.
See merge request tpo/core/arti!813
2022-10-27 14:50:56 +00:00
Ian Jackson
9796d615f8
tor-basic-utils: Provide an implementation of BinaryHeap::retain
...
This is currently nightly-only and is blocked on an unresolved API
question:
https://github.com/rust-lang/rust/issues/71503
2022-10-27 10:46:03 +01:00
Ian Jackson
a59fef00e9
tor-checkable: Make TimerangeBound::dangerously* non-experimental
...
I want one of these for the bridge descriptor downloader, and they
seem reasonable to me.
2022-10-27 10:46:03 +01:00
Nick Mathewson
9f73ddd440
Merge branch 'assert_maxlen' into 'main'
...
tor-cell: Assert data length in Data cells
See merge request tpo/core/arti!800
2022-10-27 01:46:21 +00:00
Nick Mathewson
42fefe021d
ptmgr: Add a fuzzer for ptmessage.
2022-10-26 16:59:48 -04:00