# Warp与Tor共存

先搭建好Tor，方法点此。

## 申请 Warp 账户

- 下载 wgcf
- wget https://github.com/ViRb3/wgcf/releases/download/v2.2.15/wgcf\_2.2.15\_linux\_amd64 -O wgcf && chmod +x wgcf
- ./wgcf register
- ./wgcf generate 拷贝内容如下：

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11

    [Interface]
    PrivateKey = 我的私钥
    Address = 172.16.0.2/32
    Address = 2606:4700:110:8949:fed8:2642:a640:c8e1/128
    DNS = 1.1.1.1
    MTU = 1280
    [Peer]
    PublicKey = Warp公钥
    AllowedIPs = 0.0.0.0/0
    AllowedIPs = ::/0
    Endpoint = engage.cloudflareclient.com:2408

## Warp与Tor自动切换

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13

    version: '3.3'
    services:
        socks5:
            container_name: socks5
            restart: always
            volumes:
                - './config/:/etc/sing-box/'
            image: gzxhwq/sing-box:git

    networks:
      default:
        external: true
        name: sswitch

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73

    {
      "log": {
        "level": "info"
      },
      "inbounds": [
        {
          "type": "socks",
          "tag": "socks-in",
          "listen": "::",
          "listen_port": 5353,
          "tcp_fast_open": false,
          "udp_fragment": false,
          "sniff": true,
          "sniff_override_destination": false,
          "sniff_timeout": "300ms",
          "udp_timeout": 300,
          "proxy_protocol": false,
          "proxy_protocol_accept_no_header": false
        }
      ],
      "outbounds": [
        {
          "type": "direct"
        },
        {
          "type": "wireguard",
          "tag": "wireguard",
          "server": "engage.cloudflareclient.com",
          "server_port": 2408,
          "local_address": ["10.0.0.2/32","fd00::1/128"],
          "private_key": "我的私钥",
          "peer_public_key": "Warp公钥"
        },
        {
          "type": "socks",
          "tag": "tor",
          "server": "tor",
          "server_port": 9050
        }
      ],
      "route": {
        "rules": [
          {
            "domain_suffix": [".onion"],
            "outbound": "tor"
          },
          {
            "domain_suffix": ["openai.com"],
            "outbound": "wireguard"
          },
          {
            "domain_suffix": [".cn"],
            "outbound": "wireguard"
          },
          {
            "domain_suffix": ["check.torproject.org"],
            "outbound": "tor"
          },
          {
            "domain_suffix": ["myip.ipip.net"],
            "outbound": "wireguard"
          },
          {
            "geoip": ["cn"],
            "outbound": "wireguard"
          },
          {
            "geosite": ["cn"],
            "outbound": "wireguard"
          }
        ]
      }
    }

- mkdir -p ~/app/socks5 && cd ~/app/socks5 && nano docker-compose.yml
- mkdir ./config
- nano ./config/config.json
- sudo docker-compose up -d && sudo docker-compose logs

## 测试warp

- docker run –rm –net=sswitch alpine/curl http://myip.ipip.net
- docker run –rm –net=sswitch alpine/curl –socks5 socks5:5353 http://myip.ipip.net
- docker run –rm –net=sswitch alpine/curl –socks5 socks5:5353 https://api.ipify.org/?format=json

## 测试tor

- docker run –rm –net=sswitch alpine/curl –socks5-hostname “tor:9050” “https://check.torproject.org/api/ip“
- docker run –rm –net=sswitch alpine/curl –socks5-hostname “socks5:5353” “https://check.torproject.org/api/ip“
- docker run –rm –net=sswitch alpine/curl –socks5-hostname “tor:9050” “https://www.nytimesn7cgmftshazwhfgzm37qxb44r64ytbb2dj3x62d2lljsciiyd.onion“
- docker run –rm –net=sswitch alpine/curl –socks5-hostname “socks5:5353” “https://www.nytimesn7cgmftshazwhfgzm37qxb44r64ytbb2dj3x62d2lljsciiyd.onion“

运维
Warp与Tor共存
https://occdn.limour.top/2601.html
Author
Limour
Posted on
March 3, 2023
Licensed under
SOCKS5转QUIC Previous
尝试用Golang静态编译可执行文件 Next

#### Search

Keyword