v2rayNG
v2rayNG copied to clipboard
自行编译的outbound中block和direct标签中的协议无法正常转发请求
预期行为
软件按照配置内容正确的转发请求
实际行为
在outbound部分,仅proxy(socks)
规则正常运行,block(blackhole)
和direct(freedom)
在转发时会出现错误app/proxyman/inbound: connection ends > proxy/socks: connection ends > proxy/socks: failed to transport all TCP response > io: read/write on closed pipe
已知情况:
-
block(blackhole)
和direct(freedom)
在rule
的最后一条仅设置了"network": "tcp,udp"
的内容正常运行,不排除自动分配的可能性。 - 更新到1.8.15版本的代码并没有解决这个问题,同时还会出现
fdConn unix.Connect err, Close Fd: * Err: network is unreachable
样式的报错。 - 该配置在其他同样使用v2ray系核心的代理应用中能够正常运行,例如:
Kitsunebi
、ShadowRocket
以及一些GitHub中的其他项目。
复现方法
- 编译
AndroidLibXrayLite
以及AndroidLibV2rayLite
中的libtun2socks
并导入项目。 - 在
routing
方法中添加预设的自定义规则。 - 编译
V2RayNG 1.8.12
并运行。
日志信息
2024-02-21 11:13:12.072 32261-32261 com.v2ray.ang com.v2ray.ang D {
"dns": {},
"inbounds": [
{
"listen": "127.0.0.1",
"port": 10808,
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true
},
"sniffing": {
"destOverride": [
"http",
"tls"
],
"enabled": true,
"metadataOnly": false
},
"tag": "socks"
},
{
"listen": "127.0.0.1",
"port": 10809,
"protocol": "http",
"tag": "http"
}
],
"log": {
"loglevel": "debug"
},
"outbounds": [
{
"mux": {
"concurrency": -1,
"enabled": false,
"xudpConcurrency": 8,
"xudpProxyUDP443": ""
},
"protocol": "socks",
"settings": {
"servers": [
{
"address": "mydomain",
"level": 0,
"method": "chacha20-poly1305",
"ota": false,
"password": "",
"port": 1234,
"users": [
{
"level": 0,
"pass": "12345678",
"user": "12345678"
}
]
}
]
},
"streamSettings": {
"network": "tcp",
"security": ""
},
"tag": "proxy"
},
{
"protocol": "freedom",
"settings": {
"domainStrategy": "AsIs"
},
"tag": "direct"
},
{
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
},
"tag": "block"
}
],
"routing": {
"domainMatcher": "hybrid",
"domainStrategy": "AsIs",
"rules": [
{
"domain": [
"ssl",
"aliyuncs"
],
"outboundTag": "direct",
"type": "field"
},
{
"ip": [
"1.1.1.1",
"8.8.8.8",
"223.5.5.5",
"119.29.29.29",
"114.114.114.114",
"182.254.116.116"
],
"outboundTag": "direct",
"type": "field"
},
{
"outboundTag": "proxy",
"port": "10443",
"type": "field"
},
{
"outboundTag": "block",
"port": "8080",
"type": "field"
},
{
"outboundTag": "block",
"port": "80",
"type": "field"
},
{
"outboundTag": "block",
"port": "443",
"type": "field"
},
{
"network": "tcp,udp",
"outboundTag": "direct",
"type": "field"
}
]
}
}
2024-02-21 11:13:12.074 32261-32261 GoLog com.v2ray.ang I loading core config
2024-02-21 11:13:12.075 32261-916 GoLog com.v2ray.ang I Preparing Domain: mydomain:1234
2024-02-21 11:13:12.076 32261-32261 GoLog com.v2ray.ang I new core
2024-02-21 11:13:12.077 32261-32261 GoLog com.v2ray.ang I start core
2024-02-21 11:13:12.077 32261-4546 GoLog com.v2ray.ang I [Debug] app/log: Logger started
2024-02-21 11:13:12.077 32261-4546 GoLog com.v2ray.ang I [Info] app/dns: DNS: created localhost client
2024-02-21 11:13:12.077 32261-4546 GoLog com.v2ray.ang I [Debug] app/router: MphDomainMatcher is enabled for * domain rule(s)
2024-02-21 11:13:12.077 32261-4546 GoLog com.v2ray.ang I [Debug] app/router: MphDomainMatcher is enabled for * domain rule(s)
2024-02-21 11:13:12.077 32261-4546 GoLog com.v2ray.ang I [Debug] app/router: MphDomainMatcher is enabled for * domain rule(s)
2024-02-21 11:13:12.077 32261-4546 GoLog com.v2ray.ang I [Debug] app/router: MphDomainMatcher is enabled for * domain rule(s)
2024-02-21 11:13:12.077 32261-4546 GoLog com.v2ray.ang I [Debug] app/router: MphDomainMatcher is enabled for * domain rule(s)
2024-02-21 11:13:12.077 32261-4546 GoLog com.v2ray.ang I [Debug] app/router: MphDomainMatcher is enabled for * domain rule(s)
2024-02-21 11:13:12.077 32261-4546 GoLog com.v2ray.ang I [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:10808
2024-02-21 11:13:12.077 32261-4546 GoLog com.v2ray.ang I [Debug] app/proxyman/inbound: creating stream worker on 127.0.0.1:10809
2024-02-21 11:13:12.080 32261-32562 GoLog com.v2ray.ang I [Info] transport/internet/tcp: listening TCP on 127.0.0.1:10808
2024-02-21 11:13:12.081 32261-32562 GoLog com.v2ray.ang I [Info] transport/internet/udp: listening UDP on 127.0.0.1:10808
2024-02-21 11:13:12.082 32261-32562 GoLog com.v2ray.ang I [Info] transport/internet/tcp: listening TCP on 127.0.0.1:10809
2024-02-21 11:13:12.082 32261-32562 GoLog com.v2ray.ang I [Warning] core: Xray 1.8.7 started
2024-02-21 11:13:12.082 32261-916 GoLog com.v2ray.ang I Prepare Result:
Domain: mydomain
Port: 1234
IPs: [**.***.***.***]
2024-02-21 11:13:12.103 32261-32261 com.v2ray.ang com.v2ray.ang D [/data/app/~~PdDQPCFQKTLbyhkHFzeR_g==/com.v2ray.ang-U7C0ppWo6wsCsZh44SIgIA==/lib/arm64/libtun2socks.so, --netif-ipaddr, 26.26.26.2, --netif-netmask, 255.255.255.252, --socks-server-addr, 127.0.0.1:10808, --tunmtu, 1500, --sock-path, sock_path, --enable-udprelay, --loglevel, notice, --netif-ip6addr, da26:2626::2]
2024-02-21 11:13:12.106 32261-32261 com.v2ray.ang com.v2ray.ang D Process[pid=7367, hasExited=false]
2024-02-21 11:13:12.106 32261-32261 com.v2ray.ang com.v2ray.ang D /data/user/0/com.v2ray.ang/files/sock_path
2024-02-21 11:13:12.123 32261-7368 com.v2ray.ang com.v2ray.ang D libtun2socks.so check
2024-02-21 11:13:12.169 32261-32298 com.v2ray.ang com.v2ray.ang D sendFd tries: 0
2024-02-21 11:13:12.336 32261-916 GoLog com.v2ray.ang I [Info] [3660751690] proxy/socks: TCP Connect request to tcp:***.***.***.***:80
2024-02-21 11:13:12.337 32261-916 GoLog com.v2ray.ang I [Info] [3532182598] proxy/socks: TCP Connect request to tcp:***.***.***.***:80
2024-02-21 11:13:12.346 32261-916 GoLog com.v2ray.ang I [Info] [3660751690] app/dispatcher: sniffed domain: ***.***.***.***
2024-02-21 11:13:12.346 32261-916 GoLog com.v2ray.ang I [Info] [3660751690] app/dispatcher: taking detour [block] for [tcp:***.***.***.***:80]
2024-02-21 11:13:12.346 32261-916 GoLog com.v2ray.ang I [Info] [3532182598] app/dispatcher: sniffed domain: ***.***.***.***
2024-02-21 11:13:12.346 32261-916 GoLog com.v2ray.ang I [Info] [3532182598] app/dispatcher: taking detour [block] for [tcp:***.***.***.***:80]
2024-02-21 11:13:12.346 32261-916 GoLog com.v2ray.ang I tcp:127.0.0.1:48762 accepted tcp:***.***.***.***:80 [socks -> block]
2024-02-21 11:13:12.346 32261-916 GoLog com.v2ray.ang I tcp:127.0.0.1:48764 accepted tcp:***.***.***.***:80 [socks -> block]
2024-02-21 11:13:13.347 32261-32562 GoLog com.v2ray.ang I [Info] [3532182598] app/proxyman/inbound: connection ends > proxy/socks: connection ends > proxy/socks: failed to transport all TCP response > io: read/write on closed pipe
2024-02-21 11:13:13.347 32261-32562 GoLog com.v2ray.ang I [Info] [3660751690] app/proxyman/inbound: connection ends > proxy/socks: connection ends > proxy/socks: failed to transport all TCP response > io: read/write on closed pipe
2024-02-21 11:13:13.477 32261-32562 GoLog com.v2ray.ang I [Info] [1343616154] proxy/socks: TCP Connect request to tcp:***.***.***.**:8801
2024-02-21 11:13:13.477 32261-916 GoLog com.v2ray.ang I Not Using Prepared: tcp,***.***.***.**:8801
2024-02-21 11:13:13.477 32261-32562 GoLog com.v2ray.ang I [Info] [1343616154] app/dispatcher: taking detour [direct] for [tcp:***.***.***.**:8801]
2024-02-21 11:13:13.477 32261-32562 GoLog com.v2ray.ang I tcp:127.0.0.1:48772 accepted tcp:***.***.***.**:8801 [socks -> direct]
2024-02-21 11:13:13.478 32261-32562 GoLog com.v2ray.ang I [Info] [1343616154] transport/internet/tcp: dialing TCP to tcp:***.***.***.**:8801
2024-02-21 11:13:13.517 32261-4546 GoLog com.v2ray.ang I [Info] [1343616154] proxy/freedom: connection opened to tcp:***.***.***.**:8801, local endpoint 192.168.31.239:48270, remote endpoint ***.***.***.**:8801
2024-02-21 11:13:13.843 32261-4546 GoLog com.v2ray.ang I [Info] [664132363] proxy/socks: TCP Connect request to tcp:***.***.***.***:80
2024-02-21 11:13:13.843 32261-4546 GoLog com.v2ray.ang I [Info] [1705612984] proxy/socks: TCP Connect request to tcp:***.***.***.***:80
2024-02-21 11:13:13.848 32261-32289 GoLog com.v2ray.ang I tcp:127.0.0.1:48780 accepted tcp:***.***.***.***:80 [socks -> block]
2024-02-21 11:13:13.848 32261-32289 GoLog com.v2ray.ang I [Info] [1705612984] app/dispatcher: sniffed domain: ***.***.***.***
2024-02-21 11:13:13.849 32261-32289 GoLog com.v2ray.ang I [Info] [1705612984] app/dispatcher: taking detour [block] for [tcp:***.***.***.***:80]
2024-02-21 11:13:13.849 32261-32289 GoLog com.v2ray.ang I [Info] [664132363] app/dispatcher: sniffed domain: ***.***.***.***
2024-02-21 11:13:13.849 32261-32289 GoLog com.v2ray.ang I [Info] [664132363] app/dispatcher: taking detour [block] for [tcp:***.***.***.***:80]
2024-02-21 11:13:13.849 32261-32289 GoLog com.v2ray.ang I tcp:127.0.0.1:48782 accepted tcp:***.***.***.***:80 [socks -> block]
2024-02-21 11:13:14.175 32261-4546 GoLog com.v2ray.ang I [Info] [1981064567] proxy/socks: TCP Connect request to tcp:***.**.**.***:1884
2024-02-21 11:13:14.175 32261-4546 GoLog com.v2ray.ang I Not Using Prepared: tcp,*******.****.**.*******.***:1884
2024-02-21 11:13:14.177 32261-916 GoLog com.v2ray.ang I [Info] [1981064567] app/dispatcher: sniffed domain: *******.****.**.*******.***
2024-02-21 11:13:14.177 32261-916 GoLog com.v2ray.ang I [Info] [1981064567] app/dispatcher: taking detour [direct] for [tcp:*******.****.**.*******.***:1884]
2024-02-21 11:13:14.177 32261-916 GoLog com.v2ray.ang I [Info] [1981064567] transport/internet/tcp: dialing TCP to tcp:*******.****.**.*******.***:1884
2024-02-21 11:13:14.178 32261-32562 GoLog com.v2ray.ang I tcp:127.0.0.1:48790 accepted tcp:***.**.**.***:1884 [socks -> direct]
2024-02-21 11:13:14.215 32261-32289 GoLog com.v2ray.ang I [Info] [1981064567] proxy/freedom: connection opened to tcp:*******.****.**.*******.***:1884, local endpoint 192.168.31.239:41486, remote endpoint ***.**.**.***:1884
2024-02-21 11:13:14.605 32261-916 GoLog com.v2ray.ang I [Info] [2491668192] proxy/socks: TCP Connect request to tcp:***.**.**.**:8013
2024-02-21 11:13:14.606 32261-916 GoLog com.v2ray.ang I [Info] [2491668192] app/dispatcher: sniffed domain: ********.***.**.***
2024-02-21 11:13:14.607 32261-916 GoLog com.v2ray.ang I [Info] [2491668192] app/dispatcher: taking detour [direct] for [tcp:********.***.**.***:8013]
2024-02-21 11:13:14.607 32261-916 GoLog com.v2ray.ang I tcp:127.0.0.1:48796 accepted tcp:***.**.**.**:8013 [socks -> direct]
2024-02-21 11:13:14.607 32261-4546 GoLog com.v2ray.ang I Not Using Prepared: tcp,********.***.**.***:8013
2024-02-21 11:13:14.608 32261-916 GoLog com.v2ray.ang I [Info] [2491668192] transport/internet/tcp: dialing TCP to tcp:********.***.**.***:8013
2024-02-21 11:13:14.648 32261-4546 GoLog com.v2ray.ang I [Info] [2491668192] proxy/freedom: connection opened to tcp:********.***.**.***:8013, local endpoint 192.168.31.239:46696, remote endpoint ***.**.**.**:8013
2024-02-21 11:13:14.732 32261-4546 GoLog com.v2ray.ang I [Info] [2491668192] app/proxyman/inbound: connection ends > proxy/socks: connection ends > proxy/socks: failed to transport all TCP request > io: read/write on closed pipe
2024-02-21 11:13:14.850 32261-32562 GoLog com.v2ray.ang I [Info] [664132363] app/proxyman/inbound: connection ends > proxy/socks: connection ends > proxy/socks: failed to transport all TCP response > io: read/write on closed pipe
2024-02-21 11:13:14.850 32261-32562 GoLog com.v2ray.ang I [Info] [1705612984] app/proxyman/inbound: connection ends > proxy/socks: connection ends > proxy/socks: failed to transport all TCP response > io: read/write on closed pipe
2024-02-21 11:13:14.967 32261-32562 GoLog com.v2ray.ang I [Info] [2891503768] proxy/socks: TCP Connect request to tcp:***.**.***.**:10443
2024-02-21 11:13:14.968 32261-32562 GoLog com.v2ray.ang I tcp:127.0.0.1:48956 accepted tcp:***.**.***.**:10443 [socks -> proxy]
2024-02-21 11:13:14.968 32261-32285 GoLog com.v2ray.ang I [Info] [2891503768] app/dispatcher: taking detour [proxy] for [tcp:***.**.***.**:10443]
2024-02-21 11:13:14.968 32261-32285 GoLog com.v2ray.ang I [Info] [2891503768] transport/internet/tcp: dialing TCP to tcp:mydomain:1234
2024-02-21 11:13:15.024 32261-32285 GoLog com.v2ray.ang I Using Prepared: **.***.***.***
环境信息
编译环境
AndroidLibXrayLite(latest)
- Windows 11 22H2 22621.3155
- GoLang 1.22.0
- JDK 17.0.2
V2RayNG(1.8.12)
- Windows 11 22H2 22621.3155
- JDK 8
- Android Studio Hedgehog | 2023.1.1 Patch 2
libtun2socks from AndroidLibV2rayLite(latest)
- Ubuntu 22.04.3
- GoLang 1.22.0
- gomobile latest
- JDK 8
运行环境
红米K40s
- Android 13
- MIUI 14.0.7.0
- Kernel 4.19.157
小米13
- Android 13
- MIUI V14.0.23.2.21.DEV
- Kernel 5.15.41-android13-8-00015
额外信息(可选)
无