On this page
Facts
What it is
TCP proxy inside TLS that reshapes its first packets
Since, by
2025, the anytls project (reference code anytls-go)
Transport
TCP; UDP inside it via udp-over-tcp v2
Encryption
The outer TLS only, nothing of its own
To the network it looks like
TLS to your own server, first packets cut and padded
Usual port
Any; a link without a port means 443
Comes as
anytls:// link, sing-box or mihomo config
License
anytls-go has no license file; sing-box is GPL-3.0
Latest release
anytls-go v0.0.13, June 27, 2026
In Veli
Windows, macOS, Linux · sing-box JSON
Own server from the app
No
Versions and history
- Feb 2025
anytls-go 0.0.1
The reference client and server appear on GitHub. sing-box merges the protocol on 20 February for its 1.12 line.
- Mar 2025
mihomo 1.19.3 and a new default scheme
mihomo adds a client and a server on 3 March. On 11 March anytls-go 0.0.5 changes the default padding: packet 0 becomes a fixed 30 bytes instead of 34–120, and packet 3 starts with a 9-byte piece.
- Apr 2025
Protocol version 2
anytls-go 0.0.8 adds a reply when the server's outgoing connection opens, heartbeats and server settings, so a client can notice a stuck tunnel and drop it early. If either side is older, both speak version 1.
- Aug 2025
sing-box 1.12.0
The first stable sing-box with an AnyTLS inbound and outbound comes out on 4 August.
- Aug 2026
Client name off by default
sing-box 1.13.16 and 1.14 stop sending the client's name and version unless told to, mihomo 1.19.30 does the same. The anytls-go authors publish a note in defence of the field on the same day.
How AnyTLS works
The layers, from the bottom: TCP, TLS, a session, and streams, one per site or app connection. AnyTLS encrypts nothing itself: secrecy and the server's identity come from TLS, and its own job is the shape of the traffic and the reuse of connections. The FAQ credits smux for the sessions and restls for the padding scheme.
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-1000The number is the write, the ranges are sizes in bytes of TLS plaintext, c means: stop here if there is no more data. The authors call this set an example and say they can't promise it won't be blocked; that is why the server can hand out its own.
- Login. Right after the TLS handshake the client sends SHA-256 of the password (32 bytes), a two-byte length and some padding. With a wrong password the server closes the connection, or hands it to an ordinary web server if the operator set up a fallback.
- Sessions take turns. A session is one TLS connection. When a stream ends, its session goes into an idle pool, and the next stream takes the newest idle session instead of making a new handshake. One session carries one stream at a time. sing-box and mihomo look at the pool every 30 seconds and close sessions idle for longer than 30 seconds.
- Padding scheme. A short list says how big the first writes of a session must be. Write 0 is the login, write 1 carries the settings and the first address, write 2 is usually the browser's own TLS ClientHello. Writes up to
stop(8 by default) are cut and padded; after that data goes as it is. - The server owns the scheme. The client puts an MD5 of its scheme into its settings. If the server's scheme differs, it sends its own, and every new session follows it, so the look of the traffic can change on the server without updating clients.
- UDP travels as a stream to the special address
sp.v2.udp-over-tcp.arpa, by sing-box's udp-over-tcp, version 2.
The anytls:// link, field by field
The project describes the format itself, modelled on the Hysteria2 link: anytls://password@host:port/?parameters#name. Without a port it means 443.
anytls://p4ssw0rd@vpn.example.com:443/?sni=vpn.example.com#Server-1- p4ssw0rd: the password, in the user part of the address; special characters are percent-encoded.
- vpn.example.com:443: the server. An IPv6 address goes in square brackets.
- sni: the name for TLS. If an IP address stands here, the client must send no SNI at all.
- insecure=1: don't check the certificate. The reference server makes a new self-signed certificate at every start, so its links carry this, and then anyone on the path can pose as the server.
- #Server-1: the display name, percent-encoded.
- Anything else isn't in the format: apps may add their own parameters, and others needn't read them.
The same server in sing-box and mihomo
{
"type": "anytls",
"tag": "proxy",
"server": "vpn.example.com",
"server_port": 443,
"password": "p4ssw0rd",
"tls": {
"enabled": true,
"server_name": "vpn.example.com",
"utls": { "enabled": true, "fingerprint": "chrome" }
}
}tls is required. idle_session_check_interval, idle_session_timeout (30s each) and min_idle_session (0) set the reuse; client_metadata (1.13.16 and newer) sets the name sent to the server.
proxies:
- name: Server-1
type: anytls
server: vpn.example.com
port: 443
password: "p4ssw0rd"
client-fingerprint: chrome
udp: true
sni: vpn.example.comAn older core stops with unsupport proxy type: anytls. From 1.19.30 the client name is sent only if client-metadata is set.
sing-box
AnyTLSYes, from 1.12
NoteClient and server
mihomo (Clash Meta)
AnyTLSYes, from 1.19.3
NoteClient and server; AnyTLS with Reality isn't supported on purpose
v2rayN, Throne, Hiddify
AnyTLSYes
NoteThrough sing-box inside
Clash Verge Rev, Clash Party, FlClash
AnyTLSYes
NoteThrough mihomo inside
Shadowrocket 2.2.65 and newer, Stash, Loon
AnyTLSYes
NoteiPhone apps named in the anytls-go README
Xray, V2Ray, v2rayNG
AnyTLSNo
NoteXray has no AnyTLS
What a censor sees
From the outside, AnyTLS is a TLS connection to your server: the SNI is your domain or nothing, the certificate is yours or self-signed, and the ClientHello is whatever your client's TLS library sends. The FAQ says the look of the TLS handshake isn't the project's focus.
What it works against is the pattern described by Diwen Xue and colleagues at USENIX Security 2024 (“Fingerprinting Obfuscated Proxy Traffic with Encapsulated TLS Handshakes”). At a mid-size ISP with over a million users, their classifier recognised 70–88% of the flows of TLS proxies without padding or multiplexing (Trojan, VLESS and VMess over TLS, Shadowsocks over ShadowTLS) by the sizes and timing of the browser's handshake inside, with false alarms on about 0.05% of ordinary TLS flows. Random padding alone brought detection down only to 51% (XTLS Vision); streams interleaved in one connection, to 12–37%.
AnyTLS's two measures map onto that: it cuts and pads the first writes of a connection, where the inner handshake sits, and it reuses connections, so a new site brings no fresh outer handshake. It doesn't interleave streams, though: a session carries one stream at a time, and in the reference code the padding counter belongs to the session, so on a reused connection the next site's handshake goes unpadded.
The authors list other traces themselves: server replies aren't shaped, three or more packets leave almost at once after the TLS handshake, and TLS inside TLS needs more round trips than any normal HTTP/2 request. Without a fallback site, the server can also be probed. What isn't known: we found no published measurement of AnyTLS itself.
If it doesn't connect
ERR_CONNECTION_CLOSEDin the browser, nothing in the logCauseThe password is wrong
What to doCompare it with the server
unsupport proxy type: anytlsCauseThe mihomo core is older than 1.19.3
What to doUpdate the client or its core
x509: certificate signed by unknown authorityCauseA self-signed certificate
What to do
insecure=1for your own server, or a real certificateThe app doesn't recognise
anytls://CauseThere is no AnyTLS in it, or it takes only configs
What to doAdd the server as sing-box JSON
One app connects, another doesn't, with the same data
CauseThe server looks at the client's name
What to doAsk the service which programs it allows
Strengths and weaknesses
Strengths
- Pads the first writes of each connection, where the inner TLS handshake shows
- Reuses TLS connections: no new outer handshake for every site
- The server can change the padding scheme for all its clients at once
- Little to set up: a password and an ordinary TLS block
Weaknesses
- Only the client's direction is shaped; server replies go unpadded
- TCP only, with TCP's troubles on lossy lines; UDP rides inside it
- Not in Xray, so not in v2rayNG and other Xray apps
- Clients may send their name and version, and some services filter by it
- No published measurement of how it holds up against a real filter
Where it works
Programs and servers from our comparison tables that list this protocol.
Clients
- Hiddify
- Karing
- v2rayN
- NekoBox for Android
- Throne
- Clash Verge Rev
- Clash Party
- FlClash
- Shadowrocket
- Stash
- mihomo
- sing-box
- PassWall
- PassWall 2
Servers and panels
- S-UI
- Hiddify Manager