Skip to content

REALITY

REALITY is a TLS 1.3 handshake in which a proxy server passes itself off as another site, the cover site, which the configuration calls dest. A client that holds the server’s public key seals a proof of that into its ClientHello; the server checks it, answers with a TLS 1.3 session of its own, and carries VLESS inside. Anyone else, whether a browser, a scanner or a client with the wrong key, is relayed to dest byte for byte and talks to the real site. The server needs no certificate and no domain of its own.

etemenanki-app speaks REALITY as a server and as a client since 2.6.0, as the stream security of a VLESS inbound or outbound over plain TCP: security = "reality" with an [inbound.stream.reality] or [outbound.stream.reality] table. It also serves and dials the XTLS Vision flow, which runs only over REALITY. This page covers both sides, the cover site, Vision, subscribe nodes and the errors. The VLESS protocol itself is on the VLESS page, and the other transports on Transports and TLS.

sequenceDiagram
    participant C as Client
    participant S as REALITY inbound
    participant D as dest, the cover site
    C->>S: TCP, then a TLS 1.3 ClientHello
    S->>D: TCP, then the ClientHello as it arrives
    Note over S: Check the SNI, the key share, the sealed session_id, the shortId, the version and the time
    alt the client is let in
        D-->>S: The cover site's ServerHello and handshake
        S-->>C: That ServerHello with the server's own key share, then a handshake signed for this client
        Note over S,D: The connection to dest is closed
        C->>S: VLESS inside the REALITY session
    else anyone else
        D-->>C: The cover site's answer, relayed byte for byte
        C->>D: Everything else, relayed both ways
    end
  • The client sends a name of the cover site, one of the server’s server_names, as its SNI, and seals its shortId, its version and the time into the TLS session_id under a key derived from the server’s public key. Only the holder of the matching private key can open it.
  • The server sends every byte of the ClientHello on to dest as it arrives, then decides. An authenticated client gets a handshake built from dest’s own ServerHello and record sizes, with a certificate only that client can verify. Everyone else stays connected to dest and sees dest’s real certificate and answers.

A server that accepts VLESS + REALITY on port 443, and a client that offers a local SOCKS port and sends everything to it. Generate your own key pair and shortId first (next section): the values in these files are placeholders that parse but must not be used.

server.toml
# A VLESS + REALITY server on port 443 with two users and a direct exit.
# The private key and the shortId are placeholders that parse but must not be used:
# generate a key pair with `xray x25519` (or with OpenSSL, see the REALITY page)
# and a shortId with `openssl rand -hex 8`. Replace www.example.com with the
# TLS 1.3 site this server passes itself off as, and the UUIDs with your own.
[log]
level = "info"
[[inbound]]
tag = "reality-in"
protocol = "vless"
listen = "0.0.0.0"
port = 443
# REALITY runs over plain TCP and brings its own TLS 1.3: no certificate.
[inbound.stream]
network = "tcp"
security = "reality"
[inbound.stream.reality]
private_key = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" # keep the real one secret
server_names = ["www.example.com"] # the SNIs clients send, matched exactly
short_ids = ["0123456789abcdef"] # each client presents one of these
dest = "www.example.com:443" # where everyone else is relayed
[inbound.settings]
users = [
{ id = "11111111-2222-3333-4444-555555555555", email = "alice@example.com" },
{ id = "11111111-2222-3333-4444-666666666666", email = "bob@example.com" },
]
[[outbound]]
tag = "direct"
protocol = "freedom"
[[outbound]]
tag = "block"
protocol = "blackhole"
[route]
default = "direct"
# Keep clients away from the server's own private networks.
[[route.rule]]
outbound = "block"
cidr = ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "127.0.0.0/8", "fc00::/7", "::1/128"]

Check each file with etemenanki-app --test -c server.toml. The test reads the keys and settings but does not reach dest, so it passes without network access. Both sides need the same user UUID. The client also needs the public key that belongs to the server’s private key, one of the server’s server_names and one of its short_ids.

  1. Make an X25519 key pair. With Xray installed, xray x25519 prints both halves:

    PrivateKey: <43 characters, goes in the server's private_key>
    Password (PublicKey): <43 characters, goes in the client's public_key>

    Without Xray, OpenSSL and GNU coreutils make the same pair:

    Terminal window
    openssl genpkey -algorithm X25519 -out reality.pem
    openssl pkey -in reality.pem -outform DER | tail -c 32 | basenc --base64url | tr -d '=' # private_key
    openssl pkey -in reality.pem -pubout -outform DER | tail -c 32 | basenc --base64url | tr -d '=' # public_key
  2. Make one shortId per client or group of clients: openssl rand -hex 8 prints 16 hex digits. Shorter shortIds work too (an even number of digits), and "" is a valid shortId of its own.

  3. Put the private key, the shortIds, the cover site and its names on the server. Give each client the public key, one shortId and one server name.

