真诚友善团结专业,共建你我引以为荣之社区。《常见问题解答》
1 / 12
12月 12 日

逛论坛看见有个友友有需要这方面的教程, 便写篇自用的配置文档供参考
Xray-core新特性 上下行分离 给GFW上强度

xhttp 有三种模式

  1. PACKET-UP (仅下行流式) 上行分包Post 下行流式Get (穿透CDN这些中间盒兼容性最佳)
  2. STREAM-UP (双向流式) 上行流式Post 下行流式Get (性能最佳,部分CDN兼容)
  3. STREAM-ONE (不上下行分离,双向流式) 上下行流式Post (类似以前gRPC H2协议, 可看作替代前者)

本篇文章使用STREAM-UP模式
在不考虑CDN代理,该模式性能非常好。 纯h2下测速可以跑满服务器带宽(前提是自己服务器线路好才行)

当然也可以选择hy2力大飞砖

服务端配置

  • xray-core配置
{ "log": { "loglevel": "info" }, "inbounds": [ { "tag": "xhttp", "listen": "/dev/xray/vless-xhttp.sock,0666", "protocol": "vless", "settings": { "clients": [ { "id": "你的UUID", "email": "你的EMAIL" } ], "decryption": "none" }, "streamSettings": { "network": "xhttp", "xhttpSettings": { "mode": "stream-up", "path": "/xhttp (需要换成自己的路径)", "noSSEHeader": false, "scMaxEachPostBytes": 1000000, "scMaxConcurrentPosts": 100 } } } ], "outbounds": [ { "tag": "direct", "protocol": "freedom", "settings": {} } ], "routing": { "domainMatcher": "hybrid", "rules": [ { "type": "field", "outboundTag": "direct", // 服务端有分流需求更换 "domain": [ "geosite:openai", "geosite:tiktok" ] } ] } }
  • nginx配置
server { server_name 填上自己的域名; listen 443 quic reuseport default_server; listen [::]:443 quic reuseport default_server; listen 443 ssl; listen [::]:443 ssl; # HTTP 2/3 http2 on; http3 on; quic_gso on; quic_retry on; add_header Alt-Svc 'h3=":443"; ma=86400'; # include snippets/security.conf; # 添加自己的SSL证书配置 # 可使用https://ssl-config.mozilla.org 生成 location /xhttp (需要换成自己的路径) { grpc_pass unix:/dev/xray/vless-xhttp.sock; grpc_socket_keepalive on; grpc_read_timeout 30m; grpc_send_timeout 30m; # 反向代理Header grpc_set_header Host $host; grpc_set_header X-Real-IP $proxy_protocol_addr; grpc_set_header X-Forwarded-For $proxy_add_x_forwarded_for; grpc_set_header X-Forwarded-Proto $scheme; } # 使用自己网站或反向代理伪装 location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php$1 last; } try_files $uri $uri/ /index.php?$args; } }

客户端配置(上下行分离 上行H3 下行H2)
目前仅v2rayNG支持该协议, 填上对应的配置即可使用。
当然也可以配置文件+命令行启动代理

"outbounds": [ { "tag": "proxy", "protocol": "vless", "settings": { "vnext": [ { "address": "填上自己的域名", "port": 443, "users": [ { "id": "填上自己的UUID", "email": "填上自己的EMAIL" } ] } ] }, "streamSettings": { "network": "xhttp", "security": "tls", "tlsSettings": { "allowInsecure": false, "serverName": "填上自己的域名", "alpn": [ "h3" ] }, "xhttpSettings": { "path": "/xhttp (需要换成自己的路径)", "host": "填上自己的域名", "mode": "stream-up", "scMaxEachPostBytes": "500000-1000000", "scMaxConcurrentPosts": "50-100", "scMinPostsIntervalMs": "30-50", "extra": { // 多路复用配置(默认配置的Lifetime超出nginx超时时间) "xmux": { "maxConcurrency": "8-16", "maxConnections": 0, "cMaxReuseTimes": "64-128", "cMaxLifetimeMs": 600000 }, // 下行分离H2配置,不需要可以去除 "downloadSettings": { "address": "填上自己的域名", "port": 443, "network": "xhttp", "security": "tls", "tlsSettings": { "serverName": "填上自己的域名", "alpn": [ "h2" ] }, "xhttpSettings": { "path": "/xhttp (需要换成自己的路径)" } } } } } },

上下行分离配置,大伙可以自由发挥想象
比如可以上行ipv6 下行ipv4(双栈机器)、 上行走入口好的机器,下行走出口好的机器再反代到上行机器(xhttp必须回到同inbound服务)

ps: 希望多久多多点赞想升V3, 换动态头像:kissing_heart:

我还是没看懂,既然是上下行分离,那么服务端应该有两个入站或者说uuid、路径来区分

要用自己真实的ssl证书么 那sni阻断地区就不友好了

请问相比于reality速度,延迟等方面有区别吗,还是只是抗审查能力提升了。

此话题将在最后一个回复的1 个月后关闭。


118 个未读话题 和 133 个新话题, 或浏览文档共建中的其他话题