Enumeration
PortPolicy
Three-way policy describing how Tor should bind a configurable port.
enum PortPolicy
Overview
PortPolicy is the typed counterpart to the port-number argument that appears on Tor’s SocksPort, ControlPort, and related torrc options (tor.1.txt). Rather than force callers to pass magic integers (0 to disable, auto to let Tor pick), the enum models the three real choices and renders to the correct torrc token on demand via its description.
Note
Conformance is Sendable + Hashable + CustomStringConvertible. The rendered string description is deliberately identical to the torrc token so you can interpolate directly into configuration strings; programmatic tests should pattern-match on the enum cases.
Important
Only swift-tor’s SOCKS port currently uses this type. The control port is always bound by tor_main_configuration_setup_control_socket() and is not configurable via PortPolicy.
Topics
Policies
Rendering