Nick Mathewson
f3ad295224
Expose network parameters more sensibly from NetDir.
2020-12-22 15:20:07 -05:00
Nick Mathewson
cc2a5d94ef
Migrate from lazy_static to once_cell.
2020-12-22 11:55:41 -05:00
Nick Mathewson
df4524d936
Check ipv6 exit policies when trying to connect to an ipv6 port specifically
2020-12-22 09:28:26 -05:00
Nick Mathewson
42db4210ab
Simplification: Every relay is in the same family as itself.
2020-12-17 15:32:09 -05:00
Lunar
42f0d294de
Make sure that a circuit doesn't use relays in the same family
...
We implement `Relay::in_same_family` which is in turn used by
`ExitPathBuilder::pick_path` to avoid picking relays in the
same family.
Compared to the original C implementation, we are missing
support for options EnforceDistinctSubnets and NodeFamilySets.
This has only been very lightly tested so far.
Closes : #43
2020-12-16 16:34:59 +01:00
Nick Mathewson
635cdc06d8
Write a few misc unit tests
2020-12-15 15:34:08 -05:00
Nick Mathewson
d92c1aac04
Remember the actual usable ports for an exit after we've built a circuit
...
Previously we'd just remember the port that we _wanted_ a circuit
for, and forget all the ports that it _could_ support.
This is part of a bigger circmgr revision/refactoring pass; there
should be cleanups before I merge this.
2020-12-14 12:29:51 -05:00
Nick Mathewson
90fc798646
Fix some rustdoc warnings.
2020-12-09 09:46:39 -05:00
Nick Mathewson
cfdedb995f
upgrade rusqlite
2020-12-08 17:26:49 -05:00
Nick Mathewson
9419f6d699
Use uniform weight all measured weights are zero.
2020-12-07 21:07:41 -05:00
Nick Mathewson
a52585d9d6
Mark some XXXX issues as XXXX-A1.
2020-12-07 16:07:59 -05:00
Nick Mathewson
9c96b5ea5d
Add a missing documentation comment.
2020-12-07 09:26:22 -05:00
Nick Mathewson
915515442f
Reuse microdescriptors from previous consensus
...
Previously, we'd re-parse them from the database every time we got a
new consensus.
2020-12-06 11:42:50 -05:00
Nick Mathewson
5e0b8380e2
Refactor NetDir a little for space savings and updating
...
Rather than having the NetDir own its microdescs and consensus, give
it Arc<>s for them. This way, we can do a shallow copy of a NetDir
to work around mutability issues that would otherwise make it hard
to add microdescs to a netdir on the fly.
2020-12-06 11:13:10 -05:00
Nick Mathewson
2e0c6f900b
A few more tests for role-based weighting
2020-12-02 18:05:12 -05:00
Nick Mathewson
b793e0c075
Use bwweightscale to avoid miscalculating weights for v2dir relays
2020-12-02 17:54:22 -05:00
Nick Mathewson
1d6d9b9c4b
More tests for weight.rs; find a bug.
2020-12-02 17:39:34 -05:00
Nick Mathewson
49fc20426a
Add a few easy tests in weights.rs
2020-12-02 16:57:37 -05:00
Nick Mathewson
42c85026f3
a little more refactoring for testability
2020-12-02 15:59:08 -05:00
Nick Mathewson
64f28a10a5
Clarify DFLT_WEIGHT in weights.rs
2020-12-02 15:48:26 -05:00
Nick Mathewson
e931e811b0
Resolve a couple of TODOs in weight.rs
...
(Thanks to Mike Perry for answers here.)
2020-12-02 15:40:32 -05:00
Nick Mathewson
5dd32ba3c1
weights: refactor a couple of functions to be more testable.
2020-12-02 15:39:12 -05:00
Nick Mathewson
6e755eee4d
Use a slightly prettier syntax in max_weight
2020-12-02 15:27:32 -05:00
Nick Mathewson
aebf1fcc0d
Fix a few comments in weight.rs
2020-12-02 14:15:40 -05:00
Nick Mathewson
6f25dd05af
Use a better calculation for deciding if we have enough paths.
2020-12-02 14:09:33 -05:00
Nick Mathewson
412f1763de
Implement correct (?) weighting for path selection.
2020-12-02 13:51:19 -05:00
Nick Mathewson
f9d741ab36
Add a function to load a directory from cache.
2020-11-24 09:00:45 -05:00
Nick Mathewson
9749022fa2
When a consensus has enough descriptors, mark it non-pending.
2020-11-24 07:08:41 -05:00
Nick Mathewson
99e0b1d9f5
Remove a couple of #[allow]s.
2020-11-20 15:30:32 -05:00
Nick Mathewson
7e50c4ad3a
Move storage and config logic from netdir to dirmgr.
2020-11-20 12:20:43 -05:00
Nick Mathewson
21ebb5caf3
NetDirConfig: Learn fallback directories from chutney configurations too
2020-11-20 09:48:57 -05:00
Nick Mathewson
c7ee4997b5
Missing file: whoops
2020-11-20 09:18:12 -05:00
Nick Mathewson
4721e95c06
Use a builder pattern for NetDir.
2020-11-20 09:02:11 -05:00
Nick Mathewson
ff821d3f31
Move NetDirConfig into its own module.
2020-11-20 08:53:34 -05:00
Nick Mathewson
d3f94f48f4
Move some netdir code into submodules.
...
The Authority type gets its own module; so does the ability to load
from legacy storage.
2020-11-20 08:44:26 -05:00
Nick Mathewson
300c9c3fde
Remove "dumpdir" example as obsolete
2020-11-20 08:08:32 -05:00
Nick Mathewson
9f4230fb1b
Initial pass on directory-manager code.
...
This code can now bootstrap from the network, cache the results, and
reload from cache.
There's lots more work to do here, including a big pile of tidying
and refactoring and testing and documentation.
2020-11-19 19:11:10 -05:00
Nick Mathewson
02bac5f04e
Add support for using fallback directories in path construction
...
This is mainly a refactoring commit, with a little new code.
It also adds #[derive(Copy,Clone)] for a few types.
2020-11-19 10:06:48 -05:00
Nick Mathewson
658996dae9
Netdir: improve representation
...
Now a netdir no longer holds unwanted microdescs, and it always
holds a weight function.
2020-11-17 14:14:17 -05:00
Nick Mathewson
9d49988c66
Netdir: add functions to add mds, and list missing mds
2020-11-17 13:40:00 -05:00
Nick Mathewson
3668f65c9e
Netdir: only expose a netdir object if we have enough directory info
...
The calculation isn't completely right here, but it's a fair
stopgap.
2020-11-17 13:26:46 -05:00
Nick Mathewson
0d06dedd17
Include a list of fallback directories in tor-netdir
2020-11-16 16:46:08 -05:00
Nick Mathewson
6f68f99f4e
Checkpoint work on a sqlite backend.
...
Among other stuff, revert parts of previous commit that introduced a
ReadableStore abstraction: there isn't a good abstraction hat covers
both Tor legacy stores and sqlite stores-- or if there is, I'll have
to find it organizally.
This isn't a final version: it probably has bugs, and it needs
documentation and more tests. But before I do those, I want to
sanity-check the API by drafting the next layer up on the stack.
2020-11-16 09:22:27 -05:00
Nick Mathewson
4512d7e9ed
Have the consensus-parsing code expose the signed piece of the consensus.
2020-11-16 08:55:31 -05:00
Nick Mathewson
7336eeeb61
Checkpoint work on making storage backend generic
...
Also uses mmap for loading stuff.
2020-11-14 10:32:17 -05:00
Nick Mathewson
4d24fff9c0
Upgrade dependencies
2020-11-10 12:27:10 -05:00
Nick Mathewson
7d5829b0a8
netdir: remove interior mutability.
2020-11-04 11:32:12 -05:00
Nick Mathewson
d9dafa0a28
Add a new circuit-manager crate and move path selection there.
2020-11-02 10:44:31 -05:00
Nick Mathewson
b93e4b76c8
Remove a bunch of dbg! calls.
2020-10-26 14:33:14 -04:00
Nick Mathewson
d3b71bc177
More documentation in tor-netdoc.
2020-10-26 11:51:53 -04:00
Nick Mathewson
57637f3644
netdir: don't use relays with NoEdConsensus flag set.
2020-10-19 09:31:36 -04:00
Nick Mathewson
295a791a82
Improvements to Relay type in tor-netdir.
...
Now, a Relay is always valid. This required some changes to the
API: all_relays() has to return a new UncheckedRelay type that might
or might not be valid, and the functions on Relay and ChanTarget
that return ed25519 identities need to return an Ed25519Identity,
not an ed25519::PublicKey.
This change required some new encoding/decoding/conversion functions
on Ed25519Identity.
2020-10-19 09:22:49 -04:00
Nick Mathewson
353a4bfb87
Cleanup from prop315 implementation.
...
Most of the fixes here are just removing comments that said "this
isn't technically required but I'm going to pretend it is".
I also made the "protocols" field in microdescs out of its Option<>,
since we're now requiring that.
2020-10-16 16:36:51 -04:00
Nick Mathewson
3408c9ad26
Run "cargo upgrade".
2020-10-15 13:32:02 -04:00
Nick Mathewson
6f75b82ef3
Use Ed25519Identity in microdescriptors.
2020-10-15 12:42:09 -04:00
Nick Mathewson
a1855699ef
Test the pick_weighted function in tor-netdir
2020-10-10 17:36:15 -04:00
Nick Mathewson
2247664abe
Remove a couple of allow(unused) notations
2020-10-09 16:47:59 -04:00
Nick Mathewson
788e0347cb
Move around the modules inside tor-netdoc.
...
This change just gives them a more logical breakdown into parsing,
documents, and misc other types.
2020-09-29 09:05:17 -04:00
Nick Mathewson
98ab84e774
Rename remaining get_ accessors
2020-09-28 16:13:14 -04:00
Nick Mathewson
05da5a7f73
Rename some identifiers in tor-linkspec.
...
By convention, rust accessor functions don't start with 'get'.
2020-09-28 15:29:39 -04:00
Nick Mathewson
3b3a6736f6
Rename ExtendTarget to CircTarget.
2020-09-28 15:22:24 -04:00
Nick Mathewson
397d753e4e
Fix a few clippy issues
2020-09-27 03:30:09 -04:00
Nick Mathewson
f945af0c41
Document private members in most crates
2020-09-24 19:25:37 -04:00
Nick Mathewson
d4281b110e
Add documentation for tor-netdir crate
2020-09-13 08:27:55 -04:00
Nick Mathewson
ee9b871bc5
Make client-demo launch a request to www.torproject.org:80
2020-09-12 21:32:00 -04:00
Nick Mathewson
02fc8b2528
Implement extend2/extended2 handshake.
...
This is not a production-ready implementation: it will break if a
circuit is used for anything while an extend is pending.
Client-demo can now build 3-hop circuits.
2020-09-12 20:48:07 -04:00
Nick Mathewson
ee71abe560
Pare down and sort dependencies
2020-09-09 19:17:49 -04:00
Nick Mathewson
9f30b47cb7
Run cargo upgrade, except for stream-cipher.
2020-09-09 19:06:00 -04:00
Nick Mathewson
85bcf9f31b
netdir: downgrade a log
2020-09-09 11:11:29 -04:00
Nick Mathewson
1f5d758dc3
netdir: look in right path for cached-microdescs.new
2020-09-09 10:55:34 -04:00
Nick Mathewson
875e932898
New "linkspec" module to encapsulate info needed to connect/extend.
2020-09-08 20:43:15 -04:00
Nick Mathewson
0fc85598d1
rename weightfn variants
2020-09-08 19:57:12 -04:00
Nick Mathewson
48b9510caa
Add a handy function for picking a random relay.
2020-09-08 17:50:08 -04:00
Nick Mathewson
8768222acb
Start on accessors for relay weight.
2020-09-08 17:20:46 -04:00
Nick Mathewson
e40a63c013
netdir: add the ability to add authorities from a chutney directory.
2020-09-08 14:34:43 -04:00
Nick Mathewson
92830810d5
netdir: Add an extra day's tolerance to consensus timeouts
2020-09-08 14:05:22 -04:00
Nick Mathewson
e31652afe1
Bugfix: parse ed25519 ids right in mds
2020-09-08 13:30:16 -04:00
Nick Mathewson
b5ad25e0d4
Netdir: a few more accessors
2020-09-08 12:56:45 -04:00
Nick Mathewson
a4f1b27334
Fix clippy warnings; improve key type for consensus.
2020-09-07 17:27:29 -04:00
Nick Mathewson
919a7c5970
Start on a 'netdir' crate to wrap netdoc.
...
For now, this assumes an existing Tor cache directory.
2020-09-07 16:53:06 -04:00