mack-a / v2ray-agent

Xray、Tuic、hysteria2、sing-box 八合一一键脚本
https://www.v2ray-agent.com
GNU Affero General Public License v3.0
13.49k stars 4.44k forks source link

Xray核心下socks5分流入站问题 #920

Closed ryan-web-dev closed 6 months ago

ryan-web-dev commented 6 months ago

不按照模版提交,一律关闭,反馈之前请仔细阅读脚本异常处理客户端使用教程、建议使用20卸载后重新尝试

1.问题描述

再次感谢辛苦付出!

Xray核心下,使用socks5分流:

出站分流规则:

      {
        "type": "field",
        "domain": [
          "geosite:netflix",
          "geosite:openai"
        ],
        "outboundTag": "socks5_outbound"
      }

2.安装失败的log或者截图

3.系统版本

Debian12.4

4.脚本版本

v3.1.36

能否考虑任意门回归,任意门只给xray使用,socks5只给sing-box使用,这样的组合看起来在使用和维护上都更简洁一些

mack-a commented 6 months ago

不是很懂你说的入站分流无法分流的情况,有具体日志吗

mack-a commented 6 months ago

任意门大概率不会回归,维护两套有些麻烦

ryan-web-dev commented 6 months ago

出站Xray日志:

2024/01/18 21:34:59 127.0.0.1:57970 accepted tcp:ios.chat.openai.com:443 [VLESSReality -> socks5_outbound] email: R-vless_reality_vision
2024/01/18 21:35:01 127.0.0.1:57986 accepted tcp:ios.chat.openai.com:443 [VLESSReality -> socks5_outbound] email: R-vless_reality_vision
2024/01/18 21:35:03 127.0.0.1:53804 accepted tcp:ios.chat.openai.com:443 [VLESSReality -> socks5_outbound] email: R-vless_reality_vision
2024/01/18 21:35:04 127.0.0.1:53814 accepted tcp:ios.chat.openai.com:443 [VLESSReality -> socks5_outbound] email: R-vless_reality_vision
2024/01/18 21:35:05 127.0.0.1:53824 accepted tcp:ios.chat.openai.com:443 [VLESSReality -> socks5_outbound] email: R-vless_reality_vision
2024/01/18 21:35:07 127.0.0.1:53836 accepted tcp:ios.chat.openai.com:443 [VLESSReality -> socks5_outbound] email: R-vless_reality_vision
2024/01/18 21:35:07 127.0.0.1:53852 accepted tcp:ios.chat.openai.com:443 [VLESSReality -> socks5_outbound] email: R-vless_reality_vision
2024/01/18 21:35:09 127.0.0.1:53862 accepted tcp:ios.chat.openai.com:443 [VLESSReality -> socks5_outbound] email: R-vless_reality_vision
2024/01/18 21:35:14 127.0.0.1:35210 accepted tcp:ios.chat.openai.com:443 [VLESSReality -> socks5_outbound] email: R-vless_reality_vision
2024/01/18 21:35:16 127.0.0.1:35212 accepted tcp:ios.chat.openai.com:443 [VLESSReality -> socks5_outbound] email: R-vless_reality_vision

入站Sing-box日志: 使用16.core管理=> 2.sing-box => 5.启用日志 => 6.查看日志 没有输出

出站Xray相关socks5配置: /etc/v2ray-agent/xray/conf/09_routing.json

{
  "routing": {
    "rules": [
      {
        "type": "field",
        "domain": [
          "domain:gstatic.com",
          "domain:googleapis.com"
        ],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "outboundTag": "blackhole_out",
        "protocol": [
          "bittorrent"
        ],
        "domain": [
          "geosite:cn"
        ]
      },
      {
        "type": "field",
        "domain": [
          "geosite:netflix",
          "geosite:openai"
        ],
        "outboundTag": "socks5_outbound"
      }
    ]
  }
}

/etc/v2ray-agent/xray/conf/10_ipv4_outbounds.json

{
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {
        "domainStrategy": "UseIPv4"
      },
      "tag": "IPv4_out"
    },
    {
      "protocol": "freedom",
      "settings": {
        "domainStrategy": "UseIPv6"
      },
      "tag": "IPv6_out"
    },
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "tag": "blackhole_out"
    },
    {
      "protocol": "socks",
      "tag": "socks5_outbound",
      "settings": {
        "servers": [
          {
            "address": "1.2.3.4",
            "port": 54321,
            "users": [
              {
                "user": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
                "pass": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
              }
            ]
          }
        ]
      }
    }
  ]
}

