NekoBoxForAndroid icon indicating copy to clipboard operation
NekoBoxForAndroid copied to clipboard

将链式代理设置为路由出口时,某些特定情况下无法启动代理

Open zhanbao2000 opened this issue 2 years ago • 1 comments

描述问题

按照复现步骤设置路由与链式代理,在某些特定情况下无法启动代理。

如何复现

首先,做以下准备工作:

  1. 在同一分组内,创建三个节点,分别为 ABC,并创建一个链式代理 Chain,该链式代理由 B -> C(见图1)

  2. 创建路由规则,domain 设置为 domain:ipinfo.iooutbound 设置为 Chain(见图2)

  3. 在下述情形中启动代理,某些情形中可以启动,而某些情形中无法启动:

不能启动代理的情形

  1. 选择 B 节点后启动(见图3、日志1)

  2. 在分组设置中选中 启用 selector,然后无论选择 ABCChain 中哪一个节点,均无法启动(见图4、日志2)

可以启动代理的情形

  1. 选择 A 节点(或者任何不属于该代理链的节点)后启动

  2. 选择 Chain 节点(即代理链本身)后启动

  3. 关闭路由规则后,选择 B 节点后启动

期待的结果

事实上,我将 B 代理作为日常使用,C 代理是当地的一个住宅 IP,我使用链式代理(B -> C)并搭配路由规则来访问一些限制 IP 的服务 (例如 OpenAI、Netflix 等)。

所期待的结果是,在设置了上述链式代理与路由规则的情况下,选中 B 节点后能正常启动并使用代理,并且代理链也工作正常。

截图

截图1

在同一分组内,创建三个节点,分别为 ABC,并创建一个链式代理 Chain,该链式代理由 B -> C

F30FEE69FB169E278A249509697B21C8

截图2

创建路由规则,domain 设置为 domain:ipinfo.iooutbound 设置为 Chain

8E7D20C74B3F0FD06238DF5CCD1290F2

截图3

选择 B 节点后启动

2B9B86817D5331952B617BC68AF0EA83

截图4

在分组设置中选中 启用 selector,然后无论选择 ABCChain 中哪一个节点,均无法启动(以节点 A 为例)

B429FABD50A0FBD244077488415EE5D0

日志

日志1

  1. 选择 B 节点后启动
2023/07/29 08:46:28 [Debug] [ProxyInstance] {
  "dns": {
    "independent_cache": true,
    "rules": [
      {
        "domain": [
          "B的地址"
        ],
        "server": "dns-direct"
      }
    ],
    "servers": [
      {
        "address": "https://8.8.8.8/dns-query",
        "address_resolver": "dns-direct",
        "strategy": "prefer_ipv4",
        "tag": "dns-remote"
      },
      {
        "address": "https://223.5.5.5/dns-query",
        "address_resolver": "dns-local",
        "detour": "direct",
        "strategy": "prefer_ipv4",
        "tag": "dns-direct"
      },
      {
        "address": "local",
        "detour": "direct",
        "tag": "dns-local"
      },
      {
        "address": "rcode://success",
        "tag": "dns-block"
      }
    ]
  },
  "inbounds": [
    {
      "listen": "0.0.0.0",
      "listen_port": 6450,
      "override_address": "8.8.8.8",
      "override_port": 53,
      "tag": "dns-in",
      "type": "direct"
    },
    {
      "domain_strategy": "",
      "endpoint_independent_nat": true,
      "inet4_address": [
        "172.19.0.1/28"
      ],
      "inet6_address": [
        "fdfe:dcba:9876::1/126"
      ],
      "mtu": 9000,
      "sniff": true,
      "sniff_override_destination": false,
      "stack": "system",
      "tag": "tun-in",
      "type": "tun"
    },
    {
      "domain_strategy": "",
      "listen": "0.0.0.0",
      "listen_port": 2080,
      "sniff": true,
      "sniff_override_destination": false,
      "tag": "mixed-in",
      "type": "mixed"
    },
    {
      "listen": "127.0.0.1",
      "listen_port": 41559,
      "override_address": "B的地址",
      "override_port": 443,
      "tag": "c-0-mapping-90",
      "type": "direct"
    }
  ],
  "log": {
    "level": "debug"
  },
  "outbounds": [
    {
      "server": "127.0.0.1",
      "server_port": 37957,
      "type": "socks",
      "domain_strategy": "",
      "tag": "proxy"
    },
    {
      "password": "",
      "server": "C的地址",
      "server_port": C的端口,
      "username": "",
      "version": "5",
      "type": "socks",
      "domain_strategy": "",
      "tag": "c-107-106",
      "detour": "g-90"
    },
    {
      "tag": "direct",
      "type": "direct"
    },
    {
      "tag": "bypass",
      "type": "direct"
    },
    {
      "tag": "block",
      "type": "block"
    },
    {
      "tag": "dns-out",
      "type": "dns"
    }
  ],
  "route": {
    "auto_detect_interface": true,
    "rules": [
      {
        "outbound": "dns-out",
        "port": [
          53
        ]
      },
      {
        "inbound": [
          "dns-in"
        ],
        "outbound": "dns-out"
      },
      {
        "inbound": [
          "c-0-mapping-90"
        ],
        "outbound": "direct"
      },
      {
        "domain_suffix": [
          "ipinfo.io"
        ],
        "outbound": "c-107-106"
      },
      {
        "geoip": [
          "private"
        ],
        "outbound": "bypass"
      },
      {
        "ip_cidr": [
          "224.0.0.0/3",
          "ff00::/8"
        ],
        "outbound": "block",
        "source_ip_cidr": [
          "224.0.0.0/3",
          "ff00::/8"
        ]
      }
    ]
  }
}
2023/07/29 08:46:28 [Debug] [ProxyInstance] {
  "run_type": "client",
  "local_addr": "127.0.0.1",
  "local_port": 37957,
  "remote_addr": "127.0.0.1",
  "remote_port": 41559,
  "password": [
    "xxxxxxxx"
  ],
  "log_level": 0,
  "mux": {
    "enabled": true,
    "concurrency": 4
  },
  "tcp": {
    "prefer_ipv4": true
  },
  "websocket": {
    "enabled": true,
    "host": "B的地址",
    "path": "xxxxxxxx"
  },
  "ssl": {
    "sni": "B的地址"
  },
  "shadowsocks": {
    "enabled": true,
    "method": "AES-128-GCM",
    "password": "xxxxxxxx"
  }
}
2023/07/29 08:46:28 [Info] [GuardedProcessPool] start process: /data/app/~~xCihdBAFJycZYCq0hbD_OA==/io.nekohasekai.sagernet.plugin.trojan_go-xS68mnXH-eOZXF033txEKw==/lib/arm64/libtrojan-go.so -config /data/user/0/moe.nb4a/cache/tmpcfg/trojan_go_804307478.json
2023/07/29 08:46:28 [Warning] [BaseService$Interface$onStartCommand$2] dependency[nil] not found for outbound[c-107-106]
2023/07/29 08:46:28 [Info] sing-box closed in 0 ms
日志2

  1. 在分组设置中选中 启用 selector,然后无论选择 ABCChain 中哪一个节点,均无法启动(以选择 A 节点为例)
