<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "Tor",
  "identifier" : "/documentation/Tor/OnionPortTarget",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Tor"
    ],
    "preciseIdentifier" : "s:3Tor15OnionPortTargetO"
  },
  "title" : "OnionPortTarget"
}
-->

# OnionPortTarget

Where an onion service should forward inbound connections.

```
enum OnionPortTarget
```

## Overview

Corresponds to the `Target` field of an `ADD_ONION` port mapping in
control-spec.txt §3.27. Two target shapes are modelled: a TCP `host:port`
tuple on the local machine, or a Unix domain socket path. Pick the TCP
form for typical web-server integration; the Unix form when forwarding
into a socket-only backend (nginx FastCGI, Prometheus exporters, etc.).

> Note: Conformance is `Sendable` + `Hashable`. Hashability is safe
> here — both payloads are public configuration, not secrets.

> Important: Tor does **not** validate the target at registration
> time. Bad hosts / missing Unix paths surface as connection refusals
> when a client dials the `.onion` address.

## Topics

### Cases

[`OnionPortTarget.tcp(host:port:)`](/documentation/Tor/OnionPortTarget/tcp(host:port:))

Forward to a TCP endpoint.

[`OnionPortTarget.unix(path:)`](/documentation/Tor/OnionPortTarget/unix(path:))

Forward to a Unix domain socket on the local filesystem.

