summaryrefslogtreecommitdiff
path: root/crates/tor-socksproto/src/handshake.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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.