Type Method
ephemeralConfiguredForTor(socksEndpoint:)
Build an ephemeral URLSessionConfiguration that routes every HTTP/HTTPS request through a SOCKS5 proxy.
static func ephemeralConfiguredForTor(socksEndpoint endpoint: HostPort) -> URLSessionConfiguration
Parameters
-
endpoint
-
SOCKS5 proxy endpoint, typically socksEndpoint.
Return Value
An ephemeral configuration with the SOCKS5 proxy installed.
Discussion
Starts from URLSessionConfiguration.ephemeral (no disk persistence of cookies, caches, or credentials) and installs the same SOCKS5 proxy dictionary as configuredForTor(socksEndpoint:). Preferred for one-shot or privacy-sensitive traffic where session state should not survive process exit.
Note
Ephemeral sessions still share Apple’s in-memory URL cache for the process lifetime; subsequent requests for the same URL may short-circuit. Set config.urlCache = nil if strict no-cache behaviour is required.