Skip to content

Transports and multiplexing ​

Ours: modules/transports/{ws,grpc,http,httpupgrade,xhttp}, the shared code — modules/transports/transport. The kind is chosen by the key of the transport block; an unknown one — unknown transport `x`; available: ….

sing-box's V2Ray transports ​

WhatStatusWhereVerdict
quic (the V2Ray QUIC transport)nono transport.quic kind is registered; the quic extension of modules/transports/transport is the dialer of XHTTP over HTTP/3, not the V2Ray QUIC transport; in subscriptions — unsupported QUIC transport (modules/config/subscriptions/src/links.rs)rarely needed: removed in Xray, rare in subscriptions
grpcpresent: on top of our own h2, with grpc-status in trailers and grpc-go's answers to foreign requests; our own message length limit (16 MiB); the client sends User-Agent: grpc-go/1.48.0modules/transports/grpc, crates/proto/src/h2/grpc.rs—
grpc client: compression of its own messages, multiModeno: we accept gzip-compressed and TunMulti, we send uncompressed in Tun ourselvescrates/proto/src/h2/grpc.rsrarely needed
httppresent (h2 with TLS, h1 without)modules/transports/http—
ws (with early data), httpupgradepresentmodules/transports/ws, httpupgrade—
The User-Agent of ws and httpupgrade clientsdifferent: under utls — that of the browser with the same fingerprint and version (for random/randomized — the chosen one), without utls — Go-http-client/1.1, as in sing-box; sing-box sends the Go one even with a Chrome fingerprint. The other browser headers (Origin, Accept-Language, Sec-WebSocket-Extensions) are absent, the order is Go'slibs/tls13/src/presets.rs (user_agent), Setup::browser—
path of ws and httpupgrade, host of httpupgradedifferent: path is the path itself on both sides: the client escapes every byte that needs it, % included, as Xray's httpupgrade client does; the server unescapes the request path and compares, as both references' servers do. sing-box's client takes path as already escaped: /a%20b goes out as is from it and as /a%2520b from ours. With early data in the path, the server compares the escaped path (sing-box compares it as written and refuses a path that needs escaping). A host outside visible ASCII is a configuration error: Go's client sends an IDN in punycode and Go's server refuses anything elsecrates/proto/src/http1.rs (escape_path, path), modules/transports/{ws,httpupgrade}—

The fields of ws, grpc, http, httpupgrade match the reference's option/v2ray_transport.go by name.

WhatStatusWhereVerdict
The server's answers to foreign requests (another path, host, method, not HTTP)present: as with the reference's Go net/http: the standard phrase, Date, Content-Length: 0, the connection stays open for the next request; on a ws path — the gobwas/ws textscrates/proto/src/http1.rs (serve, refuse)—
The same: the body of a refused requestdifferent: chunked and a body larger than 256 KiB close the connection (Connection: close); Go skips up to 256 KiB and chunkedthe same placerarely needed
The same: a head longer than 64 KiB, lines with a single \ndifferent: the connection is closed silently; Go answers 431 and accepts \nthe same placerarely needed
The same in HTTP/2different: the fields are as in Go (content-length, date); the HPACK encoding (indexing, Huffman) is our ownmodules/transports/http, xhttprarely needed

Xray transports ​

WhatStatusWhereVerdict
XHTTP (splithttp)beyond the reference (sing-box)modules/transports/xhttp—
XHTTP packet-up: the default scMinPostsIntervalMs pausedifferent: skipped when a full request is already queued; one set explicitly is always honouredmodules/transports/xhttp/src/client.rs (Posts::run)— (in Xray the upload is capped at 1 MB per 30 ms, ~270 Mbit/s per connection)
XHTTP scStreamUpServerSecs, serverMaxHeaderBytes, trustedXForwardedFor, congestionController, cwnd, h2Paramssilent in subscriptions (server or QUIC parameters)modules/config/subscriptions/src/xhttp.rs (IGNORED)—
XHTTP ranges (xPaddingBytes, uplinkChunkSize, sessionIDLength and others as from-to)different: one value; from a subscription the lower bound is taken (for sessionIDLength — the upper one)the same place—
XHTTP server: padding in the stream-up response every scStreamUpServerSecsno: the response has no body until the upload endsmodules/transports/xhttp/src/server.rsrarely needed: Xray clients do not expect it
XHTTP HTTP/3 and download for trojanno: only for vlessmodules/protocols/vless/src/connector.rsrarely needed: on request
RAW/TCP with header.type: httppartial: read without TLS, over TLS — unsupported TCP header over TLS: httpmodules/config/subscriptions/src/links.rs, xray.rsrarely needed
mKCPno—rarely needed: rare in subscriptions
domainsocket, quicno—junk: removed in Xray
XDRIVE (a tunnel through Google Drive or a templated HTTP backend)no—rarely needed: appeared in v26.9.30
masque (CONNECT-IP as a transport)no—rarely needed, together with the MASQUE endpoints (see protocols.md)
finalmask (sudoku, header-*, mkcp-*, salamander outside Hysteria 2, xdns, xicmp, xmc, udpHop, realm)no; fragment, noise — silentmodules/config/subscriptions/src/common.rs (masks)fragment — do through TLS fragmentation; the rest — rarely needed

Multiplexing (mux) ​

WhatStatusWhereVerdict
smux, yamux, h2muxpresentmodules/protocols/mux—
mux for vmessnosee protocols.mdmissing: together with vmess

GPL-3.0-or-later