Commit Graph

4841 Commits

Author SHA1 Message Date
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
Nick Mathewson 1be9019def Merge branch 'store-yak-bd' into 'main'
bridgedesc: yaks for persistent storage

See merge request tpo/core/arti!827
2022-11-04 16:56:28 +00: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
Nick Mathewson f0c8e239d6 Merge branch 'guardmgr-config' into 'main'
guardmgr: bridges config plumbing

See merge request tpo/core/arti!826
2022-11-03 16:23:51 +00:00
Ian Jackson 53905f3e1a docs features: Add a suppression for testing 2022-11-03 15:51:45 +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
eta 37aa8e79d1 Merge branch '587_suppress' into 'main'
Suppress new clippy warnings in 1.65

Closes #587

See merge request tpo/core/arti!824
2022-11-03 15:38:19 +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
Nick Mathewson e4ca2459db add_warnings: ignore clippy::result_large_err
This is a temporary workaround for #587 until we get it fixed for
real.
2022-11-03 11:05:14 -04:00
Nick Mathewson 0cb886a098 add_warnings: work with more non-GNU finds.
We were doing `find -name '*.rs'`, but `find . -name '*.rs'` (with the .)
is more standard.
2022-11-03 11:03:43 -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 6b76c31011 Merge branch 'descriptors' into 'main'
Provide an implementation of BridgeDescProvider

See merge request tpo/core/arti!820
2022-11-03 12:15:07 +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