unixSocket
For a TorOption which can be configured to use Unix Sockets, containing the attribute TorOption.Attribute.UNIX_SOCKET.
Unix sockets should always be preferred over using a TCP port (especially for the TorOption.ControlPort and its alternative option names) as Unix Sockets are unaffected by whether the host TCP layer is constrained (e.g. airplane mode, or a VPN).
This sets the argument to the expressed file path, which will be formatted as unix:\"${file-path}\"
. The value passed is always sanitized via File.absoluteFile + File.normalize before applying final formatting.
e.g.
try {
unixSocket("/path/to/my/ctrl.sock".toFile())
} catch(_: UnsupportedOperationException) {
auto()
}
Throws
when:
Is Windows (tor does not support Unix Sockets on windows).
Is Java 15 or below (Jvm only, Android is always available).
Configured path is too long.
Configured path is multiple lines.
If absoluteFile2 has to reference the filesystem to construct an absolute path and fails due to a filesystem security exception.