Details
xray.json配置:
{
"dns": {},
"inbounds": [],
"log": {},
"outbounds": [],
"policy": {},
"routing": {}
}
dns.json配置:
{
"dns": {
"hosts": {
"www.google.cn": "www.google.com",
"googleapis.cn": "googleapis.com"
},
"servers": [
{
"address": "127.0.0.1",
"port": 1053
}
],
"tag": "dns_outbound"
}
}
inbounds.json配置:
{
"inbounds": [
{
"port": 1080, // 监听端口
"listen": "127.0.0.1",
"protocol": "socks", // 入口协议为 SOCKS 5
"settings": {
"udp": true //是否开启 UDP 协议的支持。默认值为 false。 true | false
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls",
"quic"
],
"routeOnly": true
},
"tag": "socks-in"
}
]
}
log.json配置:
{
"log": {
"access": "/dev/fscklogs/access.log",
"error": "/dev/fscklogs/error.log",
"loglevel": "warning"
}
}
outbounds.json配置:
{
"outbounds": [
{
"protocol": "vless",
"tag": "xhttp-reality",
"settings": {
"vnext": [
{
"address": "xxxxxxxxxxxxxx.com",
"port": 443,
"users": [
{
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"level": 0,
// "flow": "xtls-rprx-vision",
"encryption": "none"
}
]
}
]
},
"streamSettings": {
"network": "xhttp",
"xhttpSettings": {
"mode": "stream-up",
"path": "/xxxxxxxxxxxxxx",
"host": "xxxxxxxxxxxxxx.com",
"scMaxEachPostBytes": "500000-1000000",
"scMaxConcurrentPosts": "30-100",
"scMinPostsIntervalMs": "30-50", // 仅客户端
"xPaddingBytes": "50-1000",
"xmux": { // 仅客户端
"maxConcurrency": 0,
"maxConnections": 128,
"cMaxReuseTimes": "16-64",
"cMaxLifetimeMs": 0
},
"downloadSettings": {
"address": "xxxxxxxxxxxxxx.com",
"port": 443,
"network": "xhttp",
"xhttpSettings": {
"mode": "stream-up",
"path": "/xxxxxxxxxxxxxx",
"host": "xxxxxxxxxxxxxx.com",
"scMaxEachPostBytes": "500000-1000000",
"scMaxConcurrentPosts": "30-100",
"scMinPostsIntervalMs": "30-50", // 仅客户端
"xPaddingBytes": "50-1000",
"xmux": { // 仅客户端
"maxConcurrency": 0,
"maxConnections": 128,
"cMaxReuseTimes": "16-64",
"cMaxLifetimeMs": 0
}
},
"security": "reality",
"realitySettings": {
"show": false, // 选填,若为 true,输出调试信息
"serverName": "xxxxxxxxxxxxxx.com", // 服务端 serverNames 之一
"fingerprint": "chrome", // 必填,使用 uTLS 库模拟客户端 TLS 指纹
"shortId": "xxxxxxxxxxxxxxxxx", // 服务端 shortIds 之一
"publicKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", // 服务端私钥对应的公钥
"spiderX": "/" // 爬虫初始路径与参数,建议每个客户端不同
}
}
},
"security": "reality",
"realitySettings": {
"show": false, // 选填,若为 true,输出调试信息
"serverName": "xxxxxxxxxxxxxx.com", // 服务端 serverNames 之一
"fingerprint": "chrome", // 必填,使用 uTLS 库模拟客户端 TLS 指纹
"shortId": "xxxxxxxxxxxxxxxxxxx", // 服务端 shortIds 之一
"publicKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", // 服务端私钥对应的公钥
"spiderX": "/" // 爬虫初始路径与参数,建议每个客户端不同
},
"sockopt": {
"mark": 255,
"tcpMptcp": true,
"tcpNoDelay": true,
"tcpMaxSeg": 1440,
"tcpFastOpen": 0,
"tproxy": "off",
"domainStrategy": "AsIs",
"tcpKeepAliveInterval": 15,
"tcpKeepAliveIdle": 10
}
}
},
{
"protocol": "blackhole",
"settings": {
"response": {
"type": "http" // "http" | "none":为"none"(默认值)时,直接关闭连接;为"http"时,会发回一个简单的 HTTP 403 数据包,然后关闭连接。
}
},
"tag": "adblock"
},
{
"protocol": "freedom", // 默认直连,只有路由匹配的域名或IP才转发
"settings": {
"fragment": {
"packets": "tlshello",
"length": "50-200",
"interval": "10-200" // 单位ms
},
"noises":[
{
"type":"rand",
"packet":"50-100",
"delay":"50-500"
}
]
},
"streamSettings": {
"sockopt": {
"mark": 255,
"tcpMptcp": true,
"tcpNoDelay": true
}
},
"tag": "direct"
}
]
}
policy.json配置:
{
"policy": {
"levels": {
"0": {
"handshake": 15, // 在入站代理处理一个新连接时,在握手阶段如果使用的时间超过这个时间,则中断该连接。
"connIdle": 300, // 处理一个连接时,如果在 connIdle 时间内,没有任何数据被传输(包括上行和下行数据),则中断该连接。
"uplinkOnly": 0, // 当连接下行线路关闭后的时间限制。
"downlinkOnly": 0, // 当连接上行线路关闭后的时间限制。
"bufferSize": 512, // 每个连接的内部缓存大小。单位为 kB。
"statsUserUplink": false, // 当值为true时,开启当前等级的所有用户的上行流量统计。
"statsUserDownlink": false // 当值为true时,开启当前等级的所有用户的下行流量统计。
}
},
"system": {
"statsInboundUplink": false, // 当值为true时,开启所有入站代理的上行流量统计。
"statsInboundDownlink": false // 当值为true时,开启所有入站代理的下行流量统计。
}
}
}
routing.json配置:
{
"routing": {
"domainStrategy": "AsIs", // "AsIs": 只使用域名进行路由选择。默认值;"IPIfNonMatch": 当域名没有匹配任何规则时,将域名解析成 IP(A 记录)再次进行匹配;
"domainMatcher": "hybrid",
"rules": [
{
"type": "field",
"domain": [ // 要屏蔽的域名
"ext:h2y.dat:ad"
],
"outboundTag": "adblock"
},
{
"type": "field",
"domain": [ // DNS域名代理
"full:dns.google",
"full:dns.google.com"
],
"outboundTag": "xhttp-reality"
},
{
"type": "field",
"ip": [ // DNS-IP代理
"8.8.8.8",
"8.8.4.4",
"2001:4860:4860::8888",
"2001:4860:4860::8844"
],
"outboundTag": "xhttp-reality"
},
{
"type": "field",
"inboundTag": [ // dokodemo-door
"http-in"
],
"outboundTag": "xhttp-reality"
},
{
"type": "field",
"domain": [ // 要代理的域名
"ext:h2y.dat:gfw"
],
"outboundTag": "xhttp-reality"
},
{
"type": "field",
"port": "8000",// 要直连的端口
"network": "tcp,udp",
"outboundTag": "direct"
},
{
"type": "field",
"domain": ["geosite:cn"],// CN直连的域名
"outboundTag": "direct"
},
{
"type": "field",
"ip": [ // CN直连的IP
"geoip:private",
"geoip:cn"
],
"outboundTag": "direct"
}
]
}
}
Details
{
"log": {
"access": "/var/log/xray/access.log",
"error": "/var/log/xray/error.log",
"loglevel": "warning"
},
"inbounds": [
{
"port": 443,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
// "flow": "xtls-rprx-vision",
"level": 0
}
],
"decryption": "none",
"fallbacks": [
{
"dest": "5678",
"xver": 1
}
]
},
"streamSettings": {
"network": "xhttp",
"xhttpSettings": {
"path": "/xxxxxxxxxxxxx",
"host": "xxxxxxxxxxxxx.com",
"scMaxEachPostBytes": 1000000,
"scMaxConcurrentPosts": 100,
"scStreamUpServerSecs": "20-80", // 服务端每隔这段时间就会发xPaddingBytes个字节以保活
"noSSEHeader": false, // 仅服务端,不发送 Content-Type: text/event-stream 响应头
"xPaddingBytes": "50-1000"
},
"security": "reality",
"realitySettings": {
"show": false, // 选填,若为true,输出调试信息
"target": "5678", // 服务端配置, 转发给自己选定的目标网站。目标网站使用别人的一般为 xx.yy:443。目标网站最低标准:国外网站,支持TLSv1.3、X25519与H2,域名非跳转用(主域名可能被用于跳转到www)
"xver": 1, // 选填,默认关闭 PROXY protocol 发送。
"serverNames": [ // 必填,客户端可用的 serverName 列表,暂不支持 * 通配符。
"xxxxxxxxxxxxx.com",
"www.xxxxxxxxxxxxx.com" // Chrome-输入"dest"的网址-F12-安全-F5-主要来源(安全),填证书SAN的值
],
"privateKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", // 执行/usr/local/bin/xray x25519生成,填"Privatekey"的值
"minClientVer": "24.11.11", // 选填,客户端Xray最低版本,格式为x.y.z
"maxTimeDiff": 180000, // 选填,允许的最大时间差,单位为毫秒
"shortIds": [// 必填,客户端可用的shortId列表,可用于区分不同的客户端
"xxxxxxxxxxxxxxxx",
"xxxxxxxxxxxxxxxx",
"xxxxxxxxxxxxxxxx" // 0到f,长度为2的倍数,长度上限为16,可留空,或执行/bin/openssl rand -hex 8生成
]
},
"sockopt": {
"tcpMaxSeg": 1440,
"tcpFastOpen": true,
"tproxy": "off",
"tcpKeepAliveInterval": 15,
"tcpKeepAliveIdle": 10
}
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls",
"quic"
],
"routeOnly": true
},
"tag": "xhttp-reality"
}
],
"outbounds": [
{
"protocol": "socks",
"settings": {
"servers": [
{
"address": "127.0.0.1",
"port": 9050
}
]
},
"tag": "out-tor"
},
{
"protocol": "freedom", // 默认直连,只有路由匹配的域名或IP才转发
"settings": {},
"tag": "direct"
},
{
"protocol": "blackhole",
"settings": {},
"tag": "adblock"
}
],
"dns": {
"hosts": {
"captive.v2ex.co": "23.251.125.131",
"captive.v2ex.co": "23.251.126.131"
},
"servers": [
"8.8.8.8",
"8.8.4.4"
]
},
"policy": {
"levels": {
"0": { // 单位为秒。
"handshake": 15, // 在入站代理处理一个新连接时,在握手阶段如果使用的时间超过这个时间,则中断该连接。
"connIdle": 300, // 处理一个连接时,如果在 connIdle 时间内,没有任何数据被传输(包括上行和下行数据),则中断该连接。
"uplinkOnly": 0, // 当连接下行线路关闭后的时间限制。
"downlinkOnly": 0, // 当连接上行线路关闭后的时间限制。
"bufferSize": 512 // 每个连接的内部缓存大小。单位为 kB。
}
}
},
"routing": {
"domainStrategy": "AsIs", // "AsIs": 只使用域名进行路由选择。默认值;"IPIfNonMatch": 当域名没有匹配任何规则时,将域名解析成 IP(A 记录)再次进行匹配;
"domainMatcher": "hybrid",
"rules": [
{
"type": "field",
"domain": [
"geosite:cn"
],
"outboundTag": "adblock"
},
{
"type": "field",
"ip": [
"geoip:cn"
],
"outboundTag": "adblock"
},
{
"type": "field",
"domain": [
"regexp:\\.onion$"
],
"outboundTag": "out-tor"
}
]
}
}
完整性要求
描述
我之前反馈过这个问题,从v25.4.30版就存在,当时说没有提供完整的配置和日志,这次更新到了v25.5.16和最新测试版(https://github.com/XTLS/Xray-core/actions/runs/15265062423)也还是存在这样的问题:手机平台是android16X64 BP31.250502.008,服务端、客户端同样的配置,手机上用Xray-android-arm64-v8a时,测试连网,不能连通;使用Xray-linux-arm64-v8a时,测试连网,可连通。
重现方式
N/A
客户端配置
Details
服务端配置
Details
客户端日志
Details
服务端日志
Details