VLESS — mihomo
mihomo 双端支持 VLESS。出站代理位于顶层 proxies 数组下(每个服务器 一个对象)。入站位于 listeners 数组下。字段名沿用 proxy: 标签 约定(出站)与 inbound: 标签约定(监听器入站)。
出站
proxies: 下 type: vless 条目。该结构体内嵌 BasicOption(所有 出站共享的字段:interface-name、routing-mark、ip-version、 dialer-proxy、mptcp 等),见代理页面。
| 字段 | 类型 | 默认值 | 允许值 | 描述 |
|---|---|---|---|---|
name | string | (required) | <string> | 唯一的代理名,会在 YAML 其他位置(proxy-groups、规则)引用。 |
server | string | (required) | <host> | 上游服务器主机名或 IP。 |
port | int | (required) | <port> | 上游服务器端口。 |
uuid | string | (required) | <UUID> | 服务器接受的用户 UUID。 |
flow | string | (empty) | | xtls-rprx-vision | flow 算法。空表示普通 VLESS;`xtls-rprx-vision` 启用 Vision(要求 TLS 或 REALITY)。 |
tls | bool | false | true | false | 用 TLS 包裹流。`xtls-rprx-vision` 必须启用。 |
alpn | []string | [] | h2 | http/1.1 | TLS 握手时宣告的 ALPN 列表。 |
udp | bool | false | true | false | 允许 UDP 包经此出站转发。 |
packet-addr | bool | false | true | false | 使用较旧的 packet-addr UDP 编码而非 xudp。 |
xudp | bool | false | true | false | 对 UDP 包使用 xudp 编码(现代默认)。与 packet-addr 互斥。 |
packet-encoding | string | (use udp/xudp flags) | packetaddr | xudp | 显式的 packet-encoding 选择器;设置后优先于布尔标志。 |
encryption | string | (unset) | none | mlkem768x25519plus.<...> | 可选的 VLESS 加密套件。`none`(或未设置)走经典模式。 |
network | string | tcp | tcp | ws | http | h2 | grpc | xhttp | 底层传输。非 tcp 时需要对应的 `*-opts` 块。 |
ech-opts | ECHOptions | (disabled) | ECHOptions | Encrypted Client Hello 配置;详见 TLS 页面。 |
reality-opts | RealityOptions | (disabled) | RealityOptions | REALITY 配置。需要 `tls: true`。 |
http-opts | HTTPOptions | (unset) | HTTPOptions | `network: http`(HTTP/1.1 伪装)的设置。 |
h2-opts | HTTP2Options | (unset) | HTTP2Options | `network: h2` 的设置。 |
grpc-opts | GrpcOptions | (unset) | GrpcOptions | `network: grpc` 的设置。 |
ws-opts | WSOptions | (unset) | WSOptions | `network: ws` 的设置。 |
xhttp-opts | XHTTPOptions | (unset) | XHTTPOptions | `network: xhttp`(XTLS HTTP 帧)的设置。 |
ws-headers | map[string]string | (unset) | {<header>: <value>} | WS 的旧式头部映射 —— 建议使用 `ws-opts` 内的 `headers` 字段。 |
skip-cert-verify | bool | false | true | false | 禁用 TLS 服务端证书校验。仅供测试。 |
fingerprint | string | (unset) | <SHA256 hex> | 把服务端 TLS 证书锚定到该 SHA-256 指纹。 |
certificate | string | (unset) | <PEM file path> | 客户端证书(mTLS)。 |
private-key | string | (unset) | <key file path> | 与 `certificate` 配对的私钥。 |
servername | string | (unset) | <SNI> | 覆盖握手发送的 TLS SNI。 |
client-fingerprint | string | (global) | chrome | firefox | safari | ios | edge | random | randomized | uTLS ClientHello 指纹。未设置时回退到 `global-client-fingerprint`。 |
源码: adapter/outbound/vless.go:50-79 · 锚定版本 v1.19.27 (5184081)
入站
listeners: 下 type: vless 条目。内嵌 BaseOption(通用监听器 字段:listen、port)。
| 字段 | 类型 | 默认值 | 允许值 | 描述 |
|---|---|---|---|---|
users | []VlessUser | (required) | <VlessUser array> | 可接受的客户端。 |
decryption | string | (unset) | none | mlkem768x25519plus.<...> | 入站期望的加密模式。`none` 或未设置接受普通 VLESS。 |
ws-path | string | (unset) | /<path> | 入站提供的 WebSocket 路径。 |
xhttp-config | XHTTPConfig | (unset) | XHTTPConfig | XHTTP 传输设置;客户端经 xhttp 连接时必填。 |
grpc-service-name | string | (unset) | <service name> | 入站提供的 gRPC 服务名。 |
certificate | string | (unset) | <PEM file path> | TLS 服务端证书(或内联 PEM)。 |
private-key | string | (unset) | <key file path> | 与 `certificate` 配对的 TLS 私钥。 |
client-auth-type | string | (none) | no-client-cert | request-client-cert | require-any-client-cert | verify-client-cert-if-given | require-and-verify-client-cert | mTLS 客户端鉴权模式。 |
client-auth-cert | string | (unset) | <PEM file path> | 作为客户端根的 CA 集合。 |
ech-key | string | (unset) | <ECH config> | Encrypted Client Hello 配置 / 密钥。 |
allow-insecure | bool | false | true | false | 在监听器上跳过 TLS 客户端证书校验(仅供测试)。 |
reality-config | RealityConfig | (disabled) | RealityConfig | REALITY 服务端配置;详见 TLS 页面。 |
mux-option | MuxOption | (disabled) | MuxOption | 与 sing 风格 mux 兼容的多路复用设置。 |
源码: listener/inbound/vless.go:12-27 · 锚定版本 v1.19.27 (5184081)
users[]
| 字段 | 类型 | 默认值 | 允许值 | 描述 |
|---|---|---|---|---|
username | string | (unset) | <string> | 用户显示名,用于统计与日志。 |
uuid | string | (required) | <UUID> | 用户 UUID。 |
flow | string | (empty) | | xtls-rprx-vision | 单用户 flow 算法。 |
源码: listener/inbound/vless.go:29-33 · 锚定版本 v1.19.27 (5184081)
示例
出站 —— WebSocket + TLS 的普通 VLESS:
yaml
proxies:
- name: vless-ws
type: vless
server: example.com
port: 443
uuid: a3482e88-686a-4a58-8126-99c9df64b7bf
network: ws
tls: true
udp: true
servername: example.com
ws-opts:
path: /vl
headers:
Host: example.com出站 —— REALITY + XTLS Vision:
yaml
proxies:
- name: vless-reality
type: vless
server: example.com
port: 443
uuid: a3482e88-686a-4a58-8126-99c9df64b7bf
flow: xtls-rprx-vision
tls: true
udp: true
xudp: true
servername: www.cloudflare.com
client-fingerprint: chrome
reality-opts:
public-key: <reality public key>
short-id: <short id>listeners 下的入站:
yaml
listeners:
- name: vless-in
type: vless
listen: 0.0.0.0
port: 443
users:
- username: alice
uuid: a3482e88-686a-4a58-8126-99c9df64b7bf
flow: xtls-rprx-vision
certificate: /etc/mihomo/server.crt
private-key: /etc/mihomo/server.key
reality-config:
enable: true
dest: www.cloudflare.com:443
short-id: ['', <short id>]说明
- mihomo 出站接受两套 UDP 编码开关:旧的布尔字段
udp、packet-addr、xudp,以及 现代选择器packet-encoding: xudp|packetaddr。 设置选择器后会忽略布尔字段。 - mihomo 的
client-fingerprint是 mihomo 特有的按代理 uTLS 指纹 覆盖。也可在全局通过global-client-fingerprint设置同样的值。 - 入站的
mux-option与 sing-box 的 multiplex 客户端兼容;与 Xray 的 mux 线路格式不同。 - 入站
reality-config接收一份 REALITY 服务端配置包(私钥、dest 目标、short-id 列表)。另一端的对应出站使用reality-opts与 公钥半部。
跨内核说明
- Xray 把入站用户放在
clients[]并使用id(UUID),支持更 丰富的fallbacks链,并要求设置decryption/encryption字段。参见 VLESS — Xray-core。 - sing-box 把入站用户放在
users[]并使用uuid,所有入站类型 共享内嵌的tls/transport/multiplex块。参见 VLESS — sing-box。 - mihomo 把传输、TLS、REALITY、ECH 与 UDP 编码选择 打包进 proxy 对象本身 —— 没有独立的
streamSettings/tls/transport块。
源码: adapter/outbound/vless.go:50-79 · v1.19.27 (5184081)
