summaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* Allow clippy::collapsible_if to triggerGabriela Moldovan2026-02-161-0/+1
| | | | | | | | | `clippy::collapsible_if` started triggering after bumping the MSRV to 1.88. Since this triggers from a lot of places, and since there even are a couple of instances where we explicitly allow `clippy::collapsible_ifs`, I've opened #2342 for deciding what to do about it.
* maint/add_warning: Run script to add new warningGabriela Moldovan2026-01-271-0/+1
| | | | This adds the lint to all our crates.
* tor-netdoc: Provide AuthCertConstructorIan Jackson2026-01-131-1/+0
|
* tor-netdoc: test2: implement encoding traits for all test typesIan Jackson2025-12-101-1/+1
| | | | | | | Make this whole module conditional on the encode feature. Apply the derives. Provide the necessary manual implementations for the types where we use `with`.
* tor-netdoc: Break out netdoc_ordering_check into new derive_common.rsIan Jackson2025-12-101-0/+3
|
* tor-netdoc: Drop the allow(unused)Ian Jackson2025-12-101-1/+0
| | | | Now we use all the imports. We're still adding much code, though.
* tor-netdoc: Add imports to encode module, for new encode deriveIan Jackson2025-12-101-0/+2
| | | | | Adding these all at the beginning helped me with churn in this branch. The allow(unused) will go away again shortly.
* tor-netdoc: Move parse2/test.rs to test2.rsIan Jackson2025-11-241-0/+3
| | | | | | | We're going to use this for the encoder testing too, so it needs to be not buried inside parse2. This commit is the file rename plus minimal changes to make it compile.
* tor-netdoc: Make much more of the encode module contents publicIan Jackson2025-11-181-1/+1
| | | | | My planned new derive for encoding will be pub, but cfg gated, like parse2 is.
* tor-netdoc: Implement KeywordEncodable for &'static strIan Jackson2025-11-181-0/+6
| | | | | | | | | | My planned encoding derive macro is going to provide keywords as literal strings. (The purpose of this trait is to allow the old parser to be generic over its keyword constants, not to provide type-safety against passing non-keyword strings to document encoders. Such bugs aren't very likely and will be especially unlikely when we're deriving encoders.)
* tor-netdoc: Split off Keyword::to_str into its own traitIan Jackson2025-11-181-0/+8
| | | | | My planned encoding derive macro is not going to use `decl_keyword!` but will need to call `NetdocEncoder::item`.
* tor-netdoc: Introduce "encode" feature for the like-named moduleIan Jackson2025-11-101-3/+3
| | | | | | | We're going to introduce facilities for encoding more generally, and we'll want a way to enable them. Instead, have a separate feature for *encoding* documents.
* tor-netdoc: Rename the `build` module to `encode`Ian Jackson2025-11-101-2/+2
| | | | | The word "build" so often in Rust means builder pattern. This module contains functions for encoding.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-2/+2
| | | | Run maint/add_warning
* tor-netdoc: Reference `build::ItemArgument` from `NoramlItemArgument` docIan Jackson2025-10-211-1/+2
| | | | | | Since 9ce85acb3ab0d1a0b1be6ef0f10707983f4362a3 tor-netdoc: replace impl_item_argument_as_display with NormalItemArgument this trait impl has implications for encoding as well as parsing.
* tor-netdoc: Introduce `NormalItemArgument` impl-enabler traitIan Jackson2025-10-081-0/+28
| | | | | This is currently used to enable `parse2::ItemArgumentParseable`. In a moment it will enable `build::ItemArgument` too.
* Remove "doc_auto_cfg" incantation from all crates.Nick Mathewson2025-09-291-1/+1
| | | | This feature has been removed from nightly, in favor of doc_cfg.
* neteoc parse2: Import earlierIan Jackson2025-09-291-2/+3
| | | | | This is needed if we want to use these macros in `doc`, which we're going to.
* tor-netdoc: Introduce parse2, new parserIan Jackson2025-08-141-0/+5
| | | | | This isn't used anywhere yet. We're going to demonstrate it, and test the demo, in a moment.
* Temporarily suppress mismatched_lifetime_syntaxes.Gabriela Moldovan2025-07-071-0/+1
| | | | See #2060.
* protover, *: Add documentation about what "supported" means.Nick Mathewson2025-04-161-1/+2
|
* Add warnings about removing supported protocols.Nick Mathewson2025-04-161-0/+2
|
* New functions to report supported subprotocolsNick Mathewson2025-04-161-0/+41
| | | | | | | | | | | | | | | Part of #1849. Note that these functions are distributed across crates, so that if (in the future) we stop doing API breaks with every release, we will get the right outputs. Note also that these functions build the list of protocols out of specific symbolic features, rather than numbers: this makes it easier to avoid errors about "which feature was Relay=4 again", and easier to avoid accidentally referring to a protocol that doesn't exist, like "Consensus" (should be "Cons") or "HsDir" (case is wrong).
* clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* Disable a lot of dead code warningsIan Jackson2024-10-171-0/+3
| | | | | | | Now cargo check --workspace --no-default-features --all-targets cargo build -p arti --no-default-features --features=memquota,tokio,native-tls are both clean.
* 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
|
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* 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
|
* netdoc: Rename `ParseError{Kind, Source}` to `NetdocError{Kind, Source}`.Gabriela Moldovan2023-05-101-1/+1
| | | | | | | | | | | `ParseErrorSource` was originally meant to represent a parsing error, this enum has since gained some variants that aren't really parsing related (`Signature`, `CertSignature`, `UntimelyDescriptor`). Since this error type is now used for general-purpose netdoc errors, let's rename `ParseError{Kind, Source}` to `NetdocError{Kind, Source}`. Signed-off-by: Gabriela Moldovan <[email protected]>
* Remove `NetdocText` and replace its uses with `String`.Gabriela Moldovan2023-03-241-1/+1
| | | | | | | | `NetdocText` is a wrapper around a `String` and a type marker. The type annotation proved of limited use, and made the netdoc builder API somewhat awkward to use. Signed-off-by: Gabriela Moldovan <[email protected]>
* Add builder for encoding hidden service descriptors.Gabi Moldovan2023-03-241-1/+1
| | | | | | | | | | | | | | This introduces the `NetdocBuilder` trait described in `netdoc-builder.md` and a new `tor-netdoc::doc::hsdesc::build` module, which exports the `HsDescBuilder`. Hidden services will use `HsDescBuilder` to build and encode hidden service descriptors. There are several TODOs in the code that I'm planning to address separately. Partially addresses #745. Signed-off-by: Gabriela Moldovan <[email protected]>
* Rename onion-* cargo features to hs-* in tor-* cratesIan Jackson2023-02-281-3/+3
| | | | Fixes #756
* tor-netdoc: Provide new batching_split_beforeIan Jackson2023-02-101-0/+5
| | | | | | | | | | | | There will be two call sites to demonstrate it. Eventually maybe this will want to be in tor-basic-utils, since it doesn't depend on any of the tor-netdoc types. But it would be sensible to wait until the situation with PeekableIterator and Itertools is improved. For now we make this #[doc(hidden)] to avoid it becoming part of our stable API.
* 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.
* Add missing docsrs attributeIan Jackson2023-01-241-0/+1
|
* netdoc-builder api: Move internal API into actual code fileIan Jackson2023-01-241-0/+5
| | | | Motion, plus the bare minimum needed to make it compile.
* 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-51/+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
|
* Run maint/add_warning crates/*/src/{lib,main}.rsIan Jackson2022-06-231-0/+3
| | | | Update all lint blocks
* 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.
* Resolve the new `derive_partial_eq_without_eq` lint.Nick Mathewson2022-05-231-1/+1
| | | | It's a little overzealous sometimes, but it's mostly to the good.
* 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.
* Merge branch 'doc-errors' into 'main'Nick Mathewson2022-02-151-1/+5
|\ | | | | | | | | Refactor errors in tor-netdoc See merge request tpo/core/arti!314