2023/07/29 08:49:44 [Debug] [ProxyInstance] {
  "dns": {
    "independent_cache": true,
    "rules": [
      {
        "domain": [
          "B的地址",
          "A的地址"
        ],
        "server": "dns-direct"
      }
    ],
    "servers": [
      {
        "address": "https://8.8.8.8/dns-query",
        "address_resolver": "dns-direct",
        "strategy": "prefer_ipv4",
        "tag": "dns-remote"
      },
      {
        "address": "https://223.5.5.5/dns-query",
        "address_resolver": "dns-local",
        "detour": "direct",
        "strategy": "prefer_ipv4",
        "tag": "dns-direct"
      },
      {
        "address": "local",
        "detour": "direct",
        "tag": "dns-local"
      },
      {
        "address": "rcode://success",
        "tag": "dns-block"
      }
    ]
  },
  "inbounds": [
    {
      "listen": "0.0.0.0",
      "listen_port": 6450,
      "override_address": "8.8.8.8",
      "override_port": 53,
      "tag": "dns-in",
      "type": "direct"
    },
    {
      "domain_strategy": "",
      "endpoint_independent_nat": true,
      "inet4_address": [
        "172.19.0.1/28"
      ],
      "inet6_address": [
        "fdfe:dcba:9876::1/126"
      ],
      "mtu": 9000,
      "sniff": true,
      "sniff_override_destination": false,
      "stack": "system",
      "tag": "tun-in",
      "type": "tun"
    },
    {
      "domain_strategy": "",
      "listen": "0.0.0.0",
      "listen_port": 2080,
      "sniff": true,
      "sniff_override_destination": false,
      "tag": "mixed-in",
      "type": "mixed"
    },
    {
      "listen": "127.0.0.1",
      "listen_port": 41997,
      "override_address": "A的地址",
      "override_port": 443,
      "tag": "c-87-mapping-87",
      "type": "direct"
    },
    {
      "listen": "127.0.0.1",
      "listen_port": 43209,
      "override_address": "B的地址",
      "override_port": 443,
      "tag": "c-90-mapping-90",
      "type": "direct"
    }
  ],
  "log": {
    "level": "debug"
  },
  "outbounds": [
    {
      "default": "A",
      "outbounds": [
        "A",
        "B",
        "C",
        "C-1"
      ],
      "tag": "proxy",
      "type": "selector"
    },
    {
      "server": "127.0.0.1",
      "server_port": 37947,
      "type": "socks",
      "domain_strategy": "",
      "tag": "A"
    },
    {
      "server": "127.0.0.1",
      "server_port": 42025,
      "type": "socks",
      "domain_strategy": "",
      "tag": "B"
    },
    {
      "password": "",
      "server": "C的地址",
      "server_port": C的端口,
      "username": "",
      "version": "5",
      "type": "socks",
      "domain_strategy": "",
      "tag": "C"
    },
    {
      "password": "",
      "server": "C的地址",
      "server_port": C的端口,
      "username": "",
      "version": "5",
      "type": "socks",
      "domain_strategy": "",
      "tag": "C-1",
      "detour": "g-90"
    },
    {
      "password": "",
      "server": "C的地址",
      "server_port": C的端口,
      "username": "",
      "version": "5",
      "type": "socks",
      "domain_strategy": "",
      "tag": "C-2",
      "detour": "g-90"
    },
    {
      "tag": "direct",
      "type": "direct"
    },
    {
      "tag": "bypass",
      "type": "direct"
    },
    {
      "tag": "block",
      "type": "block"
    },
    {
      "tag": "dns-out",
      "type": "dns"
    }
  ],
  "route": {
    "auto_detect_interface": true,
    "rules": [
      {
        "outbound": "dns-out",
        "port": [
          53
        ]
      },
      {
        "inbound": [
          "dns-in"
        ],
        "outbound": "dns-out"
      },
      {
        "inbound": [
          "c-87-mapping-87"
        ],
        "outbound": "direct"
      },
      {
        "inbound": [
          "c-90-mapping-90"
        ],
        "outbound": "direct"
      },
      {
        "domain_suffix": [
          "ipinfo.io"
        ],
        "outbound": "C-2"
      },
      {
        "geoip": [
          "private"
        ],
        "outbound": "bypass"
      },
      {
        "ip_cidr": [
          "224.0.0.0/3",
          "ff00::/8"
        ],
        "outbound": "block",
        "source_ip_cidr": [
          "224.0.0.0/3",
          "ff00::/8"
        ]
      }
    ]
  }
}
2023/07/29 08:49:44 [Debug] [ProxyInstance] {
  "run_type": "client",
  "local_addr": "127.0.0.1",
  "local_port": 42025,
  "remote_addr": "127.0.0.1",
  "remote_port": 43209,
  "password": [
    "xxxxxxxx"
  ],
  "log_level": 0,
  "mux": {
    "enabled": true,
    "concurrency": 4
  },
  "tcp": {
    "prefer_ipv4": true
  },
  "websocket": {
    "enabled": true,
    "host": "B的地址",
    "path": "xxxxxxxx"
  },
  "ssl": {
    "sni": "B的地址"
  },
  "shadowsocks": {
    "enabled": true,
    "method": "AES-128-GCM",
    "password": "xxxxxxxx"
  }
}
2023/07/29 08:49:44 [Debug] [ProxyInstance] {
  "run_type": "client",
  "local_addr": "127.0.0.1",
  "local_port": 37947,
  "remote_addr": "127.0.0.1",
  "remote_port": 41997,
  "password": [
    "xxxxxxxx"
  ],
  "log_level": 0,
  "mux": {
    "enabled": true,
    "concurrency": 4
  },
  "tcp": {
    "prefer_ipv4": true
  },
  "websocket": {
    "enabled": true,
    "host": "A的地址",
    "path": "xxxxxxxx"
  },
  "ssl": {
    "sni": "A的地址"
  },
  "shadowsocks": {
    "enabled": true,
    "method": "AES-128-GCM",
    "password": "xxxxxxxx"
  }
}
2023/07/29 08:49:44 [Info] [GuardedProcessPool] start process: /data/app/~~xCihdBAFJycZYCq0hbD_OA==/io.nekohasekai.sagernet.plugin.trojan_go-xS68mnXH-eOZXF033txEKw==/lib/arm64/libtrojan-go.so -config /data/user/0/moe.nb4a/cache/tmpcfg/trojan_go_804503445.json
2023/07/29 08:49:44 [Info] [GuardedProcessPool] start process: /data/app/~~xCihdBAFJycZYCq0hbD_OA==/io.nekohasekai.sagernet.plugin.trojan_go-xS68mnXH-eOZXF033txEKw==/lib/arm64/libtrojan-go.so -config /data/user/0/moe.nb4a/cache/tmpcfg/trojan_go_804503447.json
2023/07/29 08:49:44 [Warning] [BaseService$Interface$onStartCommand$2] dependency[nil] not found for outbound[C-1]
2023/07/29 08:49:44 [Info] sing-box closed in 0 ms

zhanbao2000 avatar Jul 29 '23 09:07 zhanbao2000

相同的问题,链式代理无法在路由中指定使用,提示outbound配置不存在,希望能够修复

mrbaiwei avatar Jul 18 '24 08:07 mrbaiwei