Both keys are unpadded base64url, the form Xray writes: a key with = padding, or with the + and / of standard base64, is refused. Keep the private key secret; the public key and the shortIds are what clients hold. No error message repeats a key or a shortId.

A REALITY inbound is a VLESS inbound whose [inbound.stream] says security = "reality", with network = "tcp" or no network at all. It needs no certificate. The REALITY keys go in [inbound.stream.reality]:

KeyTypeRequiredDefaultDescription
private_keystringyes—The server's X25519 private key as unpadded base64url of 32 bytes (43 characters), the PrivateKey line of xray x25519. Padding (=), the + and / of standard base64, spaces or a wrong length fail with reality.private_key: invalid REALITY private key: expected 32 bytes of unpadded base64url; leaving it out fails with reality needs reality.private_key. No error repeats the key. Keep it secret: anyone who has it can pose as this server.
server_namesarray of stringsyes—The server names (SNI) a client may send to be let in, matched exactly. At least one (reality needs reality.server_names). A wildcard or an empty name fails with invalid reality server name "…"; a trailing dot, a name over 253 bytes or a character other than letters, digits, -, . and _ fails with building inbound <tag> failed: invalid REALITY server name "…". Use names that dest serves: a probe that sends one gets dest's own certificate for it. A client that sends any other name is relayed to dest.
short_idsarray of stringsyes—The shortIds a client may present, each an even number of hex digits, at most 16, in either case. A shorter value is padded with zeros to 8 bytes, as in Xray, so "ab" and "ab00" are the same shortId, and "" is the all-zero one. At least one entry (reality needs reality.short_ids); a malformed one fails with reality.short_ids: invalid REALITY shortId: expected an even number of hex digits, at most 16, without repeating the value. Generate one with openssl rand -hex 8.
deststringyes—The site this server passes itself off as, host:port; an IPv6 literal goes in brackets ([2001:db8::1]:443). The server dials it over TCP for every connection, with the system resolver and outside routing. Leaving it out fails with reality needs reality.dest (host:port), a value without a colon with reality.dest must be host:port, a port that is 0 or not a number with invalid reality.dest port, an empty host with reality dest needs a host.
max_time_diffu64no—Seconds. A client whose clock, as sealed in its hello, differs from the server's by more than this is relayed to dest. Unset or 0 does not check. Xray's maxTimeDiff is in milliseconds.
min_client_versionstringno—The lowest client version let in, inclusive, as x.y.z; fewer parts leave the rest zero (25 is 25.0.0). The version is the one a REALITY client seals into its hello; a client below it is relayed to dest. Each part must be a decimal number below 256, or the config fails with reality.min_client_version: invalid REALITY client version "…": expected x.y.z, each part below 256. etemenanki-app's own client reports 26.6.27.
max_client_versionstringno—The highest client version let in, inclusive, in the same format. A minimum above the maximum fails with reality min_client_version is above max_client_version.
require_hybridboolnofalseLet in only a client whose hello carries exactly one X25519MLKEM768 key share, placed before any X25519 one: the rule XTLS REALITY servers follow since 2026-10. Off, the server takes the first X25519 share, or the X25519 half of a hybrid share. sing-box and mihomo clients send an X25519 share alone, so they are relayed to dest when this is on; Xray v26.10.17 clients and etemenanki-app's own client send the hybrid share first and pass either way.

The users, the optional flow and everything else about VLESS stay in [inbound.settings] (VLESS inbound settings). An inbound that listens on a Unix socket carries no transport, and refuses REALITY with protocol vless over a unix socket does not support stream security "reality".

A reload that changes the REALITY settings or the flow keeps the listener: new connections get the new settings, and connections already open keep the ones they were accepted with, as for a certificate change. A key or value that cannot be used refuses the reload and keeps the running configuration.

A REALITY outbound is a VLESS outbound with security = "reality" in [outbound.stream] and the server’s details in [outbound.stream.reality]:

