SocksEndpointResolver

Resolves the SOCKS endpoint reachable from this Android runtime.

On emulators and Waydroid, 127.0.0.1 points at the guest — not the host where system Tor may listen. When the configured host is loopback, we probe the default gateway (and the classic emulator alias) so host-side Tor can be reached.

Functions

Link copied to clipboard

Host-side Tor bridges (emulator alias, Waydroid gateway, loopback).

Link copied to clipboard
fun resolveReachableHost(configuredHost: String, port: Int = DEFAULT_SOCKS_PORT): String

Returns a SOCKS host that is actually reachable from this process. If configuredHost normalizes to loopback, probes the emulator alias, Waydroid bridge, and default gateway (in that order) and returns the first one accepting a TCP connection on port; falls back to the normalized loopback address if none respond.