Transport Layer Configuration
Protocols like VMess/VLESS/Trojan can use different underlying transports (network), each with its own *-opts configuration block.
ws-opts (WebSocket)
network: ws ws-opts: path: /path headers: Host: example.com v2ray-http-upgrade: false
path is the request path; headers are the request headers; max-early-data/early-data-header-name configure the Early Data first-packet length threshold; v2ray-http-upgrade/v2ray-http-upgrade-fast-open establish the connection via HTTP Upgrade (required by some CDN setups).
grpc-opts
network: grpc grpc-opts: grpc-service-name: example
grpc-service-name is the gRPC service name; ping-interval is the heartbeat interval in seconds (off by default); max-connections defaults to 1 (a single underlying connection); min-streams/max-streams control the number of streams per connection — these three settings are mutually exclusive, so pick whichever strategy fits your needs. Mihomo's H2 transport doesn't implement multiplexing, so gRPC or sing-mux (see the smux common field) is recommended if you need it.
h2-opts / http-opts
network: http http-opts: method: "GET" path: - '/' - '/video' headers: Connection: - keep-alive
In h2-opts, host is a list of host domains (the client picks one at random, and the server is responsible for validating it), and path is the request path.
mkcp-opts
Currently only VMess supports the mKCP transport — do not use it with other protocols.
| Field | Description |
|---|---|
mtu / tti | Maximum transmission unit / transmission interval (in milliseconds) |
uplink-capacity / downlink-capacity | Upload/download capacity, in MB/s |
congestion | Whether to enable congestion control |
write-buffer / read-buffer | Read/write buffer size, in bytes |
seed | The seed used for AES-GCM authentication; leave blank to use the default authentication |
header | The disguise packet header — choose none/srtp/utp/wechat-video/dtls/wireguard |
xhttp-opts
Currently only VLESS supports the xhttp transport. Only h2 mode is supported by default — enable h3 by setting alpn: [h3], or HTTP/1.1 by setting alpn: [http/1.1].
network: xhttp xhttp-opts: path: "/" host: xxx.com # mode: "stream-one" # Choose from stream-one / stream-up / packet-up # x-padding-bytes: "100-1000" # reuse-settings: # This is XMUX connection reuse # max-concurrency: "16-32"
There are quite a few fields here, mainly path/host (the request path and hostname), mode (the stream mode), a set of x-padding-* padding/obfuscation parameters, and reuse-settings (XMUX connection reuse settings, controlling how many concurrent requests a single underlying connection can carry). If you don't have special CDN compatibility needs, the defaults are fine.
mekya-opts
Currently only VMess supports the Mekya transport.
An HTTP-polling-based transport that includes a set of KCP parameters (with the same meaning as mkcp-opts above). Core fields: url the server address, max-write-delay the maximum time to wait to aggregate data after the first packet (in milliseconds), max-request-size the maximum payload size per HTTP request (in bytes), and h2-pool-size the HTTP/2 connection pool size.