测试机是腾讯云hk 跟rn洛杉矶 甲骨文等等。
首先建议使用warp client模式,方便分流
[client仅适用amd]
第一步,安装warp
wget https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh c
第二步,编辑v2ray/xray的配置,如果是x-ui直接修改模板。
在outbounds加入以下,端口改成你设定的。这里的端口默认为40000
{
"tag": "chatgpt",
"protocol": "socks",
"settings": {
"servers": [
{
"address": "127.0.0.1",
"port": 40000
}
]
}
}
在rules加入以下
{
"type": "field",
"domain": [
"chat.openai.com",
"ai.com"
],
"outboundTag": "chatgpt"
},
保存配置,重启v2/xray即可。
完整配置
{
"api": {
"services": [
"HandlerService",
"LoggerService",
"StatsService"
],
"tag": "api"
},
"inbounds": [
{
"listen": "127.0.0.1",
"port": 62789,
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1"
},
"tag": "api"
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
},
{
"protocol": "blackhole",
"settings": {},
"tag": "blocked"
},
{
"tag": "chatgpt",
"protocol": "socks",
"settings": {
"servers": [
{
"address": "127.0.0.1",
"port": 40000
}
]
}
}
],
"policy": {
"system": {
"statsInboundDownlink": true,
"statsInboundUplink": true
}
},
"routing": {
"rules": [
{
"type": "field",
"domain": [
"chat.openai.com",
"ai.com"
],
"outboundTag": "chatgpt"
},
{
"inboundTag": [
"api"
],
"outboundTag": "api",
"type": "field"
},
{
"ip": [
"geoip:private"
],
"outboundTag": "blocked",
"type": "field"
},
{
"outboundTag": "blocked",
"protocol": [
"bittorrent"
],
"type": "field"
}
]
},
"stats": {}
}