KeyTypeRequiredDefaultDescription
public_keystringyes—The server's X25519 public key as unpadded base64url of 32 bytes: the Password (PublicKey) line of xray x25519, Xray's publicKey or password. Leaving it out fails with reality needs reality.public_key, a malformed value with reality.public_key: invalid REALITY public key: expected 32 bytes of unpadded base64url. With a key that is not the server's, the server relays the client to dest, and the client refuses dest's real certificate: the connection fails with REALITY TLS: decrypt error.
server_namesarray of stringsdepends—The client sends the first entry as its SNI; it must be one of the server's server_names. Without an entry the SNI is [outbound.stream.tls] server_name, then server, and with none of them the config fails with reality needs reality.server_names, tls.server_name or server. A wildcard fails with outbound proxy@v0: invalid reality server name "*.example.com".
short_idsarray of stringsno[]The client presents the first entry as its shortId, in the server's format: an even number of hex digits, at most 16. Without an entry it presents the all-zero shortId, which the server lets in only when its short_ids include it (""). A malformed value fails with reality.short_ids: invalid REALITY shortId: expected an even number of hex digits, at most 16.

The outbound dials server and port like any VLESS outbound, one connection per flow. Its ClientHello is the one Chrome sends, with an X25519MLKEM768 key share first and a separate X25519 share after it; there is no fingerprint setting. It reports the client version 26.6.27, which matters only to a server that sets client-version bounds.

dest is the site whose TLS handshake the server borrows and to which it relays everyone it does not let in.

  • Dialed for every connection. Each accepted connection makes the server open a TCP connection to dest before it reads the ClientHello. The server dials dest directly and resolves its name with the system resolver: the dial goes around routing and the [dns] section, and it is not counted as any user’s traffic. For an authenticated client, the connection to dest is closed once its handshake has been captured.
  • A TLS 1.3 site. The server copies dest’s ServerHello and pads its own handshake messages to the sizes of dest’s records. dest must answer the client’s hello with TLS 1.3, an X25519 or X25519MLKEM768 key exchange and no HelloRetryRequest, and its records must be large enough to hold the server’s own messages, which is the case for an HTTPS site that serves the requested name and acknowledges it. When dest’s answer cannot be copied, the client is relayed to dest instead, and the debug log says dest's handshake cannot be mirrored.
  • Names it serves. List in server_names names that dest has a certificate for. A probe that connects with one of them receives dest’s certificate for that name.
  • When dest is down, nobody gets in. Every connection fails, and the server logs one warning a minute: reality: dest … unreachable, so no client gets in: …. Clients see the connection close during the handshake.

A connection that is not let in becomes a relay between the client and dest. The client gets exactly what dest sends, including its certificate, its HTTP answers and its timing, and none of the bytes it receives come from etemenanki-app.

  • The relay never counts toward an IP ban, such as katana’s (device limits and IP bans), whatever the reason it was not let in.
  • It counts as a live connection of the inbound until it closes, and it closes after 300 seconds with no bytes in either direction.
  • A client that sends nothing, or stops halfway through its ClientHello, is left to dest: after 10 seconds without a decision the connection becomes a relay, and dest’s own timeout applies.

With [log] level = "debug", each relay logs one line, for example reality-in: Some(198.51.100.7) goes to dest: shortId not accepted. The reason is one of these:

Reason Meaning
not a TLS ClientHello The first bytes are not TLS: a plain HTTP request, a scanner, another protocol.
client closed before its ClientHello The client disconnected before its hello was complete.
ClientHello without TLS 1.3 The client does not offer TLS 1.3.
server name not accepted The SNI is not one of server_names.
no usable key share No X25519 share REALITY can use, or, with require_hybrid, not the hybrid share first.
not authenticated The session_id does not open under this server’s key: an ordinary TLS client, or a REALITY client with another server’s public key.
client version out of bounds The client’s version is outside min_client_version and max_client_version.
client time too far off The client’s clock is further than max_time_diff from the server’s.
shortId not accepted The shortId is not one of short_ids.
dest sent data before the ClientHello dest spoke first.
dest's handshake cannot be mirrored dest’s answer is not one the server can copy; see the cover site above.
handshake timed out No decision within 10 seconds.

require_hybrid decides which clients a server lets in by the key shares in their ClientHello. Off, the default, the server authenticates with the first X25519 share, or with the X25519 half of a hybrid X25519MLKEM768 share. On, it requires exactly one hybrid share placed before any X25519 share, the rule XTLS REALITY servers follow since 2026-10.

Client Key shares it sends Let in with require_hybrid = true
etemenanki-app X25519MLKEM768, then X25519 Yes
Xray v26.10.17 with fingerprint = "chrome" X25519MLKEM768, then X25519 Yes
sing-box and mihomo X25519 only No: relayed to dest with no usable key share

