AnyTLS protocol: how it works, the anytls:// link and what a censor sees

AnyTLS is a proxy protocol from 2025 that runs inside ordinary TLS and changes the sizes of the first packets of each connection, so that a TLS handshake carried inside TLS is harder to recognise. It also keeps TLS connections open and reuses them for the next site. sing-box 1.12 and newer and mihomo 1.19.3 and newer speak it; Xray, and so v2rayNG, don't.

Updated

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

  1. 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.

  2. 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.

  3. 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.

  4. Aug 2025

    sing-box 1.12.0

    The first stable sing-box with an AnyTLS inbound and outbound comes out on 4 August.

  5. 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.

The default padding scheme, from the protocol description
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

The 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.

Example
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

sing-box 1.12 or newer: an outbound
{
  "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.

mihomo 1.19.3 or newer: a line of proxies
proxies:
  - name: Server-1
    type: anytls
    server: vpn.example.com
    port: 443
    password: "p4ssw0rd"
    client-fingerprint: chrome
    udp: true
    sni: vpn.example.com

An 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_CLOSED in the browser, nothing in the log

    CauseThe password is wrong

    What to doCompare it with the server

  • unsupport proxy type: anytls

    CauseThe mihomo core is older than 1.19.3

    What to doUpdate the client or its core

  • x509: certificate signed by unknown authority

    CauseA self-signed certificate

    What to doinsecure=1 for your own server, or a real certificate

  • The 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

Compare these programs

Sources

How we write and check

In Veli

AnyTLS in Veli: on a computer, as sing-box JSON

Veli takes AnyTLS in one way so far: as a sing-box configuration. Copy the JSON from the section above, put in your address, password and name, and paste it into Profiles → Add, or drop a .json file with it into the window. The profile shows as AnyTLS, connects through the sing-box module on Windows, macOS and Linux, and the rules of Apps and sites work on it.

An anytls:// link isn't recognised, in a subscription such lines are left out, and from a Clash list the app skips these servers and says so: “the anytls type is not supported”. On Android AnyTLS doesn't connect at all, because the app there runs on Xray. Veli doesn't install it on your own server either.

Questions

What is the difference between AnyTLS and Reality?

Reality (Xray, sing-box) makes your server pass for a real site you pick, so no domain or certificate of your own is needed. AnyTLS uses your own TLS and works on what comes after the handshake: packet sizes and connection reuse. sing-box accepts Reality in the tls block of AnyTLS; mihomo doesn't support the pair and says it won't.

Does AnyTLS work in Clash?

In mihomo (Clash Meta) 1.19.3 and newer, as type anytls, and so in Clash Verge Rev, Clash Party and FlClash. An older core stops with “unsupport proxy type: anytls”.

Is AnyTLS detectable?

Its padding goes after the pattern that a 2024 USENIX study used to spot TLS inside TLS, but nobody has published a test of AnyTLS itself. Server replies aren't padded, and the authors list several other traces it leaves.

AnyTLS or Hysteria2?

Different tools: AnyTLS is TCP inside TLS, Hysteria2 is QUIC over UDP with its own congestion control. Where UDP is cut, only the first one passes; the AnyTLS authors say comparing the two on speed makes no sense.

Does AnyTLS need a domain?

For a real certificate, yes. With a self-signed one it works, but the client then can't check who it is talking to.

Does v2rayNG support AnyTLS?

No: it runs on Xray, and Xray has no AnyTLS. On Android it is in apps built on sing-box or mihomo.