Chatgpt对ip有较为严格的限制,使用Cloudflare WARP可以隐藏服务器的真实ip,解除访问限制。

安装Cloudflare WARP

官方文档

# Add cloudflare gpg key
curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | sudo gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg


# Add this repo to your apt repositories
echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/cloudflare-client.list


# Install
sudo apt-get update && sudo apt-get install cloudflare-warp

设置cloudflare warp

一定要把mode设置为proxy,然后连接。否则将无法使用ssh访问服务器。

warp-cli registration new #注册
warp-cli mode proxy # 设置代理模式为socks代理
warp-cli proxy port 40000 #设置代理端口40000
warp-cli connect # 连接

xray配置

inbounds 要开启 sniffing

"sniffing": {
    "enabled": true,
    "destOverride": ["http", "tls"]
}

outbounds 增加配置

{
   "tag":"cloudflare-warp",
   "protocol": "socks",
   "settings": {
       "servers": [
          {
              "address": "127.0.0.1",
              "port": 40000
           }
       ]
   }
}

routing 的 rules 中添加以下配置

{
   "type": "field",
   "domain": [
                   "openai.com",
                   "ai.com"
   ],
   "outboundTag": "cloudflare-warp"
}

最后保存配置重启xray

说明

本文仅供学习交流,请勿用于非法用途