#tor #tor-arti #arti

tor-relay-selection

Logic to select Tor relays for specific purposes

20 breaking releases

Uses new Rust 2024

0.37.0 Dec 2, 2025
0.36.0 Oct 30, 2025
0.35.0 Oct 6, 2025
0.32.0 Jul 8, 2025
0.20.0 Jun 27, 2024

#1968 in Network programming

Download history 2481/week @ 2025-08-19 2881/week @ 2025-08-26 2567/week @ 2025-09-02 2427/week @ 2025-09-09 2314/week @ 2025-09-16 2298/week @ 2025-09-23 3156/week @ 2025-09-30 3250/week @ 2025-10-07 3124/week @ 2025-10-14 3055/week @ 2025-10-21 3613/week @ 2025-10-28 3236/week @ 2025-11-04 2566/week @ 2025-11-11 3698/week @ 2025-11-18 3717/week @ 2025-11-25 3933/week @ 2025-12-02

14,236 downloads per month
Used in 55 crates (5 directly)

MIT/Apache and maybe LGPL-3.0-only

2MB
25K 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

~24–59MB
~889K SLoC