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.

Structs§

AddrPolicy
A sequence of rules that are applied to an address:port until one matches.
AddrPortPattern
A pattern that may or may not match an address and port.
PortPolicy
A policy to match zero or more TCP/UDP ports.
PortRange
A PortRange is a set of consecutively numbered TCP or UDP ports.

Enums§

PolicyError
Error from an unparsable or invalid policy.
RuleKind
A kind of policy rule: either accepts or rejects addresses matching a pattern.