Files
2026-05-27 15:30:41 +08:00

3.9 KiB

入站配置

对应 settings.toml[inbounds][inbounds.api]

设置 UI 默认值 可选值 作用 什么时候修改
listen 显示 127.0.0.1 127.0.0.1 / 0.0.0.0 普通入站、规则入站、VMess 入站监听地址。 只给本机用选 127.0.0.1;局域网设备要访问代理端口选 0.0.0.0
port_sharing 隐藏 false bool true 时监听地址强制变成 0.0.0.0 当前 UI 用 listen 控制,通常不改。
socks_port 隐藏 20170 0-65535 普通 SOCKS 入站,流量最终兜底走 proxy。UI 保存时写 0 需要无规则 SOCKS 入口时手改。
http_port 隐藏 20171 0-65535 普通 HTTP 入站,流量最终兜底走 proxy。UI 保存时写 0 需要无规则 HTTP 入口时手改。
rule_socks_port 隐藏 0 0-65535 旧版规则 SOCKS 入站兼容字段。当前 UI 保存时写 0 通常不改。
rule_http_port 显示为 Mixed 端口 20172 0-65535 规则 mixed 入站,同一个端口同时支持 HTTP 和 SOCKS,流量按 [routing] 规则分流。 浏览器、系统代理、CLI 工具显式代理时使用。
auth_user 显示 "" 字符串 mixed/SOCKS 入站认证用户名。 需要给局域网开放代理但不想裸奔时设置。
auth_password 显示 "" 字符串 mixed/SOCKS 入站认证密码。 auth_user 一起设置;两者都为空时使用 noauth
vmess_port 隐藏 0 0-65535 额外 VMess 入站。0 不生成。 当前很少需要。
inbound_sniffing 显示 http,tls,quic disable / http,tls / http,tls,quic 写入每个支持入站的 sniffing.destOverride 域名路由不准时保持开启;兼容性异常时降级或关闭。
route_only 显示 false bool 写入 sniffing.routeOnly 只希望嗅探域名用于路由、不改连接目标时开启。
domains_excluded 隐藏 "" 换行分隔域名 写入 sniffing.domainsExcluded 特定域名被 sniffing 影响时手改。
api.port 隐藏 0 0-65535 Xray API 入站端口,0 不生成。 需要 Xray API 服务时手改。
api.services 隐藏 ["LoggerService"] 字符串数组 写入 Xray api.services,生成时确保包含 LoggerService 需要额外 API service 时手改。
custom 隐藏 [] [[inbounds.custom]] 额外 socks/http 入站。 需要多个固定端口或不同 tag 时手改。

自定义入站

设置 默认值 可选值 作用
tag 非空字符串 入站 tag。
protocol socks / http 入站协议。
port 1-65535 监听端口。

生成影响

入站 tag 来源 路由行为
socks / http socks_port / http_port 不进入 [routing] 模式规则,最终兜底走 proxy
rule-mixed rule_http_port 同一端口支持 HTTP 和 SOCKS,进入 [routing] 模式规则。
vmess vmess_port 额外 VMess 入站。
api-in api.port 路由到 api-out

Mixed 入站

rule-mixed 生成示例:

{
  "tag": "rule-mixed",
  "listen": "0.0.0.0",
  "port": 20172,
  "protocol": "mixed",
  "settings": {
    "auth": "noauth",
    "udp": true,
    "allowTransparent": false
  }
}

如果填写用户名和密码:

"settings": {
  "auth": "password",
  "udp": true,
  "allowTransparent": false,
  "accounts": [
    {"user": "alice", "pass": "secret"}
  ]
}

使用方式:

curl -x http://10.11.11.100:20172 http://google.com/
curl --socks5-hostname 10.11.11.100:20172 https://google.com/
curl -x http://alice:secret@10.11.11.100:20172 http://google.com/
curl --socks5-hostname alice:secret@10.11.11.100:20172 https://google.com/