Skip to content

direct ​

Outbound ​

Connects to the target by itself: resolves the domain through DNS (or takes the addresses found by a route action) and opens a TCP/UDP socket. The usual target for "no proxy".

The protocol block is empty: direct: without fields. Everything about how to open the connection is in the dial block: interface, fwmark, source address, timeouts. detour is forbidden for direct. override_address/override_port (removed in sing-box 1.13) and a non-zero proxy_protocol are load errors; use route actions instead.

A direct outbound without a dial block, with tproxy and auto_nft, counts as a "target in the kernel": the kernel can route such traffic by itself without handing it to the process (see tproxy).

Inbound ​

Accepts TCP connections and UDP packets on its address and sends them to the fixed target override (without it, to the inbound's own address). This is how a simple port forward or a local DNS inbound is made.

FieldTypeDefaultMeaning
networktcp, udp or a listbothWhat to accept
overridehost:portthe inbound's addressThe target; ":53" replaces only the port. The sing-box names override_address, override_port are an error with a hint

Socket settings are the listener block. There are no tls and transport blocks.

Example ​

Forwarding UDP/53 to an external resolver, and a direct outbound through a second interface:

yaml
inbounds:
  dns-forward:
    direct:
      listen: 127.0.0.1:5353
      network: udp
      override: 1.1.1.1:53
outbounds:
  direct:
    direct:
  wan2:
    direct:
    dial:
      interface: eth0
      fwmark: 0x10
route:
  rules:
    - match:
        inbound: dns-forward
      to:
        outbound: wan2
  final:
    outbound: direct

A minimal outbound:

yaml
outbounds:
  direct:
    direct:
route:
  final:
    outbound: direct

Module description for developers: modules/direct.

GPL-3.0-or-later