原因

之前搭建在fly.io上Whoogle最接近提示被限速,通过火狐镜像访问Google搜索,一直提示要人机验证,验证好多次都不行,后来研究了下,应该是Google搜索将fly.io的所有IP都拉黑了。要继续使用Whoogle需要使用代理访问Google搜索。

解决

准备

我正好有甲骨文东京的VPS,可以搭建socks代理,fly.io支持分配免费IPV6,甲骨文VPS也可以分配IPV6,这样可以通过甲骨文VPS的防火墙限制对socks代理的访问。

获取fly.io的公网IPV6

甲骨文VPS配置IPV6请自行查找网上的教程,fly.io的公网IPV6无法通过在网页查找,需要使用flyctl ssh console连接到Whoogle内部,执行echo $FLY_PUBLIC_IP获取公网出口IP,例如2605:4c40:92:520a:0:8c93:3d8a:1,CIDR 写法为2605:4c40:92:5200::/56,CIDR是设置甲骨文防火墙所需要的。

配置socks代理

使用V2Fly搭建socks代理,配置如下:
docker-compose.yml

version: "3"
services:
  v2ray:
    image: v2fly/v2fly-core:latest
    container_name: v2ray
    restart: always
    #command: run -c  /etc/v2fly/config.json
    command: run -confdir  /etc/v2fly/config
    ports:
      # SOCKS
      - "45222:44222"
    volumes:
      - ./log:/var/log/v2fly/
      - ./config/socks.json:/etc/v2fly/config/socks.json:ro

./config/socks.json

{
  "inbounds": [
    {
      "port": 44222,
      "protocol": "socks",
      "settings": {
        "auth": "password",
        "accounts": [
          {
            "user": "admin",
            "pass": "123"
          }
        ]
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom"
    }
  ]
}

运行V2Fly容器,并配置甲骨文VPS防火墙允许特定IP和开放特定端口。

Whoogle配置代理

在Whoogle配置里添加一下内容

  WHOOGLE_PROXY_TYPE = "socks5h"
  WHOOGLE_PROXY_LOC = "[2605:4c40:92:520a:0:8c93:3d8a:1]:45222"
  WHOOGLE_PROXY_USER = "admin"
  WHOOGLE_PROXY_PASS = "123"

重新运行Whoogle容器。

参考文档

  1. Public Network Services
  2. [BUG] socks5 proxy config gives Internal server error 500