入站异常情况时Sing-box相关socks5配置: /etc/v2ray-agent/sing-box/conf/config.json

{
  "log": {
    "disabled": true,
    "level": "debug",
    "output": "/etc/v2ray-agent/sing-box/conf/box.log",
    "timestamp": true
  },
  "inbounds": [
    {
      "type": "socks",
      "tag": "socks5_inbound",
      "listen": "::",
      "listen_port": 54321,
      "users": [
        {
          "Username": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
          "Password": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
        }
      ]
    }
  ],
  "outbounds": [
    {
      "type": "block",
      "tag": "block"
    },
    {
      "type": "direct",
      "tag": "direct"
    }
  ],
  "route": {
    "rules": [
      {
        "inbound": "socks5_inbound",
        "source_ip_cidr": "4.3.2.1",
        "rule_set": [
          "netflix_socks5_inbound_route",
          "openai_socks5_inbound_route"
        ],
        "outbound": "direct"
      }
    ],
    "rule_set": [
      {
        "type": "remote",
        "tag": "netflix_socks5_inbound_route",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-netflix.srs"
      },
      {
        "type": "remote",
        "tag": "openai_socks5_inbound_route",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-openai.srs"
      }
    ]
  }
}

入站正常情况时Sing-box相关socks5配置: /etc/v2ray-agent/sing-box/conf/config.json

{
  "log": {
    "disabled": true,
    "level": "debug",
    "output": "/etc/v2ray-agent/sing-box/conf/box.log",
    "timestamp": true
  },
  "inbounds": [
    {
      "type": "socks",
      "tag": "socks5_inbound",
      "listen": "::",
      "listen_port": 54321,
      "users": [
        {
          "Username": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
          "Password": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
        }
      ]
    }
  ],
  "outbounds": [
    {
      "type": "block",
      "tag": "block"
    },
    {
      "type": "direct",
      "tag": "direct"
    }
  ],
  "route": {
    "rules": [
      {
        "inbound": "socks5_inbound",
        "domain": [
          "www.netflix.com",
          "chat.openai.com",
          "ios.chat.openai.com",
          "android.chat.openai.com"
        ],
        "source_ip_cidr": "4.3.2.1",
        "outbound": "direct"
      }
    ]
  }
}

入站ufw status:

root@bv:~# ufw status
Status: active

To                         Action      From
--                         ------      ----
22                         ALLOW       Anywhere
80                         ALLOW       Anywhere
443                        ALLOW       Anywhere
54321                      ALLOW       Anywhere
54321/tcp                  ALLOW       Anywhere
54321/udp                  ALLOW       Anywhere
22 (v6)                    ALLOW       Anywhere (v6)
80 (v6)                    ALLOW       Anywhere (v6)
443 (v6)                   ALLOW       Anywhere (v6)
54321 (v6)                 ALLOW       Anywhere (v6)
54321/tcp (v6)             ALLOW       Anywhere (v6)
54321/udp (v6)             ALLOW       Anywhere (v6)
ryan-web-dev commented 6 months ago

补充下,sing-box启动时候有这么一段日志:

+0000 2024-01-19 03:04:48 INFO router: updated default interface eth0, index 3
+0000 2024-01-19 03:04:48 DEBUG router: updating rule-set openai_socks5_inbound_route from URL: https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-openai.srs
+0000 2024-01-19 03:04:48 INFO outbound/block[block]: blocked connection to raw.githubusercontent.com:443
+0000 2024-01-19 03:04:58 WARN router: initialize rule-set take too much time to finish!
mack-a commented 6 months ago

请问都是设置了什么分流规则,有设置warp吗或者其他分流规则。尽量描述详细一些

ryan-web-dev commented 6 months ago

没有设置其他分流规则 入站xray 09_routing.json:

{
  "routing": {
    "rules": [
      {
        "type": "field",
        "domain": [
          "domain:gstatic.com",
          "domain:googleapis.com"
        ],
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "outboundTag": "blackhole_out",
        "protocol": [
          "bittorrent"
        ],
        "domain": [
          "geosite:cn"
        ]
      }
    ]
  }
}
mack-a commented 6 months ago

https://github.com/mack-a/v2ray-agent/releases/tag/v3.1.37 试一下

ryan-web-dev commented 6 months ago

https://github.com/mack-a/v2ray-agent/releases/tag/v3.1.37 试一下

我下午试试

ryan-web-dev commented 6 months ago

好使,让我研究研究你都改了啥

mack-a commented 6 months ago

感谢大佬反馈