Commit Graph

17 Commits

Author SHA1 Message Date
Yuan Lyu 08e55bc9b1
Clean up EstablishIntro cell 2022-08-25 16:45:40 -04:00
Ian Jackson 14c6e17797 tor-cell: PaddingNegotiate::start: take IntegerMilliseconds 2022-08-17 10:54:41 +01:00
Ian Jackson 0df72449b8 chancell: PaddingNegotiate: Provide two constructors, not one
We don't really want the caller to pass ignored timeout parameters.
And this makes more semantic sense.

The stop constructor uses zero, which is what C Tor does.  See
  https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/76
2022-08-16 18:37:06 +01:00
Yuan Lyu 25bb25ddcb
Implement establish rendezvous cell 2022-08-05 00:04:42 -04:00
Nick Mathewson a0a88643f8 tor-cell: Make encoding method signatures fallible. 2022-07-11 11:18:51 -04:00
Ian Jackson bcf3bca211 tor-cell: udp: Remove manual length calculations
This does away entirely with `wire_addr_len`, which recapitulates the
length calculation.
2022-06-09 17:08:56 +01:00
Nick Mathewson 5854e4bbd9 Merge branch 'use-testing-rng' 2022-06-07 19:02:12 -04:00
David Goulet 3da4b95434 udp: New AddressPort used in cells
Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-06-07 12:29:51 -04:00
Ian Jackson a591bf353a udp: Allow empty hostname and no nul byte
After changes to the prop339, the domain name in an Address can only be
255 bytes max and can NOT contain nul byte(s).

Unit tests had to be modified to accept this change:

- Centralise msg_ip_address
- Add currently-passing tests for address length
- Test counted address length longer than type wants

Related to #463

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-06-07 12:23:27 -04:00
David Goulet 2ea709674d cell: Don't use NUL terminated string in CONNECT_UDP
Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-06-07 12:22:05 -04:00
David Goulet 8fd6541985 cell: Move UDP to its own module and feature gate it
Related to #463

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-06-07 12:22:05 -04:00
David Goulet b7ae1976b5 cell: Implement CONNECTED_UDP cell from prop339
Decoding and encoding implemented according to proposal 339.

Related to #463
2022-06-07 12:22:05 -04:00
David Goulet d74482cd90 cell: Implement CONNECT_UDP cell from prop339
Decoding and encoding is implemented according to proposal 339
specifications.

Related to #463

Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-06-07 12:22:05 -04:00
Nick Mathewson 967ea67b7d Use testing_rng() in tests throughout our crates.
This only affects uses of thread_rng(), and affects them all more or
less indiscriminately.  One test does not work with
ARTI_TEST_PRNG=deterministic; the next commit will fix it.
2022-06-02 14:56:42 -04:00
Ian Jackson b7fec1c8a4 Remove many needless borrows and slices
Found via clippy::needless_borrow.  In some cases I removed needless
`[..]` too.  See also:
  needless_borrow suggestion doesn't go far enough
  https://github.com/rust-lang/rust-clippy/issues/8389
2022-02-02 18:34:26 +00:00
Daniel Eades fb3b8b84b5 fix/silence clippy lints in test modules 2021-09-08 17:28:31 +02:00
Nick Mathewson 557a0ff40b Move all crates into a `crates` subdirectory.
This will cause some pain for now, but now is really the best time
to do this kind of thing.
2021-08-27 09:53:09 -04:00