<!--
{
  "availability" : [

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

# host

The host portion of the endpoint, interpreted exactly as written.

```
let host: String
```

## Discussion

Accepted forms mirror the POSIX `getaddrinfo(3)` + SOCKS5 address
types: a dotted IPv4 literal (`"127.0.0.1"`), a DNS name (`"localhost"`,
`"torproxy.internal"`), or a raw IPv6 literal (`"::1"`). **IPv6
literals are not auto-bracketed by ``doc://Tor/documentation/Tor/HostPort/description``**, so callers
producing URLs or proxy tuples from a `HostPort` must bracket the
host themselves (e.g. `"[::1]:9050"`) per [RFC 3986 §3.2.2](https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.2).

- Stability: immutable (`let`) — changes require constructing a new
  `HostPort`.
- Typical values: `"127.0.0.1"` for SOCKS/control endpoints, a
  `.onion` hostname when populating `OnionPortTarget`, or a local
  `"localhost"` alias when a DNS lookup is cheap enough.