Skip to content

anytls ​

AnyTLS: inside a TLS connection, the SHA-256 of the password, then a session of framed streams with padding that hides the characteristic packet lengths of "TLS inside TLS". Each stream starts with the destination address; UDP goes as UDP-over-TCP v2 inside a stream. Compatible with sing-box anytls (sing-anytls 0.0.11).

The client keeps finished sessions and gives the freshest one to the next connection: there is one stream at a time in each session. The server accepts any number of streams in a session.

Inbound ​

FieldTypeDefaultMeaning
userslist of {name, password}requiredUsers
padding_schemestring or list of stringsthe sing-anytls schemeThe padding scheme the server tells clients; the lines are as in sing-box

The default scheme:

text
stop=8
0=30-30
1=100-400
2=400-500,c,500-1000,c,500-1000,c,500-1000,c,500-1000
3=9-9,500-1000
4=500-1000
5=500-1000
6=500-1000
7=500-1000

Socket settings are the listener block. The tls block is required in practice; without it the inbound works over bare TCP. The client must authenticate within 15 seconds.

The inbound has no fallbacks. The password must come in the first read after TLS; a client without a password or with someone else's gets the built-in answer, like Caddy without a site for that name. For an inbound open to the internet, REALITY is more reliable: a probe sees a real site. An inbound with TLS on a non-loopback address without REALITY writes a warning about this at startup.

Outbound ​

FieldTypeDefaultMeaning
serverhost:portrequiredThe server address
passwordstringrequiredThe password
idle_sessionblock—Idle sessions: check_interval — how often to check (30s), timeout — after how much idleness to close (30s), min — how many to always keep (0)
client_metadatastring—Client metadata passed to the server when a stream is opened

Timeout values of 5 seconds or less are replaced with 30 seconds. The tls block is required (a `tls` block is required). The dial block, without tcp.fast_open (tcp_fast_open is not supported with anytls outbound).

Example ​

yaml
inbounds:
  anytls-in:
    anytls:
      listen: ":443"
      users:
        - name: alice
          password: secret
      tls:
        certificate_path: /etc/ours/cert.pem
        key_path: /etc/ours/key.pem
outbounds:
  anytls-out:
    anytls:
      server: anytls.example.com:443
      password: secret
      tls:
        sni: anytls.example.com
        utls:
          fingerprint: chrome
      idle_session:
        timeout: 60s
        min: 2
route:
  final:
    outbound: anytls-out

Module description for developers: modules/anytls.

GPL-3.0-or-later