summaryrefslogtreecommitdiff
path: root/crates/tor-cell/src
Commit message (Collapse)AuthorAgeFilesLines
* Clean up EstablishIntro cellYuan Lyu2022-08-251-12/+162
|
* enable doc_auto_cfg feature on every crate when documenting for docs.rstrinity-1686a2022-08-241-0/+1
|
* tor-cell: PaddingNegotiate::start: take IntegerMillisecondsIan Jackson2022-08-171-3/+4
|
* tor-cell: PaddingNegotiate: give better spec xrefsIan Jackson2022-08-171-0/+6
|
* channel padding: Rename low_ms and high_msIan Jackson2022-08-171-1/+5
| | | | | These have the unit in the type. Putting that in the field name too is otiose.
* tor-cell, testing: Provide PaddingNegotiate::from_rawIan Jackson2022-08-161-0/+8
| | | | | This allows test cases to describe precisely the contents of the negotiation cell ought to be generated.
* chancell: PaddingNegotiate: Provide start_default and a Default implIan Jackson2022-08-161-0/+20
| | | | | As proposed in https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/77
* chancell: Introduce PaddingNegotiateCmdIan Jackson2022-08-161-5/+17
| | | | | This gets rid of some random hardcoded literals. We're going to want to reuse this, too.
* chancell: PaddingNegotiate: Provide two constructors, not oneIan Jackson2022-08-161-7/+14
| | | | | | | | 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
* chancell: PaddingNegotiate: Make EqIan Jackson2022-08-161-2/+2
| | | | | | | | This will be convenient for managing when to send these negotiation messages. While we're here, edit the comment to explain how this is (going to be) used.
* Clarify `REASON_DONE`Emptycup2022-08-161-1/+1
|
* Implement establish rendezvous cellYuan Lyu2022-08-052-1/+42
|
* Several typo fixes from `typos`.Nick Mathewson2022-07-271-1/+1
|
* Fix compilation of EstablishInto encoding.Nick Mathewson2022-07-221-2/+3
| | | | It was based on the old `Writeable` API.
* Merge branch 'hs-cells' into 'main'eta2022-07-223-1/+88
|\ | | | | | | | | Implement ESTABLISH_INTRO relay cell See merge request tpo/core/arti!626
| * Implement ESTABLISH_INTRO relay cellYuan Lyu2022-07-183-1/+88
| |
* | Merge branch 'fallible_writers_v2' into 'main'Nick Mathewson2022-07-197-95/+172
|\ \ | | | | | | | | | | | | | | | | | | Revise tor_bytes::Writer::write to return a Result. Closes #513 See merge request tpo/core/arti!623
| * | tor-cell: Stop using write_infallibleNick Mathewson2022-07-113-37/+69
| | | | | | | | | | | | Also, stop using "expect" and "assert!" to check for errors.
| * | tor-cell: Make encoding method signatures fallible.Nick Mathewson2022-07-116-50/+89
| | |
| * | Convert each write_onto_infallible implementation into write_onto.Nick Mathewson2022-07-113-10/+16
| | |
| * | Rename "write" methods on tor-bytes to "write_infallible".Nick Mathewson2022-07-113-21/+21
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | This comprises four renames: ``` write_onto -> write_onto_infallible write_into -> write_into_infallible write -> write_infallible writer_and_consume -> write_and_consume_infallible. ``` The rest of this branch will be concerned with replacing these `_infallible` methods with ones that return a `Result`. This is part of #513.
* / tor-cell: Derive Eq for NtorV3ExtensionIan Jackson2022-07-181-1/+1
|/ | | | Apropos clippy complaint.
* Implement a higher-level API for the ntor v3 handshakeeta2022-07-082-0/+116
| | | | | | | | | | | | | | | | | | | This implements a higher-level API for the ntor v3 handshake, in line with that exposed by the ntor handshake. It does not, however, use the existing `ClientHandshake` trait, due to fundamental differences in the handshakes (namely, that the v3 handshake can include some additional extra extension data). Currently, the higher-level API assumes circuit extension, and copies the (undocumented!) magic verification string from c-tor that indicates this usage. A rudimentary set of functions for serializing and deserializing extensions to be sent with the handshake is also included, implementing the protocol in proposal 332 § A.2. Currently, it only implements the congestion control extensions specified in proposal 324 § 10.3. part of arti#88
* Merge branch 'clippy' into 'main'Ian Jackson2022-06-241-0/+3
|\ | | | | | | | | Fix clippy nightly again See merge request tpo/core/arti!603
| * Run maint/add_warning crates/*/src/{lib,main}.rsIan Jackson2022-06-231-0/+3
| | | | | | | | Update all lint blocks
* | Fix a couple of typos in rustdoc comments.Nick Mathewson2022-06-241-1/+1
|/
* tor-cell: convert BytesErr to a struct variantNick Mathewson2022-06-223-7/+21
|
* tor-cell: error usefulness and style fixesNick Mathewson2022-06-225-17/+25
|
* Do not include error source() in display() format.Nick Mathewson2022-06-211-3/+3
| | | | | | | | | According to doc/Errors.md, and in keeping with current best practices, we should not include display an error's `source()` as part of that error's display method. Instead, we should let the caller decide to call source() and display that error in turn. Part of #323.
* tor-bytes: read_nested_*: Take a closureIan Jackson2022-06-101-15/+11
| | | | | | | | | | This eliminates the possibility of writing the bug of failing to call `should_be_exhausted`. As per this discussion https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/572#note_2811464 Fixes #498
* tor-cell: udp: Remove manual length calculationsIan Jackson2022-06-091-20/+8
| | | | | This does away entirely with `wire_addr_len`, which recapitulates the length calculation.
* Merge branch 'less-servfail' into 'main'Ian Jackson2022-06-091-1/+2
|\ | | | | | | | | return nodata instead of servfail in some instances See merge request tpo/core/arti!564
| * try to differentiate transient from nontransient errortrinity-1686a2022-06-081-1/+2
| |
* | Fix a second docs linkIan Jackson2022-06-081-1/+1
| |
* | Fix a doc linkIan Jackson2022-06-081-1/+1
|/
* udp: New AddressPort used in cellsDavid Goulet2022-06-071-28/+59
| | | | Signed-off-by: David Goulet <[email protected]>
* udp: Allow empty hostname and no nul byteIan Jackson2022-06-071-11/+9
| | | | | | | | | | | | | | | 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 <[email protected]>
* cell: Don't use NUL terminated string in CONNECT_UDPDavid Goulet2022-06-071-16/+16
| | | | Signed-off-by: David Goulet <[email protected]>
* cell: Move UDP to its own module and feature gate itDavid Goulet2022-06-073-304/+34
| | | | | | Related to #463 Signed-off-by: David Goulet <[email protected]>
* cell: Implement DATAGRAM cell from prop339David Goulet2022-06-072-4/+67
| | | | | | | | Decoding and encoding of the DATAGRAM cell from proposal 339. Related to #463. Signed-off-by: David Goulet <[email protected]>
* cell: Implement CONNECTED_UDP cell from prop339David Goulet2022-06-071-5/+61
| | | | | | Decoding and encoding implemented according to proposal 339. Related to #463
* cell: Implement CONNECT_UDP cell from prop339David Goulet2022-06-073-3/+503
| | | | | | | | | Decoding and encoding is implemented according to proposal 339 specifications. Related to #463 Signed-off-by: David Goulet <[email protected]>
* lints: Add let_unit_value allow to all cratesIan Jackson2022-05-311-0/+1
| | | | | From running add_warning, with manual picking of the right hunks/lines.
* lints: Add lint block delimiters to every crateIan Jackson2022-05-311-0/+2
| | | | | | This was the result of: maint/add_warning crates/*/src/{lib,main}.rs and then manually curating the results.
* clippy: Use write! rather than push_str, formatIan Jackson2022-05-111-2/+3
| | | | | This does involve unwrap, but of course that can't fail unless the formats fail, which would already panic (that's implied by format!).
* squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-252-2/+0
| | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* tor-proto: add a backend to detect reported clock skew.Nick Mathewson2022-03-231-2/+14
| | | | | | | | | | | | | | | | NETINFO cells, which are sent in every handshake, may contain timestamps. This patch adds an accessor for the timestamp in the Netinfo messages, and teaches the tor-proto code how to compute the minimum clock skew in the code. The computation isn't terribly precise, but it doesn't need to be: Tor should work fine if your clock is accurate to within a few hours. This patch also notes a Y2038 problem in the protocol: see torspec#80. Part of #405.
* Merge branch 'educe-traits' into 'main'Ian Jackson2022-03-042-12/+9
|\ | | | | | | | | Replace many manual trait impls with use of educe See merge request tpo/core/arti!375
| * Move skip_fmt into tor-basic-utilsIan Jackson2022-03-041-1/+2
| | | | | | | | | | | | | | Code motion and the minimal mechanical changes. As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/375#note_2783078
| * Replace manual Default impl with educe in tor-cellIan Jackson2022-03-021-6/+4
| |