Expand description
Exit policies: match patterns of addresses and/or ports.
Every Tor relays has a set of address:port combinations that it actually allows connections to. The set, abstractly, is the relay’s “exit policy”.
Address policies can be transmitted in two forms. One is a “full policy”, that includes a list of rules that are applied in order to represent addresses and ports. We represent this with the AddrPolicy type.
In microdescriptors, and for IPv6 policies, policies are just given a list of ports for which most addresses are permitted. We represent this kind of policy with the PortPolicy type.
TODO: This module probably belongs in a crate of its own, with possibly only the parsing code in this crate.
Re-exports§
use std::fmt;🔒use std::ops::RangeInclusive;🔒use std::str::FromStr;🔒use std::collections::BTreeSet;🔒use std::fmt::Display;🔒use thiserror::Error;🔒use tor_basic_utils::iter_join;🔒pub use addrpolicy::AddrPolicy;pub use addrpolicy::AddrPortPattern;pub use addrpolicy::IpPattern;pub use portpolicy::PortPolicy;pub use summary::PortPolicies;pub use summary::PortSummaryThresholds;use crate::NormalItemArgument;🔒use crate::parse2::ArgumentError;🔒use crate::parse2::ArgumentStream;🔒use crate::parse2::ItemArgumentParseable;🔒
Modules§
- addrpolicy 🔒
- Implements address policies, based on a series of accept/reject rules.
- portpolicy 🔒
- Implement port-based policies
- summary 🔒
- Precise IP and port policy summarisation algorithm
Structs§
- Port
Range - A PortRange is a set of consecutively numbered TCP or UDP ports.
- Port
Ranges 🔒 - A collection of port ranges in a sorted order.
Enums§
- Policy
Error - Error from an unparsable or invalid policy.
- Rule
Kind - A kind of policy rule: either accepts or rejects addresses matching a pattern.