Nick Mathewson
14417dc098
Add a TODO about combining several macros and patterns
2023-02-16 08:25:12 -05:00
Ian Jackson
b4e48b0695
Make a comment more accurate
2023-02-16 13:19:04 +00:00
Ian Jackson
66beab6c9e
tor-netdoc: Fix doc comment following removal of PauseAt
2023-02-16 11:53:32 +00:00
Nick Mathewson
943e4414fe
Merge branch 'max-min' into 'main'
...
Expire routerdescs as soon as any of their expiries expire
Closes #772
See merge request tpo/core/arti!1022
2023-02-16 01:09:56 +00:00
Ian Jackson
ca127b013f
Expire routerdescs as soon as any of their expiries expire
...
Fixes #772
2023-02-15 17:41:28 +00:00
Ian Jackson
676241c349
tor-netdoc: Run rustfmt (separately from the refactoring)
2023-02-15 17:17:01 +00:00
Ian Jackson
1993165f22
tor-netdoc: Abolish NetDocReader::iter and into_iter
...
Nothing uses these now; the NetDocReader is simply an iterator, itself.
2023-02-15 17:17:01 +00:00
Ian Jackson
4a91c732fe
tor-netdoc: Remove many needless calls to .iter() and .into_iter()
2023-02-15 17:17:01 +00:00
Ian Jackson
fa2e164939
tor-netdoc: Use impl Iterator for NetdocReader in .pause_at
...
This simplifies the return type!
2023-02-15 17:17:01 +00:00
Ian Jackson
db79e3f369
tor-netdoc: impl Iterator etc. for NetdocReader
...
This will simplify things at many call sites.
2023-02-15 17:17:01 +00:00
Ian Jackson
b58977b428
tor-netdoc: move PeekableIterator to util.rs
...
We're going to want this a bit more widely.
2023-02-15 17:17:01 +00:00
Ian Jackson
11660f84b0
tor-netdoc: Delete now-unused PauseAt type
2023-02-15 17:17:01 +00:00
Ian Jackson
15d93bd642
tor-netdoc: Use itertools to implement NetDocReader::pause_at
...
This is the last use of PauseAt.
2023-02-15 17:17:01 +00:00
Ian Jackson
089ebb7d11
tor-netdoc: Replace use of PauseAt::new_pred()
...
We can just make a new PauseAt, since it can take the inner peekable
iterator by mutable reference.
This seems to tidy the code up a bit too.
2023-02-15 17:16:57 +00:00
Ian Jackson
7491424ee9
tor-netdoc: Have sectionrules.parse take I, not &mut I
...
There's a blanket impl of Itertor for &mut impl Iterator, so this
isn't necessary, and it prevents us passing iterators by value
producing syntactic vinegar.
2023-02-15 17:16:57 +00:00
Ian Jackson
80d8d94c96
tor-netdoc: Import Peekable rather than referring to it by path
...
This makes things easier to read. We're about to add another
site (albeit, temporarily).
2023-02-15 17:16:57 +00:00
Nick Mathewson
0f2218f4d3
Merge branch 'ticket_525_part3_take2' into 'main'
...
Finish #525 for relay messages: Only parse messages at the last instant.
Closes #773 and #525
See merge request tpo/core/arti!1017
2023-02-15 16:35:27 +00:00
Nick Mathewson
19c0dd153a
tor-proto: Add a TODO about simplifying a common pattern.
2023-02-15 10:51:03 -05:00
Nick Mathewson
21db73f182
tor-cell: add a TODO comment about simplifying Body away.
2023-02-15 10:48:19 -05:00
Nick Mathewson
fce1c83f2e
tor-cell: Add another debug_assert to relay cell encoding
2023-02-15 10:48:19 -05:00
Nick Mathewson
5d28e9e7d0
slicewriter: rename a local variable.
2023-02-15 10:48:19 -05:00
Nick Mathewson
19c9593acf
Move slicewriter to tor-cell and make it private.
...
Also, add some comments about how it is likely to change.
2023-02-15 10:48:19 -05:00
Nick Mathewson
1ee6bfa59c
tor-proto: note implications for future HS work
2023-02-15 10:48:19 -05:00
Nick Mathewson
41b50b6c56
tor-proto: Push stream message parsing into the stream objects.
...
This closes #525 , and ensures, at last, that we don't parse any
message that we wouldn't accept.
2023-02-15 10:48:19 -05:00
Nick Mathewson
58c3b8276c
tor-proto: Defer parsing of messages send to half-closed streams
...
This includes a partial solution for #769 , but also turned up
another bug (#774 ) while I was working on it. I'll close them both
once I have a real solution.
2023-02-15 10:48:19 -05:00
Nick Mathewson
bd0f6f5adf
tor-proto: stop reactor (and kill circuit) if meta handler fails
...
If the meta handler reports an error, then the circuit has violated
its protocol, and needs to be shut down.
Fixes #773 .
2023-02-15 10:48:19 -05:00
Nick Mathewson
2e483124cb
tor-proto: defer meta-cell parsing to the last moment.
2023-02-15 10:48:19 -05:00
Nick Mathewson
0765243f5e
tor-proto: Use UnparsedRelayCell to start deferring cell processing.
...
In general, we want to avoid parsing these cells until we are
fairly sure that they are something we would accept.
2023-02-15 10:48:19 -05:00
Nick Mathewson
e4bc7ef57b
tor-cell: Add RelayCell::into_msg.
2023-02-15 10:48:19 -05:00
Nick Mathewson
3f1457ea04
tor-cell: Implement {Relay,Chan}Msg for every body type
...
This will make it ergonomic to decode a single body type without
having to declare a variant that accepts only a single message.
2023-02-15 10:48:19 -05:00
Nick Mathewson
65cc7d0974
tor-cell: Note an opportunity for future optimization
2023-02-15 10:48:19 -05:00
Nick Mathewson
a809a809ba
tor-cell: Add a new UnparsedRelayCell
...
We'll use this to router relay messages on a circuit to the
appropriate stream, and hand them to that stream, without parsing
the message until the stream has been determined.
2023-02-15 10:48:19 -05:00
Nick Mathewson
ca3b33a1af
tor-cell: Refactor relay cells to copy much less
...
We now manipulate raw relay cell bodies as (an alias for)
`Box<[u8;509]>` rather than as (an alias for) `[u8;509]`. This
enables us to do much less copying. It will become more important
soon, as we defer parsing relay cell bodies even longer.
Related to #7 .
We also use SliceWriter to avoid allocating a Vec<> for every relay
message we want to encode, and instead encode directly into the
cell.
2023-02-15 10:48:19 -05:00
Nick Mathewson
9e2b6f3aed
tor-bytes: Add a new writer implementation for fixed-size objects
...
Because the API assumes that many writes are infallible, this writer
takes ownership of the backing object, and will only return it to
you if you didn't run over the end.
I'm going to use this to save some allocations in relay cell bodies
2023-02-15 10:48:19 -05:00
Nick Mathewson
5521df0909
tor-cell: Use a more generic mechanism for managing extensions
...
Several HS message types have an extension list type. They all use
the same framing for extensions, but each of them has separate
extension types and separate extension namespaces.
This commit simplifies establish_intro a little, and adds support
for maintaining unrecognized extension types--at the expense of some
new internal code.
2023-02-15 08:44:43 -05:00
Ian Jackson
dccb641354
Merge branch 'fuzz-hsdesc' into 'main'
...
Fuzzing for hsdesc parsers
See merge request tpo/core/arti!1018
2023-02-15 12:47:38 +00:00
Nick Mathewson
37fcb0ca7c
tor-cell: Extract establish-intro into its own module.
...
Some of the HS message types have a lot of dependent types, like
extensions and options for those extensions, and so on. Except when
those extensions are portable across cell types, it makes sense
to put them in their own modules.
2023-02-15 07:46:36 -05:00
Nick Mathewson
5c85397bb7
tor-cell: rename onion_service module to hs
2023-02-15 07:38:19 -05:00
eta
c10741bac2
Merge branch 'upgrade_toml' into 'main'
...
Upgrade to latest toml crate.
See merge request tpo/core/arti!1019
2023-02-15 12:15:40 +00:00
Nick Mathewson
f1ec64bfe5
Upgrade to latest toml crate.
...
(None of the breaking changes affect us this time.)
2023-02-14 11:06:00 -05:00
Nick Mathewson
424b2ae4a5
Bump to new arti-corpora, with hsdesc cases.
2023-02-14 10:59:25 -05:00
Nick Mathewson
e00dfcf41e
netdoc: Add a basic fuzzer for the hsdesc layers.
...
I've been running this for 5 minutes and haven't found any
crashes. I'll run it for an hour or two, then add the results to the
corpus repository.
2023-02-14 07:49:34 -05:00
Nick Mathewson
79dd2ef995
netdoc: Add a feature to expose hsdesc inner doc parsers
...
We want to fuzz these parsers, but there's no currently way to get
at the parsers for inner documents without going through a lot of
encryption. (Coverage-guided fuzzers are powerful, but they
can't find SHA3 preimages.)
2023-02-14 07:44:18 -05:00
Nick Mathewson
74ef8de86f
Merge branch 'doc-iter' into 'main'
...
Introduce new batching iterator and use it in two places
See merge request tpo/core/arti!1016
2023-02-13 18:59:42 +00:00
Ian Jackson
297019bb23
batching_split_before: Whitespace error fix
2023-02-13 17:34:04 +00:00
Ian Jackson
b4d0b585c2
batching_split_before: Better xref for doc hidden
...
And another UNSTABLE warning.
2023-02-13 17:32:54 +00:00
Ian Jackson
1232bb6661
batching_split_before: Clarify API sequential restriction
2023-02-13 17:29:17 +00:00
Ian Jackson
5be6db006c
batching_split_before: Fix and clarify Batches/LendingIterator doc
2023-02-13 17:28:39 +00:00
Ian Jackson
15f33ce13c
batching_split_before: Introduce unit token types
...
And explain why we're not using booleans.
2023-02-13 17:19:13 +00:00
Ian Jackson
73a20cdc36
batching_split_before: Expand on the remaining use of "meta-iterator"
2023-02-13 17:13:55 +00:00