利用域名分流解锁ChatGPT

实用教程 admin 1年前 (2023-09-16) 2639次浏览 0个评论

介绍

两年前,小白写过一篇使用域名分流解锁奈飞的教程:继续解锁奈飞(三)-域名分流篇,最近有小伙伴问我,能不能用同样的方法解锁ChatGPT,我去看了下v2fly官方的domain-list-community项目,可以看到已经添加了openai,那就好办了,我们直接按照那篇教程来操作就行了。

原理

我们知道,不管是那哪种ray(现在应该就两种吧),它的配置文件的主体是inboundsoutboundsrouting

  • inbounds负责告诉*ray流量怎么进,哪种协议进
  • outbounds负责告诉*ray流量怎么出,哪种协议出
  • routing负责告诉*ray从从inbounds到outbounds的路怎么走

所以我们可以通过设置多个outbounds,编辑不同routing的规则告诉*ray不同的流量走不同的outbounds。

实操

一般情况下*ray的配置文件于/etc/xray/或者/etc/v2ray/,当然如果你是使用其他脚本安装的,那你需要自己去脚本的项目地址看下咯。

我们先来看一段原始的config.json

{
  "log": {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "none"
  },
  "inbounds": [
    {
      "port": 62570,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "fdc6e7f0-fceb-11eb-95c8-a25b020000ed",
            "alterId": 0
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "security": "none",
        "tlsSettings": {},
        "tcpSettings": {},
        "kcpSettings": {},
        "wsSettings": {},
        "httpSettings": {},
        "quicSettings": {},
        "grpcSettings": {}
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "routing": {
    "rules": [
      {
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "blocked"
      }
    ]
  }
}

这段配置文件中,inbounds部分有一个vmess协议,outbounds部分一个freedom协议,一个blackhole协议,routing中一条规则,这条规则告诉*ray入口的IP地址符合geoip:private这个规则时,就走blocked协议,而由于*ray的规则默认走出口的第一条协议的,所以不符合这个routing规则所有其他IP都会直接走第一个freedom协议出去。

那我们现在来配合已经具备解锁能力的小鸡来修改配置文件。

DNS分流

{
  "log": {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "none"
  },
  "inbounds": [
    {
      "port": 62570,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "fdc6e7f0-fceb-11eb-95c8-a25b020000ed",
            "alterId": 0
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "security": "none",
        "tlsSettings": {},
        "tcpSettings": {},
        "kcpSettings": {},
        "wsSettings": {},
        "httpSettings": {},
        "quicSettings": {},
        "grpcSettings": {}
      }
    },
	"sniffing": {
        "enabled": true,   //一定要开启 sniffing,V2Ray 才能识别 Netflix 的流量
        "destOverride": ["http", "tls"]
      }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {"domainStrategy": "UseIP"}   // 必须设定 domainStrategy 为 UseIP 以使用内置的DNS
    }
  ],
  "routing": {
    "rules": [ ]
  },
  "dns": {
    "servers": [
      "8.8.8.8",
      {
        "address": "x.x.x.x",   // DNS 解锁提供的 IP
        "port": 53,
        "domains": ["geosite:openai"]
      }
    ]
  }
}

ss做outbounds

{
  "log": {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "none"
  },
  "inbounds": [
    {
      "port": 62570,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "fdc6e7f0-fceb-11eb-95c8-a25b020000ed",
            "alterId": 0
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "security": "none",
        "tlsSettings": {},
        "tcpSettings": {},
        "kcpSettings": {},
        "wsSettings": {},
        "httpSettings": {},
        "quicSettings": {},
        "grpcSettings": {}
      }
    },
	"sniffing": {
        "enabled": true,   //一定要开启 sniffing,V2Ray 才能识别 Netflix 的流量
        "destOverride": ["http", "tls"]
      }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    },
    {
      "tag": "VPS1",
      "protocol": "shadowsocks",
      "settings": {
        "servers": [
          {
            "address": "x.x.x.x",       //解锁鸡IP
            "method": "aes-256-gcm",    //ss加密方式
            "ota": false,
            "password": "xxxxxx",       //ss密码
            "port": xxxx                //ss监听端口
          }
        ]
      }
    },
    {
      "tag": "VPS2",
      "protocol": "shadowsocks",
      "settings": {
        "servers": [
          {
            "address": "x.x.x.x",       //解锁鸡IP
            "method": "aes-256-gcm",    //ss加密方式
            "ota": false,
            "password": "xxxxxx",       //ss密码
            "port": xxxx                //ss监听端口
          }
        ]
      }
    }
  ],
  "routing": {
    "rules": [
      {
        "type": "field",
        "outboundTag": "VPS1",
        "domain": ["geosite:netflix"]      //如果你的小鸡油管送中谷歌跳验证码,还可以添加geosite:google","geosite:youtube",让油管谷歌流量也走解锁鸡
      },
	  {
        "type": "field",
        "outboundTag": "VPS2",
        "domain": ["geosite:openai"]      //如果你的小鸡油管送中谷歌跳验证码,还可以添加geosite:google","geosite:youtube",让油管谷歌流量也走解锁鸡
      }
    ]
  }
}

socks5做outbounds

{
  "log": {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "none"
  },
  "inbounds": [
    {
      "port": 62570,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "fdc6e7f0-fceb-11eb-95c8-a25b020000ed",
            "alterId": 0
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "security": "none",
        "tlsSettings": {},
        "tcpSettings": {},
        "kcpSettings": {},
        "wsSettings": {},
        "httpSettings": {},
        "quicSettings": {},
        "grpcSettings": {}
      }
    },
	"sniffing": {
        "enabled": true,   //一定要开启 sniffing,V2Ray 才能识别 Netflix 的流量
        "destOverride": ["http", "tls"]
      }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    },
    {
      "tag": "VPS1",
      "protocol": "socks",
      "settings": {
        "servers": [
          {
            "address": "x.x.x.x",   //解锁鸡IP
            "ota": false,
            "port": xxxx,           //sock5监听端口
            "users": [
              {
                "user": "xxx",      //socks5用户名
                "pass": "xxx"       //密码
              }
            ]
          }
        ]
      }
    },
    {
      "tag": "VPS2",
      "protocol": "socks",
      "settings": {
        "servers": [
          {
            "address": "x.x.x.x",   //解锁鸡IP
            "ota": false,
            "port": xxxx,           //sock5监听端口
            "users": [
              {
                "user": "xxx",      //socks5用户名
                "pass": "xxx"       //密码
              }
            ]
          }
        ]
      }
    }
  ],
  "routing": {
    "rules": [
      {
        "type": "field",
        "outboundTag": "VPS1",
        "domain": ["geosite:netflix"]      //如果你的小鸡油管送中谷歌跳验证码,还可以添加geosite:google","geosite:youtube",让油管谷歌流量也走解锁鸡
      },
	  {
        "type": "field",
        "outboundTag": "VPS2",
        "domain": ["geosite:openai"]      //如果你的小鸡油管送中谷歌跳验证码,还可以添加geosite:google","geosite:youtube",让油管谷歌流量也走解锁鸡
      }
    ]
  }
}

当然我们除了使用ss,sock5协议做outbounds,*ray支持的任意一种协议都可以。


VPS小白 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:利用域名分流解锁ChatGPT
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址