xray reverse

概要

用xray做内网穿透

配置

带公网ip的机器上如此配置xray

{
  "log": {
    "access": "",
    "error": "",
    "loglevel": "warning"
  },
  "reverse": {
    "portals": [
      {
        "tag": "portal",
        "domain": "test.ailitonia.com"
      }
    ]
  },
  "inbounds": [
    {
      "tag": "device1",  // 内网设备1
      "port": 5001,  // 访问端口
      "protocol": "dokodemo-door",
      "settings": {
        "address": "127.0.0.1",  // 内网ip
        "port": 80,  // 设备开放端口
        "network": "tcp"
      }
    },
    {
      "tag": "device2",  // 内网设备2
      "port": 5002,
      "protocol": "dokodemo-door",
      "settings": {
        "address": "192.168.1.100",
        "port": 80,
        "network": "tcp"
      }
    },
    {
      "tag": "device3",  // 内网设备3
      "port": 5003,
      "protocol": "dokodemo-door",
      "settings": {
        "address": "192.168.1.200",
        "port": 21,
        "network": "tcp"
      }
    },
    {
      "port": 4096,
      "tag": "interconn",
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "134b53ca-b0cc-44a7-a28f-4214842c2fd6",
            "alterId": 64
          }
        ]
      }
    }
  ],
  "routing": {
    "rules": [
      {
        "type": "field",
        "inboundTag": [  // 前面所有inbound的tag都要写
          "device1",
          "device2",
          "device3"
        ],
        "outboundTag": "portal"
      },
      {
        "type": "field",
        "inboundTag": [
          "interconn"
        ],
        "outboundTag": "portal"
      }
    ]
  }
}

家中某个莫得公网ip的机器上如此配置xray

{
  "log": {
    "access": "",
    "error": "",
    "loglevel": "warning"
  },
  "reverse": {
    "bridges": [
      {
        "tag": "bridge",
        "domain": "test.ailitonia.com"
      }
    ]
  },
  "outbounds": [
    {
      "tag": "bridgeout",
      "protocol": "freedom"
    },
    {
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "portal的IP地址",
            "port": 4096,
            "users": [
              {
                "id": "134b53ca-b0cc-44a7-a28f-4214842c2fd6",
                "alterId": 64
              }
            ]
          }
        ]
      },
      "tag": "interconn"
    }
  ],
  "routing": {
    "rules": [
      {
        "type": "field",
        "inboundTag": [
          "bridge"
        ],
        "domain": [
          "full:test.ailitonia.com"
        ],
        "outboundTag": "interconn"
      },
      {
        "type": "field",
        "inboundTag": [
          "bridge"
        ],
        "outboundTag": "bridgeout"
      }
    ]
  }
}

interconn可以随便改其他的协议,实测cloudflare+caddy+xhttp是可行的

参考

https://ailitonia.com/archives/%E4%BD%BF%E7%94%A8v2ray%E8%BF%9B%E8%A1%8C%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86-%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F/

发表评论

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理