Crate tor_relay_selection

source ·
Expand description

§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

Modules§

  • config 🔒
    Define configuration structures used for relay selection.
  • Define different restrictions that can be applied to relays.
  • selector 🔒
    Logic for selecting relays from a network directory, and reporting the outcome of such a selection.
  • Declare the TargetPort type.
  • usage 🔒
    Define a type describing how we’re going to use a relay.

Structs§

  • A set of relays that we must not use when picking a given relays.
  • A restriction that we use when picking relays.
  • Configuration object for building relay restrictions.
  • Description of the requirements that a relay must implement in order to be selected.
  • Description for how we plan to use a single relay.
  • Information about how a given selection was generated.
  • A port that we want to connect to as a client.

Traits§