<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "Tor",
  "identifier" : "/documentation/Tor/TorSession/socksEndpoint",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Tor"
    ],
    "preciseIdentifier" : "s:3Tor0A7SessionP13socksEndpointAA8HostPortVSgvp"
  },
  "title" : "socksEndpoint"
}
-->

# socksEndpoint

Tor’s local SOCKS5 proxy endpoint, `nil` until the port is known.

```
var socksEndpoint: HostPort? { get async }
```

## Discussion

Becomes non-`nil` shortly after [`start()`](/documentation/Tor/TorSession/start()) resolves, when the
production conformer has negotiated an ephemeral TCP port with the
embedded Tor process (or used the fixed port from
`TorConfiguration.socksPort`). The endpoint is safe to hand to
`URLSessionConfiguration.configuredForTor(socksEndpoint:)` on
Apple platforms or to any other SOCKS5-aware client per
[RFC 1928](https://datatracker.ietf.org/doc/html/rfc1928).

- Stability: `host` is `127.0.0.1` and stable for the session;
  `port` depends on `TorConfiguration.socksPort` and is chosen once.
- Typical value: `HostPort(host: "127.0.0.1", port: 58432)` with an
  ephemeral port, or `HostPort(host: "127.0.0.1", port: 9050)` with
  a fixed port.