openwrt-passwall icon indicating copy to clipboard operation
openwrt-passwall copied to clipboard

[Bug]: 请问,目前Xray的自定义接口功能和Xray分流,无法共存吗?

Open chunfengyao opened this issue 1 year ago • 3 comments

描述您遇到的bug

无法在选了Xray总分流的情况下,使用Xray的自定义接口作为出口。

复现此Bug的步骤

选了Xray总分流。 分流规则的出口选项中没有出现Xray的自定义接口出口。

您想要实现的目的

luci: Xray outbound support network interface

是否可以让自定义接口作为一个普通的出口节点。官方使用的是打mark的方式。还是希望可以先分流,然后再走自定义接口出站的。

https://xtls.github.io/document/level-2/redirect.html#_4%E3%80%81xray-core-%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E4%BF%AE%E6%94%B9

日志信息

暂无。

截图

No response

系统相关信息

Passwall: 4.62

其他信息

No response

chunfengyao avatar Apr 07 '23 23:04 chunfengyao

此前逻辑没有考虑到此情况。 暂时可以这样操作: 可以先转成socks,然后再新建一个对应的socks节点,然后分流选此socks节点。

xiaorouji avatar Apr 09 '23 14:04 xiaorouji

是否可以让自定义接口作为一个普通的出口节点。官方使用的是打mark的方式。还是希望可以先分流,然后再走自定义接口出站的。

试过了,并不是期待的结果,转成socks,然后获取配置文件,精简,修改监听端口,手动xray启动socks的配置文件。新建socks节点到节点列表页面。 此时,在节点列表页面点击可用性测试,是可以看到手动xray启动socks的控制台有google的请求记录,并且,可以正确显示延时。但,把分流的代理出口指向新建的socks节点后,点击passwall主页的谷歌连接(点我检测)时,手动xray启动socks的控制台会进入连接的死循环,直到手动终止进程。(已尝试过关闭流量嗅探只供路由使用,问题依旧),表面看,两个配置文件都没啥问题。

这是精简后的socks配置文件

{
  "outbounds": [
    {
      "streamSettings": {
        "sockopt": {
          "interface": "WG"
        }
      },
      "protocol": "freedom",
      "tag": "outbound"
    }
  ],
  "log": {
    "loglevel": "info"
  },
  "inbounds": [
    {
      "port": 51080,
      "protocol": "socks",
      "settings": {
        "udp": true,
        "auth": "noauth"
      },
      "listen": "0.0.0.0"
    }
  ]
}

这是分流配置文件,"已隐藏路由内容"

{
  "outbounds": [
    {
      "_flag_tag": "779ba5f5740149aea0a73d969ba48df1",
      "_flag_proxy": 0,
      "_flag_proxy_tag": "nil",
      "settings": {
        "servers": [
          {
            "password": "",
            "port": 51080,
            "address": "127.0.0.1"
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "sockopt": {
          "mark": 255
        }
      },
      "mux": {
        "enabled": false,
        "concurrency": 8
      },
      "protocol": "socks",
      "tag": "proxy"
    },
    {
      "streamSettings": {
        "sockopt": {
          "mark": 255
        }
      },
      "settings": {
        "domainStrategy": "UseIPv4"
      },
      "protocol": "freedom",
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "tag": "blackhole"
    }
  ],
  "log": {
    "loglevel": "debug"
  },
  "policy": {
    "levels": {
      "0": {
        "statsUserUplink": false,
        "statsUserDownlink": false
      }
    }
  },
  "routing": {
    "rules": [
      {
        "type": "field",
        "protocol": [
          "bittorrent"
        ],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "outboundTag": "blackhole",
        "domain": [
          "geosite:category-ads-all"
        ]
      },
      {
        "type": "field",
        "outboundTag": "direct",
        "domain": [
          "已隐藏路由内容"
        ]
      },
      {
        "type": "field",
        "outboundTag": "direct",
        "ip": [
          "已隐藏路由内容"
        ]
      },
      {
        "type": "field",
        "outboundTag": "proxy",
        "domain": [
          "已隐藏路由内容"
        ]
      },
      {
        "type": "field",
        "outboundTag": "proxy",
        "ip": [
          "已隐藏路由内容"
        ]
      },
      {
        "type": "field",
        "network": "tcp,udp",
        "outboundTag": "direct"
      }
    ],
    "domainStrategy": "IPIfNonMatch",
    "domainMatcher": "hybrid"
  },
  "inbounds": [
    {
      "port": 12222,
      "protocol": "socks",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "settings": {
        "udp": true,
        "auth": "noauth"
      },
      "listen": "0.0.0.0"
    },
    {
      "settings": {
        "allowTransparent": false
      },
      "port": 12333,
      "protocol": "http",
      "listen": "0.0.0.0"
    }
  ]
}

chunfengyao avatar Apr 09 '23 22:04 chunfengyao

如果是手动替换outbounds,直接替换成自定义接口的outbounds,倒是可以的。

先以普通的分流启动,ps -ef找到passwall的进程和配置文件路径,kill当前的进程,修改配置文件,替换outbounds为自定义接口(注意出口tag),然后手动启动配置文件。测试结果。

chunfengyao avatar Apr 09 '23 23:04 chunfengyao

Stale Issue

github-actions[bot] avatar Apr 20 '23 01:04 github-actions[bot]

希望可以适配一下自定义接口,配合wireguard使用可以极大地提升性能。

chunfengyao avatar Apr 27 '23 01:04 chunfengyao

试下最新源码,openvpn测试正常。没有wireguard无法测试。

xiaorouji avatar Aug 10 '23 18:08 xiaorouji

试下最新源码,openvpn测试正常。没有wireguard无法测试。

最近的源码,生成的json文件中,自定义出口为如下,会导致路由到自定义接口的数据包再次被路由,导致cpu占用100%。

{
  "streamSettings": {
    "sockopt": {
      "interface": "custom_interface"
    }
  },
  "protocol": "freedom",
  "tag": "proxy"
}

需要添加一下"mark": 255标记。让生成的自定义接口的json变为如下:

{
  "_flag_tag": "fcf285cacfdf4a3d89635365385e67b7",
  "_flag_proxy": 0,
  "_flag_proxy_tag": "nil",
  "streamSettings": {
    "sockopt": {
      "interface": "custom_interface",
      "mark": 255
    }
  },
  "protocol": "freedom",
  "tag": "proxy"
}

chunfengyao avatar Aug 11 '23 00:08 chunfengyao

最新的版本,可以了。感谢。

chunfengyao avatar Aug 11 '23 21:08 chunfengyao