aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-linkspec/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * tor-linkspec: impl `HasAddrs` for `&T`Steven Engler2024-09-231-0/+7
| | | | | | | | | | This makes the `HasAddrs` trait nicer to use when most things that have addresses are passed by reference anyways.
* | Upgrade to derive_more version 1.0.0Nick Mathewson2024-09-251-7/+7
|/ | | | | | The `derive_more` crate broke backward compatibility with this version, so this change involved quite a few manual fixups. With luck, they'll keep compatibility for some while in the future.
* tor_bytes: Rename new_truncated_for_test to new_incomplete_for_test (fmt)Ian Jackson2024-09-121-2/+8
|
* tor_bytes: Rename new_truncated_for_test to new_incomplete_for_testIan Jackson2024-09-121-6/+6
| | | | No semver implications since this wasn't in the last release.
* tor-bytes: Add a Reader constructor for use in testsIan Jackson2024-09-111-4/+4
| | | | | | | | | | | | We could call from_possibly_incomplete_slice in these, but that's confusing and distracting. Here we add this constructor, and document it (in terms of the constructor to come), and change the call sites. No functional change. Doing this now will prevent unwanted changes to test behaviours when we change the behaviour of Readers made by Reader::from_slice.
* Change tor_bytes::Readable name to `b` in many placesIan Jackson2024-09-111-3/+3
| | | | | | | | | | | | | | | The codebase uses `r` sometimes and `b` at other times. Making this consistent makes widespread changes easier, and is clearer for humans. I think `b` is better than `r` because `r` might be "return". It is indeed used that way in a couple of places in reader.rs, even. I haven't changed *everywhere*, just Readable impls (where `r` is particularly likely to be "return value") and occurrences in tor-bytes. No functional change.
* Introduce and use tor_bytes::Error::new_truncated_for_testIan Jackson2024-09-101-6/+6
| | | | | | | | This is going to want to do something more complicated (as described in the docs). In this commit we change all the tests that are expecting Truncated errors. That reduces noise in the next commit.
* tor-linkspec: reading tests: Use assert_eqIan Jackson2024-09-101-6/+6
| | | | | | | Error::Truncated is going to become more complicated, and anyway it would be nice to print the values if the test fails. Error is PartialEq now. (Maybe it wasn't when this was written?)
* Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | This commit is automatically generated.
* tor-linkspec: Suppress clippy false positive (link ticket)Ian Jackson2024-04-031-1/+1
|
* tor-linkspec: Suppress clippy false positiveIan Jackson2024-04-031-0/+1
|
* tor-netdir: Abolish Relay::has_same_relay_idsIan Jackson2024-04-031-1/+0
| | | | This was an open-coded specialisation. Remove the one call site.
* tor-linkspec: Use derive-deftly rather than strum for same_relay_idsIan Jackson2024-04-033-1/+42
|
* tor-linkspec: Use RelayIdType::all_types rather than ::iterIan Jackson2024-04-031-2/+2
| | | | | This will make it slightly easier to find these call sites if we want to change them in the future.
* Run maint/add_warning.Nick Mathewson2024-03-139-0/+9
|
* Fix typos in doc commentsTobias Stoeckmann2024-03-061-1/+1
|
* deny clippy::unchecked_duration_subtractiontrinity-1686a2024-02-291-0/+1
|
* educe: Use std's default for enums where default variant is unitIan Jackson2024-02-121-3/+2
| | | | | | | | | | | | | Since Rust 1.66, std's default works properly for enums, provided that the default variant is a unit. Review all uses of `#[educe(default)]` on enums and replace them with std where possible, which is most of them. In 1.66 and later, std's `#[derive(Default)]` doesn't infer any generic bounds on the derived impl, where it's an enum - since the unit variant can always be constructed. So this change doesn't add any generic bounds and is not API-visible.
* tor-linkspec: Provide HasRelayIds::has_any_relay_id_from (fmt)Ian Jackson2023-08-291-3/+3
| | | | Worsify formatting as demanded by rustfmt.
* tor-linkspec: Provide HasRelayIds::has_any_relay_id_fromIan Jackson2023-08-291-0/+67
| | | | | This seems logically necessary, and I want to use it in intro point selection.
* linkspec: Derive Clone and Copy for VerbatimLinkSpecCircTarget.Nick Mathewson2023-08-241-0/+1
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-239-0/+9
|
* Lower linkspec list parsing into new tor-linkspec method.Nick Mathewson2023-08-221-1/+20
|
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* tor-linkspec: impl AsRef<str> for PtTransportNameIan Jackson2023-07-201-0/+6
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-1010-0/+10
|
* Fix new "useless_vec" warning from clippy +nightlyIan Jackson2023-07-101-1/+1
| | | | | | | | | | | Explanation at https://rust-lang.github.io/rust-clippy/master/index.html#/useless_vec This is the non-tests subset of the same-named commmit in !1388, (recreated by hand by me, and then checked against that commit; I stole the commit message from Nick's.) This should be uncontroversial I think.
* Merge branch 'allow_missing_panics' into 'main'Ian Jackson2023-07-071-1/+0
|\ | | | | | | | | | | | | add_warning: Tolerate clippy::missing_panics_doc Closes #950 See merge request tpo/core/arti!1380
| * Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
| | | | | | | | Closes #950.
* | Merge branch 'clippy-nightly-20230703' into 'main'Nick Mathewson2023-07-071-2/+2
|\ \ | |/ |/| | | | | | | | | Fix various warnings from clippy nightly Closes #943 See merge request tpo/core/arti!1369
| * Avoid matches!(x, None), matches!(x, Ok(_))Nick Mathewson2023-07-061-2/+2
| | | | | | | | This appeases clippy-nightly.
* | Additional documentation around bridges/PT configurationNick Mathewson2023-07-031-4/+7
|/ | | | | | | This tries to flesh out some of the details for users who may be new to bridges and PTs. Closes #706.
* lints: Run maint/add_warning to actually apply new lintsIan Jackson2023-06-211-0/+2
|
* linkspec: cleanup usage; change std::fmt to fmt.Nick Mathewson2023-06-121-6/+6
|
* RelayId: Display the ID type on redacted identities.Nick Mathewson2023-06-092-4/+3
| | | | | Formerly we would display just the first characters of the identity, without telling you what kind of ID it was.
* linkspec: implement Display/Redacted on RelayIdsNick Mathewson2023-06-091-0/+22
|
* linkspec: Implement HasRelayIds::display_relay_ids().Nick Mathewson2023-06-091-6/+49
|
* linkspec::verbatim: wrapper to give a CircTarget a new set of LinkSpecsNick Mathewson2023-05-112-0/+111
|
* Add linkspec::decode to convert linkspecs to an OwnedChanTargetNick Mathewson2023-05-112-0/+186
| | | | | | | Relays and onion service services/clients will both need this. I'm marking this experimental for now; we should stabilize it before we release onion services.
* Change CircTarget::linkspecs() to return an encoded list.Nick Mathewson2023-05-102-4/+15
| | | | | | | | If we didn't do this, we would need to transfrom `EncodedLinkSpec`s into a `LinkSpec::Unrecognized`, which is not semantically right. What's more, every user of this API wants to consume encoded link specifiers, so encoding them early saves a little effort.
* linkspec: Make LinkSpecType public.Nick Mathewson2023-05-102-31/+39
| | | | | This lets us check the type of an `EncodedLinkSpec` as well, and lets us remove an interface that took a raw u8.
* linkspec: define conversion functions for EncodedLinkSpecNick Mathewson2023-05-101-48/+79
| | | | | | This commit adds functions to convert between LinkSpec and EncodedLinkSpec, and refactors their read/write implementations a bit to avoid code duplication.
* Rename UnparsedLinkSpec => EncodedLinkSpecNick Mathewson2023-05-102-13/+13
|
* test_linkspecs: tidy order of linkspecsNick Mathewson2023-05-101-11/+11
| | | | This is pure code movement.
* Move responsibility for linkspec sorting to CircTarget.Nick Mathewson2023-05-101-2/+13
| | | | | | This change is necessary so that we can build Extend2 messages that have their LinkSpecs appear in a verbatim order as provided in an INTRODUCE2 message or in a HS descriptor.
* RelayId: implement id_type and as_bytes in terms of RelayIdRefIan Jackson2023-04-271-8/+2
| | | | This eliminates some duplicated code.
* RelayIdRef: as_bytes: Doesn't borrow from selfIan Jackson2023-04-271-1/+1
| | | | | | | This borrows from the contained key, but not from self. This will allow us to implement RelayId::as_bytes in terms of RelayIdRef::as_bytes.
* RelayId: impl Display in terms of RelayIdRefIan Jackson2023-04-271-3/+9
| | | | This removes a duplicated copy of the format strings.
* linkspec: Add a missing ; in tests.Nick Mathewson2023-04-061-1/+1
|
* tor-linkspec: Add a constructor for UnparsedLinkSpecNick Mathewson2023-03-061-0/+10
|