Leave require_hybrid off unless every client you serve sends the hybrid share. etemenanki-app’s own client sends the hybrid share first, so it also reaches Xray servers that enforce the strict rule.

XTLS Vision (xtls-rprx-vision) changes how the VLESS body travels over REALITY. Vision pads the first frames of the tunnel so that the lengths of the VLESS header and of an inner TLS handshake do not show. When the tunnel carries a TLS 1.3 session of its own, for example a browser’s HTTPS connection, both ends can then drop the REALITY layer and copy the raw TCP socket, so the inner TLS is not encrypted twice.

Turn it on with flow in the VLESS settings on both sides:

server.toml
[inbound.settings]
flow = "xtls-rprx-vision" # every user of this inbound
users = [
{ id = "11111111-2222-3333-4444-555555555555", email = "alice@example.com" },
]
client.toml
[outbound.settings]
id = "11111111-2222-3333-4444-555555555555"
flow = "xtls-rprx-vision"
  • REALITY only. Vision on any other transport, plain TLS included, fails with vless vision (xtls-rprx-vision) rides only over reality.
  • One flow per inbound. flow sits beside users and applies to every user of the inbound. A flow inside a user entry is refused (unknown field `flow`, expected `id` or `email`).
  • Both sides must agree. A Vision inbound refuses a request without the flow, and an inbound without Vision refuses a request that carries it. The client then sees its connection close; the server logs the reason at debug (see Common errors).
  • Other flows are refused when the configuration is read: unknown vless flow "xtls-rprx-direct". An empty string is the same as no flow.
  • The raw switch. Once an inner TLS 1.3 handshake is over, each end tells the other that it is leaving REALITY and sends over the raw socket from then on; it reads the raw socket once the other end has said the same. Xray does the same, so the switch happens against an Xray peer in either role and, since etemenanki-app 2.7.3, between two etemenanki-apps as well.
  • UDP rides XUDP. Since etemenanki-app 2.7.3 a Vision outbound carries UDP as Xray’s client does, as XUDP inside the tunnel: each packet names its own destination, so a SOCKS UDP association through it reaches every peer it sends to. A packet larger than 8 KiB is dropped. Earlier versions could not carry UDP through a Vision outbound. A Vision inbound accepts XUDP from Xray and etemenanki-app clients alike.
Xray JSON etemenanki-app TOML
streamSettings.network = "tcp" (or "raw"), security = "reality" [.stream] network = "tcp", security = "reality"
Server realitySettings.dest or target [inbound.stream.reality] dest
Server realitySettings.serverNames server_names
Server realitySettings.privateKey private_key
Server realitySettings.shortIds short_ids
Server realitySettings.maxTimeDiff (milliseconds) max_time_diff (seconds)
Server realitySettings.minClientVer, maxClientVer min_client_version, max_client_version
Client realitySettings.publicKey or password [outbound.stream.reality] public_key
Client realitySettings.serverName server_names = ["…"]
Client realitySettings.shortId short_ids = ["…"]
Inbound clients[].flow [inbound.settings] flow, for the whole inbound
Outbound users[0].flow [outbound.settings] flow

These Xray settings have no counterpart and fail as unknown fields or unknown values:

Xray setting What happens here
target Unknown field: write dest.
fingerprint Unknown field. The client always sends Chrome’s ClientHello.
spiderX, show, xver, masterKeyLog, mldsa65Seed, mldsa65Verify, limitFallbackUpload, limitFallbackDownload Unknown fields.

An unknown key in [inbound.stream.reality] or [outbound.stream.reality] fails the whole file with TOML parse error at line <n>, column <m>, pointing at the key. | REALITY under XHTTP or gRPC | security = "reality" needs network = "tcp". | | Vision over TLS | vless vision (xtls-rprx-vision) rides only over reality. | | xtls-rprx-vision-udp443 | unknown vless flow "xtls-rprx-vision-udp443". |

The integration tests run etemenanki-app against a real xray-core v26.10.17, with a local TLS 1.3 server as dest, and compare the bytes that come back.

Case Xray client, etemenanki-app server etemenanki-app client, Xray server
VLESS + REALITY, a TCP payload Tested Tested
VLESS + REALITY + Vision, a TCP payload Tested Tested
Vision with an inner TLS 1.3 session, through the raw switch Tested Tested
UDP through Vision, as XUDP, to two peers Tested Tested
A client with the wrong shortId or public key does not get through Tested Tested (wrong public key)
A plain TLS probe receives dest’s certificate Tested Not applicable

