aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-cell/src/relaycell/udp.rs
Commit message (Collapse)AuthorAgeFilesLines
* cell, proto: Use correct Data sizes for v1 relay cellsNick Mathewson2025-04-161-1/+1
| | | | | | | | | | | | Since v1 cells have a longer tag, they can fit less data into a single cell. Ah well, that's the cost of improved security. The code in data.rs is a little wonky, in that it currently requires its buffer to be exactly the maximum size for a data cell. We have a TODO about fixing that in the future, but for now I've moved it to use a boxed slice rather than a boxed array. Part of #1944.
* Note some places where we need updates for #1944.Nick Mathewson2025-04-161-0/+7
| | | | (Also note a couple of other CGO-related issues)
* Some HasMemoryCost impls in tor-cellIan Jackson2024-10-021-5/+12
|
* Change tor_bytes::Error::BadMessage to a Cow.Nick Mathewson2023-02-091-5/+5
| | | | | | | | | | Actually, to avoid making a breaking change, I'm deprecating BadMessage and creating a new InvalidMessage variant that takes a Cow. This way I don't need to track every crate that re-exposes tor_bytes::Error and call this a breaking change in those. Making this change will allow tor_bytes errors to be much more helpful.
* tor-cell: Have restrict_msg add conversion functions.Nick Mathewson2023-02-091-12/+0
| | | | | | | | | | | | | | | | Every FooMsg type now implements Into<AnyFooMsg>, and TryFrom<FooMsg>. Additionally, it now implements From<X> for every distinct type that it supports. This last part lets us discard a bunch of code. Unfortunately, I needed some downright hackish trickery in order to get these macros to avoid generating `From<AnyFooMsg> for AnyFooMsg` and conflicting with the blanket implementation. The trickery to deal with RelayEarly and Relay being the same type was not necessarily worth it; I will be separating them and removing said trickery in the next commit.
* tor-cell: Rename RelayMsg and RelayCell-related types.Nick Mathewson2023-02-071-6/+6
| | | | Thanks to rust-analyzer for making this simple.
* tor-cell: Make Body and MsgClass traits more uniform.Nick Mathewson2023-02-071-4/+4
| | | | | | | | Doing this will make it much easier to implement a macro that generates restricted instances of the Msg types (for #525). The Body change is a breaking change. I don't think anybody else implements Body, but in theory they could.
* tor-cell: Stop using write_infallibleNick Mathewson2022-07-111-6/+6
| | | | Also, stop using "expect" and "assert!" to check for errors.
* tor-cell: Make encoding method signatures fallible.Nick Mathewson2022-07-111-3/+6
|
* Convert each write_onto_infallible implementation into write_onto.Nick Mathewson2022-07-111-4/+5
|
* Rename "write" methods on tor-bytes to "write_infallible".Nick Mathewson2022-07-111-8/+8
| | | | | | | | | | | | | | | 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.
* Fix a couple of typos in rustdoc comments.Nick Mathewson2022-06-241-1/+1
|
* tor-cell: error usefulness and style fixesNick Mathewson2022-06-221-2/+4
|
* 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.
* 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-071-1/+1
| | | | | | Related to #463 Signed-off-by: David Goulet <[email protected]>
* cell: Implement DATAGRAM cell from prop339David Goulet2022-06-071-0/+1
| | | | | | | | Decoding and encoding of the DATAGRAM cell from proposal 339. Related to #463. Signed-off-by: David Goulet <[email protected]>
* cell: Implement CONNECT_UDP cell from prop339David Goulet2022-06-071-0/+302
Decoding and encoding is implemented according to proposal 339 specifications. Related to #463 Signed-off-by: David Goulet <[email protected]>