Outbounds
An outbound is where a connection goes after an inbound has accepted it. It can dial the destination directly (freedom), throw the connection away (blackhole), or hand it to another proxy server as a client of SOCKS, HTTP, Trojan, VLESS, VMess, Shadowsocks, AnyTLS, sss, Hysteria 2 or WireGuard. The router picks one outbound, or a balancer made of several, for every TCP connection and for every UDP packet.
This page covers what all outbounds have in common: the [[outbound]] fields, the address_family policy, which protocols carry UDP, and how UDP is routed. The settings of each protocol are on its own page.
A minimal example
Section titled “A minimal example”A configuration needs somewhere to send traffic. With no [route] section, every flow goes to the first outbound:
[[inbound]]tag = "socks-in"protocol = "socks"listen = "127.0.0.1"port = 1080
[[outbound]]tag = "direct"protocol = "freedom"A more typical client sends most traffic through a proxy server, some straight out, and blocks some:
[[inbound]]tag = "socks-in"protocol = "socks"listen = "127.0.0.1"port = 1080
# The first outbound is the default unless [route].default names another.[[outbound]]tag = "proxy"protocol = "vless"server = "proxy.example.com"port = 443address_family = "prefer_ipv4"
[outbound.stream]network = "ws"security = "tls"
[outbound.stream.ws]path = "/ws"
[outbound.settings]id = "11111111-2222-3333-4444-555555555555"
[[outbound]]tag = "direct"protocol = "freedom"address_family = "ipv4_only"
[[outbound]]tag = "block"protocol = "blackhole"
[[route.rule]]outbound = "block"domain_suffix = ["ads.example.com"]
[[route.rule]]outbound = "direct"cidr = ["10.0.0.0/8", "192.168.0.0/16"]proxy is the default because it comes first. The VLESS client reaches proxy.example.com over WebSocket inside TLS, and presents proxy.example.com as the TLS server name because server is the fallback when tls.server_name is not set.
Common fields
Section titled “Common fields”Every [[outbound]] table accepts exactly these keys. Any other key, such as a misspelt sever, is a parse error that names its line.
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
tag | string | yes | — | Name of the outbound. Route rules, [route].default and [[balancer]].outbounds refer to it. Must be unique among outbounds (duplicate outbound tag …) and not empty, and no [[balancer]] may reuse it. Without [route].default, the first [[outbound]] in the file is the default route. |
protocol | string (enum) | yes | — | What the outbound speaks: freedom (alias direct), blackhole (alias block), socks, http, trojan, vless, vmess, shadowsocks, anytls, sss, hysteria2 (aliases hysteria, hy2) or wireguard. Matched exactly and case-sensitively; anything else fails with unknown protocol. |
server | string | depends | — | Host name or IP address of the upstream server, without a port. Required by socks, http, trojan, vless, vmess, shadowsocks, anytls, sss and hysteria2 (missing server). An IPv6 address may be written bare (2001:db8::1) or in brackets ([2001:db8::1]); brackets around anything else fail with outbound <tag>: invalid host "…": brackets hold only an IPv6 literal. It is also the fallback for the TLS server name (including hysteria2 server_name), the REALITY server name, the WebSocket Host and the gRPC authority. A wireguard outbound names its peer in endpoint instead. |
port | u16 | depends | — | Port of the upstream server. Required by the same protocols as server (missing port). For hysteria2 it is a UDP port; for every other protocol, a TCP port. |
stream | table | no | — | Transport to the upstream: network (tcp, tls, ws, grpc), security and the tls, ws, grpc and reality sub-tables. Used by socks, http, trojan, vless, vmess, shadowsocks, anytls and sss; anytls needs network = "tls", and only vless takes security = "reality". freedom, blackhole, wireguard and hysteria2 refuse any network other than tcp and any security other than none (protocol <protocol> does not support stream network "…"). Absent means plain TCP. |
address_family | string (enum) | no | "auto" | Which IP family to use when a name is resolved: auto, ipv4_only, ipv6_only, prefer_ipv4 or prefer_ipv6, plus aliases such as ipv4, v6 or prefer_v4. Trimmed, case-insensitive, and - counts as _. For a proxy outbound it applies to the server name; for freedom, to the destination; for wireguard, to destinations inside the tunnel (its endpoint has endpoint_address_family). An unknown value fails with invalid address_family "…". |
settings | table | depends | {} | Protocol-specific settings, described on each protocol page. Required for trojan, vless, vmess, shadowsocks, anytls, sss, hysteria2 and wireguard, which have mandatory keys; optional for socks and http. Unknown keys are refused, and errors here read outbound <tag>: invalid settings: …. |
protocol
Section titled “protocol”| Value | Aliases | What it does | Page |
|---|---|---|---|
freedom |
direct |
Dials the destination itself | Freedom and blackhole |
blackhole |
block |
Drops the flow | Freedom and blackhole |
socks |
SOCKS5 client: CONNECT, and UDP ASSOCIATE for UDP |
SOCKS | |
http |
HTTP CONNECT client |
HTTP | |
trojan |
Trojan client | Trojan | |
vless |
VLESS client | VLESS | |
vmess |
VMess client | VMess | |
shadowsocks |
Shadowsocks client, AEAD or 2022 (chosen by settings.method) |
Shadowsocks | |
anytls |
AnyTLS client over TLS, with a pool of idle sessions | AnyTLS | |
sss |
sss client, with its transform chains | sss | |
hysteria2 |
hysteria, hy2 |
Hysteria 2 client over QUIC | Hysteria 2 |
wireguard |
A userspace WireGuard tunnel to one peer | WireGuard |
Protocol names are case-sensitive: protocol = "Freedom" fails with outbound direct: unknown protocol "Freedom".
server and port
Section titled “server and port”The eight stream proxies (socks, http, trojan, vless, vmess, shadowsocks, anytls and sss) and Hysteria 2 dial an upstream server, so they need both keys. The other three do not dial one:
freedomgoes wherever each flow is addressed.blackholegoes nowhere.wireguardtakes its peer fromsettings.endpointashost:port.
server holds a host name or an IP address and nothing else. An IPv6 address may be written bare or in square brackets, as in a URL; both are the same address:
server = "2001:db8::10"Brackets hold only an IPv6 address: server = "[proxy.example]" fails when the config loads with outbound <tag>: invalid host "[proxy.example]": brackets hold only an IPv6 literal. A value that does not parse as an IP address is treated as a host name, and looked up with the resolver [dns] sets up.
stream
Section titled “stream”[outbound.stream] chooses the transport a proxy client uses to reach its server: plain TCP, TLS, WebSocket or gRPC, with or without TLS underneath. The keys are the same as on inbounds and are described on Transports. Two protocols narrow the choice: anytls runs over network = "tls" only, and vless alone may use security = "reality", described on REALITY.
Four protocols have no use for a transport:
freedomandblackholedo not dial a proxy server.wireguardsends its own UDP packets.hysteria2runs its own QUIC connection; its TLS settings live in[outbound.settings]instead.
For these four, a network other than tcp or a security other than none is refused rather than silently dropped. Leave the whole [outbound.stream] block out.
outbound wg: protocol wireguard does not support stream network "ws"outbound wg: protocol wireguard does not support stream security "tls"settings
Section titled “settings”[outbound.settings] holds what only one protocol understands: a password, a UUID, a cipher, WireGuard keys. Each protocol page lists its keys. Two things hold for all of them:
- Unknown keys are refused. A typo such as
usernamein a SOCKS outbound fails withoutbound x: invalid settings: unknown field `username`, expected `user` or `pass`. - The settings table is read after the file has been parsed, so its errors carry the outbound’s tag instead of a line number.
freedom and blackhole take no settings.
What each protocol supports
Section titled “What each protocol supports”| Protocol | Needs server and port |
[outbound.stream] |
Carries UDP | Balancer member |
|---|---|---|---|---|
freedom |
no | refused | yes | no |
blackhole |
no | refused | swallowed | no |
socks |
yes | yes | yes, by UDP ASSOCIATE |
yes |
http |
yes | yes | no | yes |
trojan |
yes | yes | yes | yes |
vless |
yes | yes | yes, one destination per association; with Vision, each packet addressed | yes |
vmess |
yes | yes | yes, one destination per association | yes |
shadowsocks |
yes | yes | no | yes |
anytls |
yes | tls only |
yes, as a UDP-over-TCP stream | yes |
sss |
yes | yes | yes | yes |
hysteria2 |
yes (UDP port) | refused | yes, if the server allows UDP | no |
wireguard |
no (settings.endpoint) |
refused | yes | no |
[outbound.stream]“refused” means anetworkorsecuritythat asks for anything but plain TCP is an error, as described above.- Carries UDP says what happens to a UDP packet routed to the outbound.
blackholeaccepts and discards it.httpandshadowsocks(both AEAD and 2022 methods) have no datagram support in this client, so packets routed to them are dropped (see UDP to an outbound without datagrams).vlesswithout aflow, andvmess, fix the destination of a UDP association in its header, and their UDP framing carries no per-packet address. Every packet on one association’s sub-link goes to the destination of the packet that opened it (see How UDP reaches an outbound). Avlessoutbound withflow = "xtls-rprx-vision"carries UDP as XUDP, as Xray’s client does, and so addresses each packet (since etemenanki-app 2.7.3).socks,trojan,anytls,sss,hysteria2,wireguardandfreedomaddress each packet on their own too.hysteria2relays UDP only if the server allows it. When the server refuses, the app logshysteria2: …; datagrams routed to this outbound are droppedonce per outbound, atwarnlevel, and drops those packets.
- Balancer member is decided by the balancer’s health probe, which is a TCP connect to the member’s
serverandport. Only the eight stream proxies have an upstream such a probe can reach.hysteria2andwireguardtalk to their servers over UDP, andfreedomandblackholehave no server, so all four are refused as members:balancer <tag>: outbound <member> has no upstream a TCP health probe can reach. See Balancers.
address_family
Section titled “address_family”address_family decides which of a name’s IP addresses an outbound may use, and in which order it tries them. It is set per outbound, so a direct outbound can stay on IPv4 while a proxy outbound prefers IPv6.
Accepted values
Section titled “Accepted values”The value is trimmed, lower-cased, and every - is turned into _ before it is matched. "IPv4-Only", " ipv4_only " and "ipv4only" all mean the same thing. The value must be a TOML string: address_family = 4 is a type error, address_family = "4" is fine.
| Policy | Also accepted | Addresses used | Order |
|---|---|---|---|
auto (default) |
"" (empty string) |
IPv4 and IPv6 | as the resolver returned them |
ipv4_only |
ipv4, v4, 4, ipv4only |
IPv4 only | as returned |
ipv6_only |
ipv6, v6, 6, ipv6only |
IPv6 only | as returned |
prefer_ipv4 |
prefer_v4, ipv4_prefer, v4_prefer |
IPv4 and IPv6 | IPv4 first, IPv6 kept as a fallback |
prefer_ipv6 |
prefer_v6, ipv6_prefer, v6_prefer |
IPv4 and IPv6 | IPv6 first, IPv4 kept as a fallback |
Anything else stops the configuration from loading:
outbound direct: invalid address_family "either"auto keeps the resolver’s order. With the default host resolver, that is the order the system returns, which follows the host’s address-selection rules. With a DNS server configured in [dns], IPv4 answers come before IPv6 ones. Choose an explicit policy only when that answer is wrong for one outbound, for example on a host whose IPv6 route is broken.
For a TCP connection, the outbound tries the allowed addresses one after another in that order and uses the first one that connects. Hysteria 2 does the same with its QUIC connection to server. Every lookup goes through the resolver configured in [dns] (the host resolver unless [dns] says otherwise).
What it applies to
Section titled “What it applies to”The same key resolves a different name depending on the protocol:
| Protocol | address_family applies to |
|---|---|
freedom |
The destination of each flow. For UDP it also limits which local sockets are opened: ipv4_only opens only an IPv4 socket, ipv6_only only an IPv6 one. |
socks, http, trojan, vless, vmess, shadowsocks, anytls, sss |
The server name. The destination is passed to the upstream proxy as it arrived, domain names included, and the upstream resolves it. |
hysteria2 |
The server name. As with the proxies above, the destination goes to the server unresolved. |
wireguard |
Destinations inside the tunnel. A name is resolved with the policy and then limited to the families that have an address in settings.address. The peer endpoint has its own key, settings.endpoint_address_family (see below). |
A destination that is already an IP address is not resolved. What happens to it depends on the traffic:
- TCP through
freedomorwireguard: the address is filtered like a resolved one. Afreedomoutbound withaddress_family = "ipv4_only"refuses a connection to2001:db8::1. - UDP through
freedom: the policy does not filter IP addresses, butipv4_onlyopens only an IPv4 socket andipv6_onlyonly an IPv6 one. A packet to an address of the other family is dropped, and the association carries on. - UDP through
wireguard: a packet to an IP address is passed into the tunnel as it is.
When no address is left
Section titled “When no address is left”If the policy filters out every address, the connection fails with a message that names the policy and the target, for example:
dial: no usable ipv4_only destination address for example.com:443A wireguard outbound uses the prefix wireguard: instead of dial:, and adds which families the tunnel addresses allow, for example wireguard: no usable ipv6_only destination address for example.com:443 (local address supports IPv4 only).
This happens at run time, per connection, not at load time. The protocol handlers log failed connections at debug level, so set [log].level = "debug" to see these messages.
For UDP through freedom or wireguard, a domain is resolved with the policy applied.
How UDP reaches an outbound
Section titled “How UDP reaches an outbound”A TCP connection is routed once, when it opens, and stays on the outbound the router picked. A UDP association cannot work that way: each datagram carries its own destination, and one association, such as a SOCKS5 UDP ASSOCIATE, may talk to many peers.
etemenanki-app therefore routes UDP packet by packet. Each association keeps its own set of sub-links, at most one per outbound version:
flowchart LR
C["Client UDP association"] --> R{"Route each packet"}
R -- "to 192.0.2.53:53" --> D["sub-link: direct"]
R -- "to example.com:443" --> P["sub-link: proxy"]
R -- "to ads.example.com:443" --> B["sub-link: block"]
D --> R2["Replies merged back"]
P --> R2
B -.-> R2
R2 --> C
What this means in practice:
- Rules see every packet. The router matches each datagram on its own destination and port, together with the association’s inbound tag and source address and
network = "udp". No sniffed domain is attached to a UDP packet, so a packet addressed to an IP address matches only IP, port and other non-domain rules. - A reload reaches the next packet. Each packet is routed with the route table that is current when it is sent, so after a reload that changes the rules, or builds a new version of an outbound, the next packet of a live association already follows the change.
- One association can use several outbounds at once. DNS can go direct while a game’s traffic goes through a proxy, without the client doing anything special.
- Destinations share a sub-link per outbound. All packets routed to the same outbound use the same sub-link, however many different destinations they have. The first packet to an outbound opens the sub-link.
- VLESS and VMess sub-links keep their first destination. These protocols name one destination when the UDP association opens and carry no address per packet. Every later packet that the router sends to the same
vlessorvmessoutbound goes to that first destination, whatever its own address, and replies appear to come from it. If one client association talks to several peers through VLESS or VMess, only the first peer is reached correctly. Avlessoutbound withflow = "xtls-rprx-vision"is the exception: its UDP rides XUDP, which names the peer of every packet and of every reply. - At most 64 sub-links per association. When a 65th is needed, the association closes the sub-link it sent to least recently. Replies still in flight on that sub-link are lost. You only reach this with more than 64 distinct outbounds in one association.
- A packet whose sub-link cannot be opened is dropped. The association carries on, and the next packet for that outbound tries again.
- A sub-link that ends is replaced. If a sub-link’s connection closes, for example because the upstream proxy dropped it, the association removes it, and the next packet for that outbound opens a new one.
- A balancer keeps an association on its member while that member is healthy. Each packet routed to a balancer goes to the member the association already uses, if it is still up; otherwise the balancer picks another, and the next packet opens a sub-link to it.
UDP to an outbound without datagrams
Section titled “UDP to an outbound without datagrams”http and shadowsocks outbounds carry only TCP. The router does not know that: a UDP packet that matches a rule pointing at one of them is routed there, the sub-link fails to open, and the packet is dropped. The app logs this at debug level:
udp fan-out: opening corp-http@v1 failed: http carries no datagramsFor Shadowsocks the message names shadowsocks or shadowsocks-2022. Every later packet for that outbound is dropped the same way.
To keep UDP working, send it somewhere else before the rule that catches it. Because rules are first-match, a network = "udp" rule placed first does this:
# UDP goes direct; everything else falls through to the HTTP proxy.[[route.rule]]outbound = "direct"network = "udp"
[[route.rule]]outbound = "corp-http"domain_suffix = ["example.com"]Tags, the default route and balancers
Section titled “Tags, the default route and balancers”- Tags must be unique. Two outbounds with the same tag fail with
duplicate outbound tag <tag>. - The first outbound is the default. Flows that match no rule go to
[route].defaultif it is set, and to the first[[outbound]]in the file otherwise. Put the outbound you want as the fallback first, or setdefaultexplicitly. See Routing. directandblackholeneed no block. When a rule or[route].defaultnamesdirectorblackholeand nothing carries that tag, etemenanki-app adds afreedomorblackholeoutbound with it.- A subscribe file’s nodes are outbounds, tagged with their names and added after yours. See Subscribe files.
- A balancer tag works wherever an outbound tag does, in
[route].defaultand in[[route.rule]].outbound. A balancer tag must not repeat an outbound tag. A balancer cannot list another balancer as a member: the member is reported asbalancer <tag> references unknown outbound <member>. - Unknown tags are errors. A rule or default that names no outbound or balancer fails with
route references unknown outbound <tag>.
[[outbound]]tag = "direct"protocol = "freedom"
[[outbound]]tag = "trojan-a"protocol = "trojan"server = "2001:db8::10"port = 443
[outbound.stream]network = "tls"
[outbound.stream.tls]server_name = "proxy.example.com"
[outbound.settings]password = "replace-with-a-long-random-password"
[[outbound]]tag = "ss-b"protocol = "shadowsocks"server = "203.0.113.20"port = 8388
[outbound.settings]method = "2022-blake3-aes-256-gcm"password = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" # generate with: openssl rand -base64 32
[[balancer]]tag = "pool"outbounds = ["trojan-a", "ss-b"]
[[route.rule]]outbound = "pool"domain_suffix = ["example.com"]Here direct stays the default because it comes first. Traffic for example.com goes to trojan-a while its health probe succeeds and to ss-b when it does not, because the default balancer strategy, failover, picks the first healthy member in list order. ss-b is a Shadowsocks outbound, so UDP for example.com is dropped whenever the balancer picks it. Add a network = "udp" rule ahead of this one if that matters.
Common errors
Section titled “Common errors”Errors in this table stop etemenanki-app --test -c config.toml and a normal start. Under --test the logged line starts with configuration invalid:; at start-up it starts with failed to start:.
| Message | Cause | Fix |
|---|---|---|
config defines no outbounds |
Nothing to send traffic to: no [[outbound]], no subscribe file, no route naming direct or blackhole |
Add at least one outbound, even if it is only freedom |
duplicate outbound tag <tag> |
Two outbounds share a tag | Rename one |
outbound <tag>: unknown protocol "…" |
A misspelt or capitalised protocol | Use one of the lowercase names in the protocol table |
outbound <tag>: missing server / missing port |
A proxy outbound without an upstream | Add server and port |
outbound <tag>: invalid address_family "…" |
A value outside the accepted list | Use auto, ipv4_only, ipv6_only, prefer_ipv4 or prefer_ipv6 |
outbound <tag>: protocol <protocol> does not support stream network "…" / stream security "…" |
[outbound.stream] on freedom, blackhole, wireguard or hysteria2 |
Remove the [outbound.stream] block |
outbound <tag>: invalid settings: missing field … / unknown field … |
A required setting is absent, or a key is misspelt | Check the protocol’s page for the exact keys |
outbound <tag>@v0: anytls runs over tls only; its shape must be tls |
An anytls outbound without network = "tls" |
Add [outbound.stream] with network = "tls" |
outbound <tag>@v0: reality is for vless only |
security = "reality" on a protocol other than VLESS |
Use TLS, or VLESS |
outbound <tag>@v0: vless vision (xtls-rprx-vision) rides only over reality |
flow = "xtls-rprx-vision" without security = "reality" |
Use REALITY, or remove flow |
outbound <tag>@v0: wireguard address_family ipv6_only needs an IPv6 address |
The policy excludes every tunnel address | Add a tunnel address of that family, or change the policy |
outbound <tag>: invalid endpoint_address_family "…" |
A WireGuard endpoint_address_family outside the accepted list |
Use one of the address_family values |
balancer <tag>: outbound <member> has no upstream a TCP health probe can reach |
A freedom, blackhole, hysteria2 or wireguard member |
Balance only stream proxies |
balancer <tag> references unknown outbound <member> |
A member that is not an outbound, including another balancer | Name outbounds only |
duplicate balancer tag … |
A balancer reuses an outbound’s tag, or an earlier balancer’s | Rename the balancer |
route references unknown outbound <tag> |
A rule or default names a tag that does not exist | Fix the tag, or define the outbound |
These appear only while traffic flows, in the debug log:
| Message | Cause |
|---|---|
dial: no usable <policy> destination address for <host>:<port> |
address_family filtered out every address of the destination or server (wireguard: instead of dial: for WireGuard) |
udp fan-out: opening an outbound failed: … carries no datagrams |
UDP was routed to http or shadowsocks |