Skip to content

shadowtls ​

ShadowTLS v1, v2, v3. The client performs a real TLS handshake with a real site (handshake); the ShadowTLS server forwards it and only watches; after the handshake the traffic of the inner protocol goes over the same connection — unwrapped (v1), in application data records (v2) or in records signed with HMAC (v3). To an observer this is a TLS session with a real site. Compatible with sing-box shadowtls.

ShadowTLS itself does not carry a destination address: it is a wrapper for another protocol, usually Shadowsocks:

  • on the server, the shadowtls inbound hands the decrypted connection to the inbound given in detour;
  • on the client, the shadowtls outbound only establishes the connection to the server, and another outbound goes through it with dial.detour.

Inbound ​

FieldTypeDefaultMeaning
version1, 2, 31The protocol version
passwordstring—The password (v2)
userslist of {name, password}—Users (v3, required)
handshakeblockrequired, except with wildcard_sniThe site for the handshake: server: host:port and an optional dial block (interface, fwmark, detour…)
handshake.by_snimapping "SNI → a block like handshake"—A separate site for particular SNIs; the sing-box handshake_for_server_name is an error with a hint
strict_modeboolfalsev3: strict mode, like sing-box strict_mode
wildcard_snioff, authed, alloffHandshake with the site from the client's SNI (port 443): authed only for those who passed the check, all for everyone
detourinbound name—Where to hand the connection after the handshake; a name that does not exist is a build error

Socket settings are the listener block. The inbound has no tls block: TLS is run by the real site.

Outbound ​

FieldTypeDefaultMeaning
serverhost:portrequiredThe ShadowTLS server address
version1, 2, 31The version
passwordstring—The password (v2) or the user's password (v3)

The tls block is required: sni is the name of the site from the server's handshake. v1 forces TLS 1.2; v3 requires uTLS and without a utls block takes the chrome fingerprint. The dial block works as usual.

Example: Shadowsocks over ShadowTLS v3 ​

Server:

yaml
inbounds:
  shadowtls-in:
    shadowtls:
      listen: ":443"
      version: 3
      users:
        - name: alice
          password: shadow-secret
      handshake:
        server: www.example.com:443
      detour: ss-in
  ss-in:
    shadowsocks:
      listen: 127.0.0.1:8388
      method: 2022-blake3-aes-128-gcm
      password: dPbOJ32Gm1iOmcGttUzeBQ==
outbounds:
  direct:
    direct:
route:
  final:
    outbound: direct

Client:

yaml
outbounds:
  ss:
    shadowsocks:
      method: 2022-blake3-aes-128-gcm
      password: dPbOJ32Gm1iOmcGttUzeBQ==
    dial:
      detour: shadowtls-out
  shadowtls-out:
    shadowtls:
      server: st.example.com:443
      version: 3
      password: shadow-secret
      tls:
        sni: www.example.com
        utls:
          fingerprint: chrome
route:
  final:
    outbound: ss

ss has no server: the connection is established by shadowtls-out anyway.

The site's address here is written as server: host:port, as in REALITY (handshake.server); a separate server_port is an error.

GPL-3.0-or-later