Skip to content

xray VLESS-TCP-Reality + xtls-rprx-vision +nginx stream 443 sni 分流端口复用 + Proxy Protocol 访客IP是127.0.0.1 #1697

@heygo1345678

Description

@heygo1345678

日志:2023/02/23 01:52:46 127.0.0.1:52556 accepted tcp:github.githubassets.com:443 [VLESS-TCP-Reality >> direct]
nginx stream 配置:

map $ssl_preread_server_name $stream_map {

xtls.test vless;
www.microsoft.com real;

}

upstream vless {
server 127.0.0.1:8443;
}

upstream real {
server 127.0.0.1:44443 ;

}

stream模块监听443端口,并进行端口复用

server {
listen 443 reuseport ;
listen [::]:443 reuseport ;
proxy_pass $stream_map;
ssl_preread on;
proxy_protocol on; # 开启Proxy protocol

}

}

reality版本:

xray version

Xray 1.7.5 (Xray, Penetrates Everything.) 4d5c319 (go1.20.1 linux/amd64)
A unified platform for anti-censorship.

reality服务器配置文件:
{
"log": {
"loglevel": "warning"
},

"inbounds": [
    {

"tag": "VLESS-TCP-Reality",
"listen": "0.0.0.0",
"port": 44443, //服务器监听端口号,可以不是443,防火墙打开或者vps面板操作:iptables -I INPUT -p tcp --dport 8443 -j ACCEPT
"protocol": "vless",
"settings": {
"clients": [
{
"id": "",
"flow": "xtls-rprx-vision" //解决tls in tls流量特征
}
],
"decryption": "none"
},
"streamSettings": {

"tcpSettings": {
          "acceptProxyProtocol": true
        },
"network": "tcp",
"security": "reality",      //魔改的tls协议 reality
"realitySettings": {
  
  
  "show": false,
  "privateKey": "",        //使用上面生成的私钥
  "shortIds": [
    ""
  ],
  "Dest": "61.147.219.124:443",     //这个是sni白名单网站www.microsoft.com的cdn IP和 https网站端口号
  "type": "tcp",
  "serverNames": [
    "www.microsoft.com"
  ]
}

}
}
],
"outbounds": [
{
"protocol": "freedom",
"tag": "direct"
}
]
}

客户端配置:
{
"log": {
"loglevel": "warning"
},

"inbounds": [
     {
       // "listen": "127.0.0.1",
        "port": 10000, // 本地监听端口
        "protocol": "socks",
        "settings": {
            "udp": true
        },
        "sniffing": {
            "enabled": true,
            "destOverride": [
                "http",
                "tls"
            ]
        }
    }
	
	
	
	
	
	
],
"outbounds": [
     {
"tag": "VLESS-TCP-Reality",
"protocol": "vless",
"settings": {
  "vnext": [
    {
      
      "address": "1.2.3.4",        //这里是vps服务器节点IP
      "port": 443,  		 //vps服务器节点端口号
      "users": [
        {
          "id": "",
          "encryption": "none",
          "flow": "xtls-rprx-vision"              //解决tls in tls流量特征
        }
      ]
    }
  ]
},
"streamSettings": {
  "network": "tcp",
  "security": "reality",                   //魔改的tls协议 reality
  "realitySettings": {
    "publicKey": "",                 //公钥验证,用于验证服务器预防中间人攻击
    "shortId": "",
    "serverName": "www.microsoft.com",          //客户端向sni白名单的境外网站 偷证书发起假装的连接,糊弄gfw,
    "fingerprint": "chrome",       //模拟uTLS指纹,糊弄gfw以为是浏览器访问
    "spiderX": "/"
  }
}

}
]

}
相同的action build版本,用老的xtls是可以获取访客IP的:
2023/02/23 01:51:52 [Warning] infra/conf: You are using an old version of XTLS, which is deprecated now and will be removed soon. Please use flow "xtls-rprx-vision" with "tls & tlsSettings" instead.
2023/02/23 01:51:52 [Warning] transport/internet/websocket: accepting PROXY protocol
2023/02/23 01:51:52 [Warning] core: Xray 1.7.5 started
2023/02/23 01:51:53 234.12.31.12:38640 accepted tcp:149.12.1.100:80
nginx stream配置同上;
xray配置文件:
{
"log": {

"loglevel": "warning"

},
"inbounds": [
{
"port": 8443,
"protocol": "vless",
"settings": {
"clients": [
{
"id": "",
"flow": "xtls-rprx-direct"
}
],
"decryption": "none",
"fallbacks": [
{
"dest": 60000,
"alpn": "",
"xver": 1
},
{
"dest": 60001,
"alpn": "h2",
"xver": 1
},
{
"dest": 60002,
"path": "/9d/",
"xver": 1
},
{
"name": "",
"dest": 5003,
"xver": 1
},
{
"name": "",
"alpn": "h2",
"dest": 5004,
"xver": 1
},
{
"alpn": "http/1.1",
"dest": 800
},
{
"alpn": "h2",
"dest": 801
}

    ]
  },
  "streamSettings": {
    "network": "tcp",
    "security": "xtls",
	"tcpSettings": {
          "acceptProxyProtocol": true
        },
    "xtlsSettings": {
      "minVersion": "1.2",
      "certificates": [
        {
          "certificateFile": "/root/ecc/fullchain.cer",
          "keyFile": "/root/ecc/top.key"
        }
        
      ]
    }
  },
  "sniffing": {
    "enabled": true,
    "destOverride": [
      "http",
      "tls"
    ]
  }
},
{
  "port": 60002,
  "listen": "127.0.0.1",
  "protocol": "vless",
  "settings": {
    "clients": [
      {
        "id": ""
      }
    ],
    "decryption": "none"
  },
  "streamSettings": {
    "network": "ws",
    "security": "none",
    "wsSettings": {
      "acceptProxyProtocol": true,
      "path": "/970c/"
    }
  }
},
{
  
   "port": 60003,
  "listen": "127.0.0.1",
  "protocol": "vless",
  "settings": {
    "clients": [
      {
        "id": ""
      }
    ],
    "decryption": "none"
  },
  "streamSettings": {
    "network": "grpc",
    "security": "none",
    "grpcSettings": {
      "serviceName": "enjoy"
    }
  }
}

],
"outbounds": [
{
"protocol": "freedom"
}
]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions