Skip to main content

Module policy

Module policy 

Source
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.

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§

AddrPolicy
Sequence of accept and reject rules
AddrPortPattern
A pattern that may or may not match an address and port.
PortPolicies
A pair of port policy summaries, one for IPv4 and one for IPv6
PortPolicy
A policy to match zero or more TCP/UDP ports.
PortRange
A PortRange is a set of consecutively numbered TCP or UDP ports.
PortRanges 🔒
A collection of port ranges in a sorted order.
PortSummaryThresholds
Thresholds for deciding whether a port counts as open, for a summary

Enums§

IpPattern
A pattern that matches one or more IP addresses.
PolicyError
Error from an unparsable or invalid policy.
RuleKind
A kind of policy rule: either accepts or rejects addresses matching a pattern.