<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "Tor",
  "identifier" : "/documentation/Tor/HostPort/init(host:port:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Tor"
    ],
    "preciseIdentifier" : "s:3Tor8HostPortV4host4portACSS_Sitcfc"
  },
  "title" : "init(host:port:)"
}
-->

# init(host:port:)

Memberwise initializer for the `host` and `port` pair.

```
init(host: String, port: Int)
```

## Parameters

`host`

Host component. See [`host`](/documentation/Tor/HostPort/host) for accepted forms.

`port`

TCP port, typically 1–65535.

## Discussion

Assigns both fields verbatim; no canonicalisation, no validation.
Construct once, compare freely — the value is `Hashable`/`Sendable`
and safely crosses concurrency domains.

> Note: If you always mean loopback, prefer ``doc://Tor/documentation/Tor/HostPort/localhost(_:)`` to
> avoid repeating the literal `"127.0.0.1"` at call sites.

> Important: Case and whitespace in `host` are preserved literally.
> `HostPort(host: " localhost", port: 9050)` is **not** equal to
> `HostPort(host: "localhost", port: 9050)`.