Instance Method
setConf(_:)
Issue a SETCONF command to mutate Tor’s runtime configuration.
func setConf(_ options: [String : String?]) async throws
Parameters
-
options
-
Dictionary of torrc option names to optional string values. Pass nil as a value to reset.
Mentioned In
Discussion
Composes the command body per control-spec.txt §3.1: each option with a non-nil value becomes Key="Value" (double quotes escape internal quotes); each option with a nil value becomes the bare Key form, which resets the option to its configured default.
Throws
TorError.controlProtocolError(code:message:) on rejection (e.g. reply 553 “invalid config value”).
Important
Not all torrc options are settable at runtime — Tor rejects immutable options with reply 553. Consult tor.1.txt for the per-option mutability annotation before building a mutation.