summaryrefslogtreecommitdiff
path: root/crates/tor-socksproto/src/handshake.rs
Commit message (Collapse)AuthorAgeFilesLines
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-5/+1
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* tor-socksproto: Handle 0-byte reads (EOF) correctlyIan Jackson2024-10-011-1/+6
| | | | | | | This restores the functionality of socks users: detect closed sockets. 0c595818f713916d94b7b0e4062f953fad7c9799 which we reverted as part of rebasing this branch onto main.
* tor-socksproto: Introduce handshake_for_tests method (fmt)Ian Jackson2024-10-011-1/+4
|
* tor-socksproto: Introduce handshake_for_tests methodIan Jackson2024-10-011-4/+4
|
* tor-socksproto tests: Run test cases via new API in various modesIan Jackson2024-10-011-4/+117
|
* tor-socksproto tests: Use crate::* rather than ad-hoc importsIan Jackson2024-10-011-7/+1
|
* Apply deferred rustfmt churnIan Jackson2024-10-011-2/+2
|
* tor-socksproto: Move `handshake` to be a trait methodIan Jackson2024-10-011-0/+1
| | | | | | | | | | | This deduplicates some docs and eliminates the two wrapper functiosn for `run_handshake`, which is now just `handshake`. We're going to make other API breaks too, and this isn't going to be the primary API, so we might as well do this. Proper description of the semver breakage will come at the end when it's all done.
* tor-socksproto: Factor out return value handlingIan Jackson2024-10-011-0/+4
| | | | | | | | | | | This centralises the handling of return values, and paves the way for further deduplication. (The two return paragraphs were identical.) There's quite a lot of initial API surface to framework.rs. Some of that is going to be hidden, but we're also going to extend this to do more work. No functional change.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Change tor_bytes::Error::BadMessage to a Cow.Nick Mathewson2023-02-091-3/+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.
* 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.
* Allow "clippy::single_char_pattern" in tests.Ian Jackson2022-10-121-0/+1
| | | | | | | This lint exists for perf reasons, and this is rarely relevant in tests. Using double quoted str is generally cognitively less burdensome.
* Add a SocksReply type to capture address/port information.Nick Mathewson2022-10-031-5/+7
| | | | | I don't expect us to need this information much, but we may as well hang on to it.
* Tests for socks client handshake.Nick Mathewson2022-10-031-0/+126
| | | | | | These tests include a few reference cases, as well as a little framework to make sure that the client and the proxy implementation will handshake with one another successfully.
* Implement client-side SOCKS handshakeNick Mathewson2022-09-281-1/+9
|
* socksproto: Rename SocksHandshake to SocksProxyHandshake.Nick Mathewson2022-09-271-520/+6
| | | | | | | | Retain "SocksHandshake" as a deprecated synonym. Also, make an (on-by-default) feature for SocksProxyHandshake. (There is about to be a SocksClientHandshake as well.)
* socksproto: Use fallible writers.Nick Mathewson2022-07-111-16/+19
| | | | Also, make private a function that had formerly been `pub`.
* Convert each write_onto_infallible implementation into write_onto.Nick Mathewson2022-07-111-2/+3
|
* Rename "write" methods on tor-bytes to "write_infallible".Nick Mathewson2022-07-111-7/+7
| | | | | | | | | | | | | | | 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.
* tor-socksproto: Style and info fixes in errors.Nick Mathewson2022-06-221-3/+5
| | | | | (The use of Cow<> in the error message isn't strictly necessary here, but it's a pattern I want to encourage.)
* 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.
* 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.
* Merge branch 'error-socksproto-autoconvert' into 'main'Nick Mathewson2022-02-141-13/+6
|\ | | | | | | | | Provide, and use From impl for InternalError See merge request tpo/core/arti!315
| * Run rustfmt.Nick Mathewson2022-02-141-12/+5
| |
| * Provide, and use From impl for InternalErrorIan Jackson2022-02-141-7/+7
| | | | | | | | | | | | | | | | Adding this autoconversion is quite safe since every error generation site is explicit and has its own context, and we don't really need to add more. This simplifies the code and will simplify future work.
* | ErrorKind::NotImplemented: fix two testsIan Jackson2022-02-141-1/+1
| |
* | Split up ErrorKind::NoSupportIan Jackson2022-02-141-2/+2
|/
* socksproto: Simplify Truncated handlingNick Mathewson2022-02-111-1/+1
| | | | | | | | | | | | | Refactor the Error type to remove the yucky internal hidden Truncated variant. Instead, there's now an embedded tor_bytes::Error value. If that tor_bytes::Error is Truncated, we bubble it up when we convert our handshake result to the nested error struct. Thus there is still (sadly) a variant of tor_socksproto::Error that shouldn't be exposed to user code. But refactoring every inner method under handshake.rs seemed like a bad idea: once we're using Result<Result<..>>, the ? operator no longer helps us much.
* Move the Truncated error into tor-errors.Nick Mathewson2022-02-111-3/+3
|
* Try to resolve the "Truncated" error in tor-socksprotoNick Mathewson2022-02-111-24/+33
| | | | | I'm not in love with this solution; the others just seem a bit ugly too.
* tor-socksproto: Implement HasKindNick Mathewson2022-02-111-8/+25
| | | | | (This error isn't yet wrapped in TorError, but it will be eventually when we implement socks proxy and PT support.)
* Idle hacking to get tor-socksproto line coverage over 90%Nick Mathewson2021-12-021-1/+1
| | | | This was just a matter of adding a call to one function.
* fix/silence clippy lints in test modulesDaniel Eades2021-09-081-2/+3
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+563
This will cause some pain for now, but now is really the best time to do this kind of thing.