summaryrefslogtreecommitdiff
path: root/crates/tor-cell/src/chancell
Commit message (Collapse)AuthorAgeFilesLines
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* Merge branch 'test-lints' into 'main'eta2023-01-061-0/+9
|\ | | | | | | | | Add test lint blocks to all "mod test" See merge request tpo/core/arti!937
| * test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+9
| | | | | | | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* | msg::{CreateFast/CreatedFast}: Rename accessor to (into_)body()Neel Chauhan2022-12-181-2/+2
|/
* Fix typosDimitris Apostolou2022-11-061-1/+1
|
* Merge branch 'rename_for_to_from' into 'main'Nick Mathewson2022-10-251-2/+2
|\ | | | | | | | | tor-cell: Rename for_client and for_relay See merge request tpo/core/arti!793
| * tor-cell: Rename for_client and for_relayEmil Engler2022-10-211-2/+2
| | | | | | | | | | | | | | This commit renames the for_client and for_relay functions to from_client and from_relay respectively, in order to indicate their origin, as the term "for" is more likely to indicate a destination, which is not true in that situation.
* | Merge branch 'fix_typos' into 'main'eta2022-10-211-3/+3
|\ \ | | | | | | | | | | | | tor-cell: Fix typos in msg.rs See merge request tpo/core/arti!788
| * | tor-cell: Fix typos in msg.rsEmil Engler2022-10-211-3/+3
| |/
* | Merge branch 'remove_redundant' into 'main'eta2022-10-211-2/+0
|\ \ | | | | | | | | | | | | tor-cell: Remove redundant match clauses See merge request tpo/core/arti!792
| * | tor-cell: Remove redundant match clausesEmil Engler2022-10-211-2/+0
| |/ | | | | | | | | This commit removes two redundant match clauses inside the take_one_netinfo_addr function found inside msg.rs.
* | Merge branch 'concrete_comments' into 'main'eta2022-10-211-3/+6
|\ \ | | | | | | | | | | | | tor-cell: Make historical comments more concrete See merge request tpo/core/arti!787
| * | tor-cell: Make historical comments more concreteEmil Engler2022-10-211-3/+6
| |/ | | | | | | | | This commit extends comments that make references to historical protocol versions of Tor, by adding the concrete protocol version numbers.
* | Merge branch 'no_redundant_copy' into 'main'Ian Jackson2022-10-211-2/+2
|\ \ | | | | | | | | | | | | tor-cell: Avoid redundant pointer copy See merge request tpo/core/arti!791
| * | tor-cell: Avoid redundant pointer copyEmil Engler2022-10-211-2/+2
| |/ | | | | | | | | | | This commit changes an iteration by copying a u16 (which is 2 bytes) instead of a pointer address, which is most likely 8 bytes on most machines.
* | Merge branch 'no_redundant_allocation' into 'main'Nick Mathewson2022-10-211-1/+1
|\ \ | | | | | | | | | | | | tor-cell: Avoid redundant allocation See merge request tpo/core/arti!790
| * | tor-cell: Avoid redundant allocationEmil Engler2022-10-211-1/+1
| |/ | | | | | | | | | | This commit changes the way how a vector with a known sized gets allocated, by using Vec::with_capacity() instead of Vec::new(). It will eventually avoid an allocation of more memory than required.
* / tor-cell: Rename fixed_len to fixed_len_handshakeEmil Engler2022-10-211-7/+7
|/ | | | | | This commit renames the fixed_len! macro to fixed_len_handshake!, in order to indicate, that this macro is only suited for cells with commands related to handshaking.
* 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.
* tor-cell: Stop using write_infallibleNick Mathewson2022-07-111-14/+31
| | | | Also, stop using "expect" and "assert!" to check for errors.
* tor-cell: Make encoding method signatures fallible.Nick Mathewson2022-07-112-24/+40
|
* tor-cell: convert BytesErr to a struct variantNick Mathewson2022-06-222-3/+8
|
* tor-cell: error usefulness and style fixesNick Mathewson2022-06-222-5/+11
|
* squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-251-1/+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-041-6/+5
|\ | | | | | | | | 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 Debug impl with educe in tor-cellIan Jackson2022-03-021-7/+5
| |
* | Replace manual Default impl with std derive in tor-cellIan Jackson2022-03-021-6/+1
|/
* Merge branch 'clippy-followup' into 'main'Nick Mathewson2022-02-171-3/+3
|\ | | | | | | | | Remove some needless refs and slicing See merge request tpo/core/arti!327
| * Remove some needless refs and slicingIan Jackson2022-02-171-3/+3
| | | | | | | | | | Prompted by nightly's clippy (which has some false positives, so is currently disabled).
* | tor-cell: provide HasKind.Nick Mathewson2022-02-151-2/+3
|/ | | | | | | | | Additionally, refactor the IoError out of tor_cell::Error: nothing in TorCell created this; it was only used by tor_proto. This required refactoring in tor_proto to use a new error type. Here I decided to use a new CodecError for now, though we may refactor that away soon too.
* tor-cell: replace an XXXX with a TODO.Nick Mathewson2021-12-161-1/+6
| | | | | The original comment was a gnomic question about what to box; the real issue is that we want to avoid copying data in our critical path.
* Extend trace messages for destroy/truncated reasons.Nick Mathewson2021-12-151-0/+40
| | | | | | | | | | | | It makes sense to put the method for human-readable strings onto the type itself, so that we can format these whenever they occur. I'm choosing the "human_str" method name here, since caret-generated types already have a to_str. I was thinking about using Display, but caret types already implement that. I've also moved the message from "warn!" to "debug!", since these aren't necessarily a problem condition.
* s/hidden/onion/g in code commentsNeel Chauhan2021-12-131-1/+1
|
* Resolve roughly half of the XXXXs.Nick Mathewson2021-12-061-3/+3
| | | | | | | | We want to only use TODO in the codebase for non-blockers, and open tickets for anything that is a bigger blocker than a TODO. These XXXXs seem like definite non-blockers to me. Part of arti#231.
* add semicolons if nothing returnedDaniel Eades2021-11-251-5/+5
|
* deglob some enums, use concise iteration syntaxDaniel Eades2021-11-251-4/+4
|
* enable checked_conversions lint.Nick Mathewson2021-10-091-6/+19
|
* Document every macro.Nick Mathewson2021-09-071-1/+2
| | | | | (The nightly version of clippy now includes macros for its missing_docs_in_private_items lint.)
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-272-0/+1243
This will cause some pain for now, but now is really the best time to do this kind of thing.