Skip to content

socks ​

SOCKS4, SOCKS4a and SOCKS5. Compatible with sing-box socks.

Inbound ​

One TCP port for all three versions: CONNECT, and for SOCKS5 UDP ASSOCIATE (UDP packets through a separate UDP socket). Understands sing-box UDP-over-TCP (a connection to sp.v2.udp-over-tcp.arpa, or v1 sp.udp-over-tcp.arpa; see udp_over_tcp).

FieldTypeDefaultMeaning
userslist of {username, password}—SOCKS5 login and password; without the list the inbound is open

Socket settings are the listener block; its udp.timeout applies to UDP sessions. There are no tls and transport blocks. The domain_resolver field is not supported: startup ends with the error domain_resolver: not implemented yet.

Outbound ​

FieldTypeDefaultMeaning
serverhost:portrequiredThe SOCKS server address
version4, "4a", 5 (a number or a string)5The protocol version
username, passwordstring—Authentication (SOCKS4 only username)
networktcp, udp or a listbothWhat to pass through this outbound
udp_over_tcpblock—UDP inside TCP: udp_over_tcp

UDP goes through SOCKS5 UDP ASSOCIATE or, with udp_over_tcp, inside the TCP connection. SOCKS4 has no UDP of its own; with udp_over_tcp UDP still works over it.

Block: dial. There is no tls block.

Example ​

yaml
inbounds:
  socks-in:
    socks:
      listen: 0.0.0.0:1080
      users:
        - username: user
          password: pass
outbounds:
  upstream:
    socks:
      server: 192.0.2.10:1080
      version: "5"
      username: corp
      password: secret
      udp_over_tcp: {}
route:
  final:
    outbound: upstream

A minimal outbound:

yaml
outbounds:
  upstream:
    socks:
      server: 127.0.0.1:1080
route:
  final:
    outbound: upstream

Module description for developers: modules/socks.

GPL-3.0-or-later