Contents

Contents

实现目的

A是客户端,B是中转节点,C也是中转节点,C可以访问公网

A可以连C访问公网,但有时候A直接访问C会有问题,所以需要借助B

具体配置

1、C 机器(落地机)配置示例

{
  "inbounds": [
    {
      "port": 443,
      "protocol": "vless",
      "settings": {
        "clients": [
          { "id": "YOUR-UUID-HERE" }
        ],
        "decryption": "none"
      },
      "streamSettings": {
        "network": "ws",
        "security": "tls",
        "tlsSettings": {
          "certificates": [
            {
              "certificateFile": "/path/to/cert.crt",
              "keyFile": "/path/to/cert.key"
            }
          ]
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom" // 最终由 C 发往公网
    }
  ]
}

2、B 机器(中转机)配置示例

在中转机上使用 dokodemo-door 进行纯 TCP/UDP 流量透传:

{
  "inbounds": [
    {
      "port": 8443, // B 监听的端口,供 A 连接
      "protocol": "dokodemo-door",
      "settings": {
        "address": "1.2.3.4", // C 机器的公网 IP 或域名
        "port": 443,          // C 机器监听的端口
        "network": "tcp,udp"
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom"
    }
  ]
}

3、A 机器(客户端)配置示例

{
  "inbounds": [
    {
      "port": 10808,
      "protocol": "socks"
    }
  ],
  "outbounds": [
    {
      "protocol": "vless",
      "settings": {
        "vnext": [
          {
            "address": "B-SERVER-IP", // 注意:这里填 B 的 IP
            "port": 8443,            // 填 B 的中转端口
            "users": [
              { "id": "YOUR-UUID-HERE", "encryption": "none" } // C 的 UUID
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "ws",
        "security": "tls",
        "tlsSettings": {
          "serverName": "your-c-domain.com" // 注意:伪装域名 SNI 必须填 C 的域名
        }
      }
    }
  ]
}