aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-proto: Add benchmarks for cell encryption and decryptionLionel Goffaux2024-11-041-0/+1
|
* Disable a lot of dead code warnings (fmt)Ian Jackson2024-10-171-1/+4
|
* Disable a lot of dead code warningsIan Jackson2024-10-171-1/+1
| | | | | | | Now cargo check --workspace --no-default-features --all-targets cargo build -p arti --no-default-features --features=memquota,tokio,native-tls are both clean.
* tor-proto: Make circuit->channel queues participate in memquotaIan Jackson2024-10-031-0/+28
| | | | | | | | We use the *channel*'s memquota account. This is arguably wrong, but it's hard to get right now. See #1652. Change the type of the queue, and the places it's constructed. The use sites can all stay the same.
* Provide newtypes to distinguish memoquota accounts at different levelsIan Jackson2024-10-031-0/+4
|
* tor-proto: Allow all dead code if not all features enabledIan Jackson2024-09-301-5/+2
| | | | | | | | | | | | | | | | | | Fixes cargo check -p tor-chanmgr --all-features --all-targets which otherwise prints warning: method `reply` is never used --> crates/tor-proto/src/crypto/handshake.rs:73:8 | 65 | pub(crate) trait AuxDataReply<H> | ------------ method in this trait ... 73 | fn reply(&mut self, msg: &H::ClientAuxData) -> Option<H::ServerAuxData>; | ^^^^^ | = note: `#[warn(dead_code)]` on by default
* Rename OptTimestamp to AtomicOptTimestampNeel Chauhan2024-06-241-1/+1
|
* Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | This commit is automatically generated.
* deny clippy::unchecked_duration_subtractiontrinity-1686a2024-02-291-0/+1
|
* Add cfg_attr allow(unused_imports) to two cratesIan Jackson2023-10-311-0/+6
| | | | | As per this comment, and preceding discussion https://gitlab.torproject.org/tpo/core/arti/-/issues/1060#note_2959187
* tor-proto: Add a HopNum::display function.Gabriela Moldovan2023-08-251-1/+1
| | | | | | | | | This function can be used to display a more user-friendly representation of a `HopNum`. This will print hop numbers as 1-indexed values: #1, #2, etc.. We will soon remove HopNum's Display implementation in favour of `.display()`.
* Merge branch 'future_proof_lints' into 'main'gabi-2502023-08-041-2/+2
|\ | | | | | | | | | | | | add_warning: Change missing_docs,unreachable_pub to warn Closes #951 See merge request tpo/core/arti!1470
| * Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
| |
* | tor-proto: Make HopNum public.Gabriela Moldovan2023-08-041-0/+1
|/ | | | | | `HopNum` will be used in `ClientCirc`'s public API when we refactor `ClientCirc::start_conversation_last_hop` to use the provided hop rather than always using the last one.
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
| | | | Closes #950.
* lints: Run maint/add_warning to actually apply new lintsIan Jackson2023-06-211-0/+2
|
* Disable clippy::unlinlined-format-argsNick Mathewson2023-01-271-0/+1
| | | | | | | | This warning kind of snuck up on us! (See #748) For now, let's disable it. (I've cleaned it up in a couple of examples, since those are meant to be more idiomatic and user-facing.) Closes #748.
* Run add_warnings.Nick Mathewson2022-11-031-0/+1
|
* cargo fmt to remove blank linesIan Jackson2022-10-121-1/+0
| | | | | | | Apparently cargo fmt doesn't like these, which my perl rune didn't delete. This commit is precisely the result of `cargo fmt`.
* Replace all README copies in src/lib.rs with includesIan Jackson2022-10-121-99/+1
| | | | | | | | The feature we want is `#[doc = include_str!("README.md")]`, which is stable since 1.54 and our MSRV is now 1.56. This commit is precisely the result of the following Perl rune: perl -i~ -0777 -pe 's{(^//!(?!.*\@\@).*\n)+}{#![doc = include_str!("../README.md")]\n}m' crates/*/src/lib.rs
* enable doc_auto_cfg feature on every crate when documenting for docs.rstrinity-1686a2022-08-241-0/+1
|
* Rename ChannelsParams types to ChannelPaddingInstructionsIan Jackson2022-08-171-1/+1
| | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826167 This makes some lines too long; I will run rustfmt in a separate commit for clarity.
* tor-proto: Add a comment about the tor-proto layer.Nick Mathewson2022-08-101-0/+18
| | | | | | | | | We want to clarify that the tor-proto crate should only know _how_ its objects behave, not _why they behave that way_. (In other words, we can have a "padding strategy" setting on a channel, but not a "general usage" setting.) Closes #531.
* Clarify that tor-proto _does_ create timers.Nick Mathewson2022-08-101-4/+2
|
* tor-proto: Replace SecretBytes with SecretBuf.Nick Mathewson2022-08-011-3/+0
| | | | | | | | | | This does not yet make sure that `SecretBuf` is used where it _should_ be, but at least it ensures that most uses of `SecretBytes` will indeed act as intended, and make sure that whatever they contain is zeroized. It requires some corresponding changes to method calls for correctness and type conformance.
* Run maint/add_warning crates/*/src/{lib,main}.rsIan Jackson2022-06-231-0/+3
| | | | Update all lint blocks
* channel padding: Rename ChannelsParams from ChannelsConfigIan Jackson2022-06-211-1/+1
| | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2814276 Change names and comments and docs everywhere.
* channel padding: Plumb settings from chanmgrIan Jackson2022-06-211-0/+2
|
* try to differentiate transient from nontransient errortrinity-1686a2022-06-081-1/+1
|
* 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: Change a binding to (), and allow clippy::let_unit_valueIan Jackson2022-05-111-0/+1
| | | | | | | | | | | | | | | | | The type of ret.map_err(codec_err_to_chan)? is (). ISTM that writing `let () = ` makes it clear that there is nothing there, but the lint forbids this. This lint is warn by default and trips here for me on current nightly. It seems wrong to me. We should be able to make it clear to the reader that there is nothing here - note how this differs from the lines below where Ready contains msg. A let () binding is a good way to do that. I think the lint allow ought to be added everywhere, but that doesn't seem easy right now - see this issue about maint/add_warning: https://gitlab.torproject.org/tpo/core/arti/-/issues/469
* tor-proto: add a backend to detect reported clock skew.Nick Mathewson2022-03-231-0/+1
| | | | | | | | | | | | | | | | 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 'clippy-allow-arc-clone' into 'main'Nick Mathewson2022-03-011-1/+0
|\ | | | | | | | | Disable clippy::clone_on_ref_ptr See merge request tpo/core/arti!352
| * Disable clippy::clone_on_ref_ptrIan Jackson2022-02-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lint is IMO inherently ill-conceived. I have looked for the reasons why this might be thought to be a good idea and there were basically two (and they are sort of contradictory): I. "Calling ‘.clone()` on an Rc, Arc, or Weak can obscure the fact that only the pointer is being cloned, not the underlying data." This is the wording from https://rust-lang.github.io/rust-clippy/v0.0.212/#clone_on_ref_ptr It is a bit terse; we are left to infer why it is a bad idea to obscure this fact. It seems to me that if it is bad to obscure some fact, that must be because the fact is a hazard. But why would it be a hazard to not copy the underlying data ? In other languages, faliing to copy the underlying data is a serious correctness hazard. There is a whose class of bugs where things were not copied, and then mutated and/or reused in multiple places in ways that were not what the programmer intended. In my experience, this is a very common bug when writing Python and Javascript. I'm told it's common in golang too. But in Rust this bug is much much harder to write. The data inside an Arc is immutable. To have this bug you'd have use interior mutability - ie mess around with Mutex or RefCell. That provides a good barrier to these kind of accidents. II. "The reason for writing Rc::clone and Arc::clone [is] to make it clear that only the pointer is being cloned, as opposed to the underlying data. The former is always fast, while the latter can be very expensive depending on what is being cloned." This is the reasoning found here https://github.com/rust-lang/rust-clippy/issues/2048 This is saying that *not* using Arc::clone is hazardous. Specifically, that a deep clone is a performance hazard. But for this argument, the lint is precisely backwards. It's linting the "good" case and asking for it to be written in a more explicit way; while the supposedly bad case can be written conveniently. Also, many objects (in our codebase, and in all the libraries we use) that are Clone are in fact simply handles. They contain Arc(s) (or similar) and are cheap to clone. Indeed, that is the usual case. It does not make sense to distinguish in the syntax we use to clone such a handle, whether the handle is a transparent Arc, or an opaque struct containing one or more other handles. Forcing Arc::clone to be written as such makes for code churn when a type is changed from Arc<Something> to Something: Clone, or vice versa.
* | Make coarsetime dependency and traffic-timestamping non-optional.Nick Mathewson2022-02-251-8/+1
|/ | | | | | | | | | | | | | Previously coarsetime and the traffic-timestamp feature were enabled, since they were only required for a small corner of the guardmgr algorithm. But in 1.0 and beyond we'll be adding a bunch of other features (eg, netflow padding, DoS prevention) that will need coarsetime all over the place. And since we're going to be doing coarsetime all over the place, the previous justification for making traffic-timestamping optional (the tiny performance hit) is no longer relevant.
* Remove clippy::needless_borrow exception in CI.Nick Mathewson2022-02-201-1/+0
| | | | | This exception is no longer necessary now that the underlying CI bug is fixed.
* Change deny(clippy::all) to warn(clippy::all).Nick Mathewson2022-02-141-1/+1
| | | | Closes #338.
* Remove the use of Mutex in channel unused_since timestampYuan Lyu2022-02-081-3/+5
|
* Temporarily disable some clippy lints on nightlyIan Jackson2022-02-021-0/+1
|
* Remove a now-incorrect comment in tor-proto.Nick Mathewson2022-01-261-3/+0
|
* extend lints to include 'clippy::all'Daniel Eades2021-12-281-0/+1
|
* add semicolons if nothing returnedDaniel Eades2021-11-251-0/+1
|
* Use coarsetime to build an incoming traffic timestamp.Nick Mathewson2021-11-021-0/+33
| | | | | | | | | | | | | | | | We need this for the circuit timeout estimator (#57). It needs to know "how recently have we got some incoming traffic", so that it can tell whether a circuit has truly timed out, or whether the entire network is down. I'm implementing this with coarsetime, since we need to update these in response to every single incoming cell, and we need the timestamp operation to be _fast_. (This reinstates an earlier commit, f30b2280, which I reverted because we didn't need it at the time.) Closes #179.
* Replace references to arti-client in the documentation.Nick Mathewson2021-10-211-2/+2
|
* Remove #![allow(clippy::unnecessary_wraps)] in tor-proto.Nick Mathewson2021-10-211-1/+0
|
* enable checked_conversions lint.Nick Mathewson2021-10-091-0/+1
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+129
This will cause some pain for now, but now is really the best time to do this kind of thing.