mirror of
https://github.com/XTLS/Xray-examples.git
synced 2025-02-23 15:39:28 +08:00
121 lines
4.4 KiB
JSON
121 lines
4.4 KiB
JSON
{
|
||
"log": {
|
||
"loglevel": "debug"
|
||
},
|
||
"inbounds": [
|
||
// 请求在该入站中被解密
|
||
{
|
||
"port": 4431,
|
||
"listen": "127.0.0.1",
|
||
"tag": "tls-decrypt",
|
||
"protocol": "dokodemo-door",
|
||
"settings": {
|
||
"network": "tcp",
|
||
"followRedirect": true
|
||
},
|
||
"streamSettings": {
|
||
"security": "tls",
|
||
"tlsSettings": {
|
||
// 根据实际情况填写,这里适合绝大多数情况,如果你的网站仅支持 http/1.1, 就只保留 http/1.1
|
||
// ps: 如果你选择了 http/1.1 那么你甚至可以用后续的路由模块屏蔽部分路径
|
||
"alpn": [
|
||
"h2",
|
||
"http/1.1"
|
||
],
|
||
"certificates": [
|
||
{
|
||
"usage": "issue",
|
||
// 下面的证书和私钥使用 xray tls cert 命令生成,或者你的自签名证书也行
|
||
// 这会生成一个 CA 证书,每个新的要被 MITM 网站请求都会单独用这个 CA 签发一张临时证书
|
||
// 所以你只需要在系统信任这一张证书就可以了,或者你可以忍得了浏览器的红标无视风险继续访问也行
|
||
"certificate": [],
|
||
"key": []
|
||
}
|
||
]
|
||
}
|
||
}
|
||
},
|
||
// 真正用到的入站
|
||
{
|
||
"port": 10801,
|
||
"listen": "127.0.0.1",
|
||
"tag": "socks-in",
|
||
"protocol": "socks",
|
||
"sniffing": {
|
||
// 一般情况得开
|
||
"enabled": true,
|
||
"destOverride": [
|
||
"http",
|
||
"tls"
|
||
]
|
||
}
|
||
}
|
||
],
|
||
"outbounds": [
|
||
// 请求在该出站被强行重定向到 tls-decrypt 进行解密
|
||
{
|
||
"tag": "redirect-out",
|
||
"protocol": "freedom",
|
||
"settings": {
|
||
"redirect": "127.0.0.1:4431"
|
||
}
|
||
},
|
||
// 明文请求在这里被重新加密为正常 HTTPS 请求
|
||
{
|
||
"tag": "tls-repack",
|
||
"protocol": "freedom",
|
||
"settings": {
|
||
// 你要连接到的服务器的最终IP以及端口,大多数情况下需要手动寻找这样允许域前置的IP
|
||
"redirect": "104.20.19.168:443"
|
||
},
|
||
"streamSettings": {
|
||
"security": "tls",
|
||
"tlsSettings": {
|
||
// fromMitm 会在客户端发送仅有 alpn http/1.1(大多数时候是wss) 的情况下使用同样的alpn, 需要 v25.2+
|
||
// 旧版本没这个选项别直接把这玩意发出去了,从上面的alpn选项复制下来(当然更新版本最好)
|
||
"alpn": [
|
||
"fromMitm"
|
||
],
|
||
// 你要发送的假 SNI, 根据你的网站接受的 SNI 而定
|
||
// 当然你也可以留空或者我这样乱填个ip, 这样就不会有任何 SNI 扩展被发送,前提是你的网站接受无 SNI 请求
|
||
"serverName": "11.45.1.4",
|
||
// 你期望服务端返回证书里的包含的域名,这是新版本选项且要求 utls 启用,如果你手动禁用了 utls 或者是旧版本只能考虑开允许不安全
|
||
"serverNameToVerify": "e-hentai.org"
|
||
}
|
||
}
|
||
},
|
||
// 无辜流量直接放行
|
||
{
|
||
"tag": "direct",
|
||
"protocol": "freedom"
|
||
}
|
||
],
|
||
"routing": {
|
||
"domainStrategy": "AsIs",
|
||
"rules": [
|
||
{
|
||
"inboundTag": [
|
||
"tls-decrypt"
|
||
],
|
||
"outboundTag": "tls-repack"
|
||
},
|
||
{
|
||
"inboundTag": [
|
||
"socks-in"
|
||
],
|
||
// 你要 mitm 的网址
|
||
"domain": [
|
||
"e-hentai.org"
|
||
],
|
||
"outboundTag": "redirect-out"
|
||
},
|
||
{
|
||
"inboundTag": [
|
||
"socks-in"
|
||
],
|
||
"outboundTag": "direct"
|
||
}
|
||
]
|
||
}
|
||
}
|