手搓搭建

XHTTP手搓 第二部 | 简化版 无需证书 上下行分离 IPV4 IPV6 CDN

Reality + Xhttp

标签:

Youtub视频

https://youtu.be/fcUqJaB5GtE

#来源
https://github.com/XTLS/Xray-core/discussions/4118

#安装xray

bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install -u root

#完整xray配置文件

{
    "log": {
        "loglevel": "debug"
    },
  "inbounds": [
    {
      "listen": "0.0.0.0",
      "port": 443,
      "protocol": "vless",
      "settings": {
        "clients": [
          {
            "id": "$(your_uuid)"    // 长度为 1-30 字节的任意字符串,或执行 xray uuid 生成
          }
        ],
        "decryption": "none"
      },
      "streamSettings": {
        "network": "xhttp",
        "security": "tls",
        "tlsSettings": {
          "serverName": "b.example.com",    // 填写启用了 CDN 的域名
          "alpn": ["h3","h2","http/1.1"],
          "minVersion": "1.2",    // 为了安全起见,至少要求 TLS1.2
          "certificates": [    // 用于验证服务器与 CDN 的TLS握手,可以用 acme.sh 生成,也可以使用 CDN 提供的源服务器证书(如果有的话)
            {
              "certificateFile": "/usr/local/etc/xray/fullchain.cer",    // 换成你的证书,绝对路径
              "keyFile": "/usr/local/etc/xray/private.key"    // 换成你的私钥,绝对路径
            }
          ]
        },
        "xhttpSettings": {
          "host": "",    // 服务端可以留空,若不留空,客户端必须填与服务端相同的 host
          "path": "/xhttp_client_upload",    // 不要照抄,尽可能将 path 设置得复杂一些
          "mode": "auto"
        }
      },
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls", "quic"],
        "metadataOnly": false
      }
    }
  ],
 "outbounds": [
        {
            "protocol": "freedom",
            "tag": "direct"
        },
        {
            "protocol": "blackhole",
            "tag": "block"
        }
    ]
}

#检查xray配置
xray -test -config /usr/local/etc/xray/config.json

#重启xray,并且检查运行状态
systemctl restart xray && systemctl status xray

#双IP上下行分离,v2rayn extra json

{
 "downloadSettings": {
"address": "$(ipv4_of_your_vps)",    // 填写 VPS 的 IPv4/6 地址
"port": 443,
"network": "xhttp",
"security": "reality",
"realitySettings": {
"serverName": "a1.example.com",    // 服务端允许的 serverNames 之一
"fingerprint": "chrome",
"publicKey": "$(your_publicKey)",    // 填写服务端运行 xray x25519 生成的公钥的值
"shortId": "$(your_shortId)"    // 与服务端一致
},
"xhttpSettings": {
"path": "/xhttp_client_upload",    // 不要照抄,尽可能将 path 设置得复杂一些,与服务端保持一致
}
}

#CDN上下行分离
一个域名,开小云朵

#用cloudflare的证书

#SSL/TLS开完全或者完全(严格)

#CDN上下行分离,v2rayn extra json

{
 "downloadSettings": {
"address": "$(ip2_or_domain2_of_your_cdn)",    // 此处填写你使用的 CDN 的另一个 IP 或 域名
"port": 443,
"network": "xhttp",
"security": "tls",
"tlsSettings": {
"serverName": "b.example.com",    // 与服务端一致
"allowInsecure": false,    // 仅客户端设置
"alpn": ["h2"],    // h2 已非常丝滑,如果你使用的 CDN 支持 h3 且你所在地区对 UDP 的 QoS 不严重,可以填 "h3"
"fingerprint": "chrome"
},
"xhttpSettings": {
"host": "b.example.com",    // 过CDN时必须填 host
"path": "/xhttp_client_upload",    // 不要照抄,尽可能将 path 设置得复杂一些,与服务端保持一致
"mode": "auto"
}
}
}

#检验上下行分离

#检查网卡
ip a

#tcp流量抓包
tcpdump -i eth0 port 443 -n

 

相关导航

暂无评论

暂无评论...