Instance Method
control()
Return the TorControlClient bound to this Tor instance.
func control() throws -> TorControlClient
Return Value
The shared TorControlClient. The same instance is returned across calls for the life of the session.
Mentioned In
Discussion
Hands out the shared, pre-authenticated control client that swift-tor creates during start(). Use it for advanced operations the high-level API does not expose: GETINFO queries beyond the curated list, raw SETEVENTS subscriptions, onion- service management (addOnion(key:ports:detach:)), and Tor signals (NEWNYM, DUMP, etc.).
Throws
TorError.controlUnavailable when Tor is not running or the control socket failed to authenticate during start.
Important
The returned client is owned by this TorClient. Do not close its socket manually — that is handled by stop(). Calling control commands concurrently is safe; commands are serialised at the socket layer.