summaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
...
| * | tor-proto: use InternalError for internal errors.Nick Mathewson2022-02-1513-45/+84
| | |
| * | tor-cell: provide HasKind.Nick Mathewson2022-02-159-31/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | Additionally, refactor the IoError out of tor_cell::Error: nothing in TorCell created this; it was only used by tor_proto. This required refactoring in tor_proto to use a new error type. Here I decided to use a new CodecError for now, though we may refactor that away soon too.
* | | Merge branch 'ticket_344' into 'main'eta2022-02-161-5/+24
|\ \ \ | | | | | | | | | | | | | | | | Refactor tor-netdoc a bit more, to use Bug right. See merge request tpo/core/arti!316
| * | | Fix a rustdoc error.Nick Mathewson2022-02-151-1/+1
| | | |
| * | | Refactor tor-netdoc a bit more, to use Bug right.Nick Mathewson2022-02-151-4/+23
| | |/ | |/|
* / | Move persistent state flush from client to circmgrYuan Lyu2022-02-152-15/+13
|/ /
* | Minimal compilation fix: InternalError=>BugNick Mathewson2022-02-151-2/+2
| | | | | | | | This is a followup for !314 and !310 to fix compilation on main.
* | Merge branch 'doc-errors' into 'main'Nick Mathewson2022-02-1521-399/+579
|\ \ | |/ |/| | | | | Refactor errors in tor-netdoc See merge request tpo/core/arti!314
| * Typo fix from@etaeta2022-02-151-1/+1
| |
| * Refactor tor_netdoc::ErrorNick Mathewson2022-02-1416-378/+552
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This error type doesn't impement HasKind, since the kind will depend on context. However, the existing implementation was pretty messy and inconsistent: Some errors had positions, some didn't. Some took messages as str, some as String. Some had internal errors that were somewhat orthogonal to their actual types. This commit refactors tor_netdoc::Error to use a ParseErrorKind, and adds a set of convenience functions to add positions and messages to the errors that need them.
| * netdoc: Make doc-build errors a separate typeNick Mathewson2022-02-147-13/+30
| | | | | | | | | | Every other case of tor_netdoc::Error means a parse failure. This one, though, means a failure to construct a document.
| * netdoc: remove Error::Untimely.Nick Mathewson2022-02-141-11/+0
| | | | | | | | Nothing creates this.
* | tor_error::Bug: change Display impl to use kindIan Jackson2022-02-151-2/+2
| | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/310#note_2777626 The message from the kind is precisely right.
* | BadApiUsage: change Display impl capitalisationIan Jackson2022-02-151-1/+1
| | | | | | | | Now it maches the others
* | Rename BadApiUsage from BadAPIUsageIan Jackson2022-02-152-5/+5
| | | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/310#note_2777519 mutatis mutandi. And, fix a leftover instance with an old idea of what this was called.
* | tor-socksproto: Use bad_api_usage! rather than ad-hoc Invalid errorIan Jackson2022-02-152-8/+3
| |
* | Make Bug from InternalError, add bad_api_usage! and into_bad_api_usage!Ian Jackson2022-02-154-42/+97
| | | | | | | | Including supporting machinery, new kind field, etc.
* | New name and semantics for BadAPIUsage (was BadArgument)Ian Jackson2022-02-152-4/+13
| |
* | Merge branch 'error-socksproto-autoconvert' into 'main'Nick Mathewson2022-02-142-14/+7
|\ \ | | | | | | | | | | | | 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-142-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge branch 'explain_into_tor_addr' into 'main'Nick Mathewson2022-02-141-4/+25
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | More docs for IntoTorAddr Closes #253 See merge request tpo/core/arti!305
| * | | More docs for IntoTorAddrNick Mathewson2022-02-141-4/+25
| |/ /
* | | Merge branch 'ticket_337' into 'main'eta2022-02-142-38/+11
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Simplify wait_for_bootstrap to use a Mutex. Closes #337 See merge request tpo/core/arti!308
| * | | Simplify wait_for_bootstrap to use a Mutex.Nick Mathewson2022-02-142-38/+11
| | |/ | |/| | | | | | | | | | | | | | | | | | | Since the only purpose of this function is to make sure that no bootstrapping task is running, a simple futures::lock::Mutex should do the job just fine. Closes #337.
* | | Merge branch 'warn_not_deny' into 'main'eta2022-02-1430-30/+30
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Change deny(clippy::all) to warn(clippy::all). Closes #338 See merge request tpo/core/arti!306
| * | | Change deny(clippy::all) to warn(clippy::all).Nick Mathewson2022-02-1430-30/+30
| |/ / | | | | | | | | | Closes #338.
* | | Merge remote-tracking branch 'origin/mr/313'Nick Mathewson2022-02-141-2/+2
|\ \ \
| * | | tor_socksproto::Error HasKind fix two delegationsIan Jackson2022-02-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We should not generally explicitly specify a kind for errors which contain a more detailed error which itself has a kind. Stating the kind literally is a latent bug, which becomes a real bug if the contained type's kind changes or starts to vary. (There may be exceptions to this principle but this isn't one of them.)
* | | | Merge branch 'error-kind-protocol' into 'main'Ian Jackson2022-02-142-6/+19
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | Split up ErrorKind::ProtocolViolation See merge request tpo/core/arti!312
| * | | | Split up ErrorKind::ProtocolViolationIan Jackson2022-02-142-6/+19
| |/ / /
* | | | Merge branch 'error-kind-notimp' into 'main'Ian Jackson2022-02-144-15/+32
|\ \ \ \ | |_|_|/ |/| | | | | | | | | | | Split up ErrorKind::NoSupport See merge request tpo/core/arti!311
| * | | ErrorKind::NotImplemented: fix two testsIan Jackson2022-02-142-2/+2
| | | |
| * | | Split up ErrorKind::NoSupportIan Jackson2022-02-144-13/+30
| |/ /
* | | Merge branch 'error-kind-config-transition' into 'main'Nick Mathewson2022-02-141-0/+3
|\ \ \ | | | | | | | | | | | | | | | | Clarify ErrorKind::InvalidConfigTransition See merge request tpo/core/arti!309
| * | | Clarify ErrorKind::InvalidConfigTransitionIan Jackson2022-02-141-0/+3
| |/ /
* | | Merge branch 'useless_qm' into 'main'Nick Mathewson2022-02-141-1/+1
|\ \ \ | |/ / |/| | | | | | | | dirmgr: Remove a useless Ok(x?) See merge request tpo/core/arti!307
| * | dirmgr: Remove a useless Ok(x?)Nick Mathewson2022-02-141-1/+1
| |/ | | | | | | Found by nightly clippy.
* | Merge branch 'update_if_zero' into 'main'Nick Mathewson2022-02-142-4/+38
|\ \ | |/ |/| | | | | Use atomic set-and-check to update OptTimestamps if none. See merge request tpo/core/arti!297
| * Use atomic set-and-check to update OptTimestamps if none.Nick Mathewson2022-02-092-4/+38
| | | | | | | | | | | | | | This fixes a tiny race condition in the previous code, where we checked whether an OptTimestamp is None a bit before we set it. Since std::atomic gives us compare_exchange, we might as well use it.
* | Rename bootstrap_existing to bootstrap.Nick Mathewson2022-02-112-12/+10
| | | | | | | | (Looks like this one got missed.)
* | Merge branch 'eta/unbootstrapped-clients' into 'main'Nick Mathewson2022-02-1111-93/+384
|\ \ | | | | | | | | | | | | | | | | | | Allow creating unbootstrapped `TorClient`s (and `DirMgr`s) Closes #293 See merge request tpo/core/arti!298
| * | Allow creating unbootstrapped `TorClient`s (and `DirMgr`s)eta2022-02-1111-93/+384
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes how the `TorClient` type works, enabling it to be constructed synchronously without initiating the bootstrapping process. Daemon tasks are still started on construction (although some of them won't do anything if the client isn't bootstrapped). The old bootstrap() methods are now reimplemented in terms of the new create_unbootstrapped() and bootstrap_existing() methods. This required refactoring how the `DirMgr` works to enable the same sort of thing there. closes #293
* | | Merge branch 'connect_examples' into 'main'eta2022-02-111-5/+64
|\ \ \ | | | | | | | | | | | | | | | | Write some examples for TorClient::connect() See merge request tpo/core/arti!303
| * | | Write some examples for TorClient::connect()Nick Mathewson2022-02-111-5/+64
| | | | | | | | | | | | | | | | | | | | | | | | These should explain better what you can pass as an address, and what you should do if you _really need_ to provide a SocketAddr or something.
* | | | socksproto: fix one more error type.Nick Mathewson2022-02-111-1/+1
| | | |
* | | | socksproto: Simplify Truncated handlingNick Mathewson2022-02-113-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-115-19/+30
| | | |
* | | | Try to resolve the "Truncated" error in tor-socksprotoNick Mathewson2022-02-114-50/+66
| | | | | | | | | | | | | | | | | | | | I'm not in love with this solution; the others just seem a bit ugly too.
* | | | tor-socksproto: Implement HasKindNick Mathewson2022-02-114-10/+92
|/ / / | | | | | | | | | | | | (This error isn't yet wrapped in TorError, but it will be eventually when we implement socks proxy and PT support.)