#tor #tor-arti #arti

tor-relay-selection

Logic to select Tor relays for specific purposes

12 breaking releases

new 0.29.0 Apr 1, 2025
0.28.0 Mar 3, 2025
0.27.0 Feb 7, 2025
0.25.0 Dec 2, 2024
0.20.0 Jun 27, 2024

#2154 in Network programming

Download history 2431/week @ 2024-12-09 1911/week @ 2024-12-16 765/week @ 2024-12-23 850/week @ 2024-12-30 1573/week @ 2025-01-06 1765/week @ 2025-01-13 1208/week @ 2025-01-20 1331/week @ 2025-01-27 2655/week @ 2025-02-03 1632/week @ 2025-02-10 1232/week @ 2025-02-17 1137/week @ 2025-02-24 1527/week @ 2025-03-03 1338/week @ 2025-03-10 1051/week @ 2025-03-17 850/week @ 2025-03-24

4,819 downloads per month
Used in 40 crates (5 directly)

MIT/Apache and maybe LGPL-3.0-only

1.5MB
21K SLoC

tor-relay-selection

Logic to select Tor relays for specific purposes

Overview

The tor-relay-selection crate provides higher-level functions in order to select Tor relays for specific purposes, or check whether they are suitable for those purposes. It wraps lower-level functionality from tor-netdir.

This crate is part of Arti, a project to implement Tor in Rust.

Design

Our main types are RelayUsage, RelayExclusion, RelayRestriction, and RelaySelector.

A RelayUsage answers the question "what is this relay for?"

A RelayExclusion excludes one or more relays as having already been selected, or as sharing families with already-selected relays.

A RelayRestriction imposes additional restrictions on a relay.

A RelaySelector is a collection of a usage, an exclusion, and any number of restrictions.

In a RelaySelector, usages and restrictions can be strict or flexible. If we fail to pick a relay, and there are any flexible usages/restrictions, then we remove those usages/restrictions to produce a relaxed selector and we try again.

License: MIT OR Apache-2.0

Dependencies

~22–34MB
~523K SLoC