A subscribe file can hand a client a VLESS + REALITY node. REALITY is its own network in the node’s stream table, with no tls table:

subscribe.toml
[[proxy_server]]
name = "reality-node"
server = "203.0.113.10"
port = 443
protocol = "vless"
id = "11111111-2222-3333-4444-555555555555"
flow = "xtls-rprx-vision" # optional
stream = { network = "reality", public_key = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", server_name = "www.example.com", short_id = "0123456789abcdef" }
Key Required Meaning
public_key Yes The server’s public key, as in [outbound.stream.reality].
server_name Yes The SNI the client sends: a name of the cover site, not the node’s own server.
short_id No The shortId the client presents. Left out, the client presents the all-zero shortId.

etemenanki-app turns the node into a VLESS outbound with security = "reality", and flow into the outbound’s flow. A REALITY stream without public_key or server_name, or with a tls table, makes the subscribe file fail to parse. A REALITY stream on any node but VLESS fails with outbound reality-node@v0: reality is for vless only. The subscribe page covers the rest of the file.

katana serves VLESS + REALITY nodes, with or without Vision, with the settings the panel sends for the node; a katana configuration has no stream.reality table. The katana protocols page lists which panel settings it reads and when it refuses a node.

Configuration errors appear when you run --test or start the program, and when a hot reload is refused:

Error Cause Fix
inbound reality-in: security = "reality" needs network = "tcp" REALITY under tls, ws or grpc Set network = "tcp" or leave it out
inbound reality-in: reality is for vless only security = "reality" on a Trojan, VMess, SOCKS, Shadowsocks or other inbound Use VLESS
outbound proxy@v0: reality is for vless only The same on an outbound Use VLESS
inbound reality-in: reality needs reality.private_key (also .server_names, .short_ids, .dest (host:port)) A required key is missing Add it
inbound reality-in: reality.private_key: invalid REALITY private key: expected 32 bytes of unpadded base64url Not a 43-character base64url key: padded, standard base64, or a public key cut short Copy the PrivateKey line of xray x25519
outbound proxy: reality.public_key: invalid REALITY public key: expected 32 bytes of unpadded base64url The same for the client’s key Copy the server’s public key
inbound reality-in: reality.short_ids: invalid REALITY shortId: expected an even number of hex digits, at most 16 A shortId with an odd length, more than 16 digits or a non-hex character Use openssl rand -hex 8
inbound reality-in: invalid reality server name "*.example.com" A wildcard or empty name List each name in full
building inbound reality-in failed: invalid REALITY server name "www.example.com." A trailing dot, a character outside letters, digits, -, . and _, or a name over 253 bytes Write the plain host name
inbound reality-in: reality.dest must be host:port / invalid reality.dest port / reality dest needs a host dest without a port, with port 0 or a name, or without a host Write host:port, an IPv6 address in brackets
inbound reality-in: reality.min_client_version: invalid REALITY client version "1.x": expected x.y.z, each part below 256 A version that is not up to three decimal parts below 256 Write x.y.z
inbound reality-in: reality min_client_version is above max_client_version Reversed bounds Swap them
outbound proxy: reality needs reality.public_key A client without the server’s key Add public_key
outbound proxy: reality needs reality.server_names, tls.server_name or server No name to send as the SNI Add server_names
inbound reality-in: unknown vless flow "xtls-rprx-direct" A flow other than Vision Use xtls-rprx-vision or remove flow
inbound reality-in: vless vision (xtls-rprx-vision) rides only over reality (an outbound says outbound proxy@v0: …) Vision without REALITY Add REALITY, or remove flow
TOML parse error at line <n>, column <m>, at a key of [.stream.reality] A key that does not exist here, such as Xray’s fingerprint or target Remove or rename it; see Coming from Xray

At run time, with [log] level = "debug":

Log line Where Meaning
reality: dest … unreachable, so no client gets in: … Server, warn, once a minute dest cannot be reached; every connection fails.
reality-in: Some(…) goes to dest: <reason> Server A connection was relayed to dest; the reasons are in the table above.
vless connection from … ended: proxy core: vless flow (xtls vision) is not served by this core Server A Vision client reached an inbound without flow.
vless connection from … ended: transport: vless vision: the request did not carry the vision flow Server A client without Vision reached a Vision inbound.
… ended: REALITY TLS: decrypt error Client The server relayed the client to dest: a wrong public key, shortId or server name. The server’s debug log names which.
… ended: REALITY: server closed during the handshake Client The server closed the connection, for example because its dest is unreachable.