-
Notifications
You must be signed in to change notification settings - Fork 4.6k
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
outbound为trojan,关闭mux,内置dns同时查询A和AAAA记录时,AAAA查询失败 #2440
Comments
若53端口增加一个任意门,打上tag,然后route这个tag到dns-in,解析也正常,配置如下: {
"log": {
"loglevel": "debug"
},
"inbounds": [
{
"tag":"transparent",
"port": 1088,
"protocol": "dokodemo-door",
"settings": {
"network": "tcp,udp",
"followRedirect": true
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy",
"mark": 255
}
}
},
{
"port": 1080,
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
},
"settings": {
"auth": "noauth"
}
},
{
"tag":"dns-in",
"port": 53,
"protocol": "dokodemo-door",
"settings": {
"network": "udp"
},
"streamSettings": {
"sockopt": {
"tproxy": "tproxy",
"mark": 255
}
}
}
],
"outbounds": [
{
"tag": "proxy",
"protocol": "trojan",
"settings": {
"servers": [
{
"address": "${myDomain2}",
"method": "chacha20",
"ota": false,
"password": "${myPass}",
"port": 443,
"level": 1,
"flow": ""
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"allowInsecure": true,
"serverName": "${myDomain2}",
"fingerprint": ""
},
"sockopt": {
"mark": 255
}
},
"mux": {
"enabled": false,
"concurrency": -1
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIP"
},
"streamSettings": {
"sockopt": {
"mark": 255
}
}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
}
},
{
"tag": "dns-out",
"protocol": "dns",
"streamSettings": {
"sockopt": {
"mark": 255
}
}
}
],
"dns": {
"hosts": {
"${myDomain1}": "${myIP1}",
"${myDomain2}": "${myIP2}"
},
"servers": [
{
"address": "223.5.5.5",
"port": 53,
"domains": [
"geosite:cn",
"ntp.org",
"${myDomain2}",
"${myDomain1}"
]
},
{
"address": "114.114.114.114",
"port": 53,
"domains": [
"geosite:cn",
"ntp.org",
"${myDomain2}",
"${myDomain1}"
]
},
{
"address": "8.8.8.8",
"port": 53,
"domains": [
"geosite:geolocation-!cn"
]
},
{
"address": "1.1.1.1",
"port": 53,
"domains": [
"geosite:geolocation-!cn"
]
}
]
},
"routing": {
"domainStrategy": "IPOnDemand",
"rules": [
{
"type": "field",
"inboundTag": [
"transparent",
"dns-in"
],
"port": 53,
"network": "udp",
"outboundTag": "dns-out"
},
{
"type": "field",
"inboundTag": [
"transparent"
],
"port": 123,
"network": "udp",
"outboundTag": "direct"
},
{
"type": "field",
"ip": [
"223.5.5.5",
"114.114.114.114"
],
"outboundTag": "direct"
},
{
"type": "field",
"ip": [
"8.8.8.8",
"1.1.1.1"
],
"outboundTag": "proxy"
},
{
"type": "field",
"domain": [
"geosite:category-ads-all"
],
"outboundTag": "block"
},
{
"type": "field",
"protocol":["bittorrent"],
"outboundTag": "direct"
},
{
"type": "field",
"ip": [
"geoip:private",
"geoip:cn"
],
"outboundTag": "direct"
},
{
"type": "field",
"domain": [
"geosite:cn"
],
"outboundTag": "direct"
}
]
}
} 日志: Mar 28 14:03:15 ubuntu v2ray[21132]: 2023/03/28 14:03:15 [Warning] V2Ray 5.4.1 started
Mar 28 14:03:31 ubuntu v2ray[21132]: 2023/03/28 14:03:31 [Debug] transport/internet/udp: UDP original destination: udp:192.168.31.2:53
Mar 28 14:03:31 ubuntu v2ray[21132]: 2023/03/28 14:03:31 [Debug] [2106271116] proxy/dokodemo: processing connection from: 192.168.31.100:58274
Mar 28 14:03:31 ubuntu v2ray[21132]: 2023/03/28 14:03:31 [Info] [2106271116] proxy/dokodemo: received request for 192.168.31.100:58274
Mar 28 14:03:31 ubuntu v2ray[21132]: 2023/03/28 14:03:31 [Info] [2106271116] app/dispatcher: taking detour [dns-out] for [udp:192.168.31.2:53]
Mar 28 14:03:31 ubuntu v2ray[21132]: 2023/03/28 14:03:31 [Info] [2106271116] proxy/dns: handling DNS traffic to udp:192.168.31.2:53
Mar 28 14:03:31 ubuntu v2ray[21132]: 2023/03/28 14:03:31 192.168.31.100:58274 accepted udp:192.168.31.2:53 [dns-out]
Mar 28 14:03:31 ubuntu v2ray[21132]: 2023/03/28 14:03:31 [Debug] [2068725410] proxy/dokodemo: processing connection from: 192.168.31.2:36193
Mar 28 14:03:31 ubuntu v2ray[21132]: 2023/03/28 14:03:31 [Info] [2068725410] app/proxyman/inbound: connection ends > proxy/dokodemo: unable to get destination
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Debug] transport/internet/udp: UDP original destination: udp:192.168.31.2:53
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Debug] [1346756803] proxy/dokodemo: processing connection from: 192.168.31.100:58275
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Info] [1346756803] proxy/dokodemo: received request for 192.168.31.100:58275
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Info] [1346756803] app/dispatcher: taking detour [dns-out] for [udp:192.168.31.2:53]
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Info] [1346756803] proxy/dns: handling DNS traffic to udp:192.168.31.2:53
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 192.168.31.100:58275 accepted udp:192.168.31.2:53 [dns-out]
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Debug] app/dns: domain cnn.com matches following rules: [geosite:geolocation-!cn(DNS idx:2) geosite:geolocation-!cn(DNS idx:3)]
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Debug] app/dns: domain cnn.com will use DNS in order: [UDP:8.8.8.8:53 UDP:1.1.1.1:53 UDP:223.5.5.5:53 UDP:114.114.114.114:53] [TypeA]
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Debug] app/dns: UDP:8.8.8.8:53 querying DNS for: cnn.com.
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Debug] transport/internet/udp: dispatch request to: udp:8.8.8.8:53
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Info] transport/internet/udp: establishing new connection for udp:8.8.8.8:53
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Info] app/dispatcher: taking detour [proxy] for [udp:8.8.8.8:53]
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Info] transport/internet/tcp: dialing TCP to tcp:${myDomain2}:443
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Debug] transport/internet/udp: UDP original destination: udp:8.8.8.8:53
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Debug] [3770314708] proxy/dokodemo: processing connection from: 192.168.31.2:51219
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Info] [3770314708] proxy/dokodemo: received request for 192.168.31.2:51219
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Debug] transport/internet/udp: UDP original destination: udp:8.8.8.8:53
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Debug] [959035624] proxy/dokodemo: processing connection from: 192.168.31.2:56057
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Info] [959035624] proxy/dokodemo: received request for 192.168.31.2:56057
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Info] [959035624] app/dispatcher: taking detour [dns-out] for [udp:8.8.8.8:53]
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Info] [959035624] proxy/dns: handling DNS traffic to udp:8.8.8.8:53
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 192.168.31.2:56057 accepted udp:8.8.8.8:53 [dns-out]
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 192.168.31.2:51219 accepted udp:8.8.8.8:53 [dns-out]
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Info] [3770314708] app/dispatcher: taking detour [dns-out] for [udp:8.8.8.8:53]
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Info] [3770314708] proxy/dns: handling DNS traffic to udp:8.8.8.8:53
Mar 28 14:03:33 ubuntu v2ray[21132]: 2023/03/28 14:03:33 [Info] app/dns: returning 1 IP(s) for domain ${myDomain2} -> [${myIP2}]
Mar 28 14:03:34 ubuntu v2ray[21132]: 2023/03/28 14:03:34 [Info] proxy/trojan: tunneling request to udp:8.8.8.8:53 via ${myDomain2}:443
Mar 28 14:03:35 ubuntu v2ray[21132]: 2023/03/28 14:03:35 [Info] app/dns: UDP:8.8.8.8:53 got answer: cnn.com. TypeA -> [151.101.131.5 151.101.67.5 151.101.3.5 151.101.195.5] 1.771113903s
-- mark here
Mar 28 14:03:35 ubuntu v2ray[21132]: 2023/03/28 14:03:35 [Debug] app/dns: UDP:8.8.8.8:53 updating IP records for domain:cnn.com.
Mar 28 14:03:35 ubuntu v2ray[21132]: 2023/03/28 14:03:35 [Debug] transport/internet/udp: UDP original destination: udp:192.168.31.2:53
Mar 28 14:03:35 ubuntu v2ray[21132]: 2023/03/28 14:03:35 [Debug] [551379548] proxy/dokodemo: processing connection from: 192.168.31.100:58276
Mar 28 14:03:35 ubuntu v2ray[21132]: 2023/03/28 14:03:35 [Info] [551379548] proxy/dokodemo: received request for 192.168.31.100:58276
Mar 28 14:03:35 ubuntu v2ray[21132]: 2023/03/28 14:03:35 [Info] [551379548] app/dispatcher: taking detour [dns-out] for [udp:192.168.31.2:53]
Mar 28 14:03:35 ubuntu v2ray[21132]: 2023/03/28 14:03:35 [Info] [551379548] proxy/dns: handling DNS traffic to udp:192.168.31.2:53
Mar 28 14:03:35 ubuntu v2ray[21132]: 2023/03/28 14:03:35 192.168.31.100:58276 accepted udp:192.168.31.2:53 [dns-out]
Mar 28 14:03:35 ubuntu v2ray[21132]: 2023/03/28 14:03:35 [Debug] app/dns: domain cnn.com matches following rules: [geosite:geolocation-!cn(DNS idx:2) geosite:geolocation-!cn(DNS idx:3)]
Mar 28 14:03:35 ubuntu v2ray[21132]: 2023/03/28 14:03:35 [Debug] app/dns: domain cnn.com will use DNS in order: [UDP:8.8.8.8:53 UDP:1.1.1.1:53 UDP:223.5.5.5:53 UDP:114.114.114.114:53] [TypeAAAA]
Mar 28 14:03:35 ubuntu v2ray[21132]: 2023/03/28 14:03:35 [Debug] app/dns: UDP:8.8.8.8:53 querying DNS for: cnn.com.
Mar 28 14:03:35 ubuntu v2ray[21132]: 2023/03/28 14:03:35 [Debug] transport/internet/udp: dispatch request to: udp:8.8.8.8:53
Mar 28 14:03:35 ubuntu v2ray[21132]: 2023/03/28 14:03:35 [Info] app/dns: UDP:8.8.8.8:53 got answer: cnn.com. TypeAAAA -> [[2a04:4e42:400::773] [2a04:4e42:a00::773] [2a04:4e42:c00::773] [2a04:4e42::773] [2a04:4e42:e00::773] [2a04:4e42:600::773] [2a04:4e42:200::773] [2a04:4e42:800::773]] 168.285036ms
Mar 28 14:03:35 ubuntu v2ray[21132]: 2023/03/28 14:03:35 [Debug] app/dns: UDP:8.8.8.8:53 updating IP records for domain:cnn.com. 虽然时间有点久,但是没有报错。 |
Might you provide a collection of minimal configurations for the client, server, and iptables rules that would still be capable of replicating this issue? |
Ok, I will provide later. |
below is the minimal config i can provide to replicate the bug: {
"log": {
"loglevel": "debug"
},
"inbounds": [
{
"tag":"transparent",
"port": 1088,
"protocol": "dokodemo-door",
"settings": {
"network": "tcp,udp",
"followRedirect": true
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
},
{
"port": 1080,
"protocol": "socks",
"sniffing": {
"enabled": true,
"destOverride": ["http", "tls"]
},
"settings": {
"auth": "noauth"
}
}
],
"outbounds": [
{
"tag": "proxy",
"protocol": "trojan",
"settings": {
"servers": [
{
"address": "${proxyDomain}",
"method": "chacha20",
"ota": false,
"password": "${proxyPass}",
"port": 443,
"level": 1,
"flow": ""
}
]
},
"streamSettings": {
"network": "tcp",
"security": "tls",
"tlsSettings": {
"allowInsecure": true,
"serverName": "${proxyDomain}",
"fingerprint": ""
},
"sockopt": {
"mark": 255
}
},
"mux": {
"enabled": false,
"concurrency": -1
}
},
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"domainStrategy": "UseIP"
},
"streamSettings": {
"sockopt": {
"mark": 255
}
}
},
{
"tag": "block",
"protocol": "blackhole",
"settings": {
"response": {
"type": "http"
}
}
},
{
"tag": "dns-out",
"protocol": "dns",
"streamSettings": {
"sockopt": {
"mark": 255
}
}
}
],
"dns": {
"servers": [
{
"address": "223.5.5.5",
"port": 53,
"domains": [
"geosite:cn",
"ntp.org",
"${proxyDomain}"
]
},
{
"address": "8.8.8.8",
"port": 53,
"domains": [
"geosite:geolocation-!cn"
]
}
]
},
"routing": {
"domainStrategy": "IPOnDemand",
"rules": [
{
"type": "field",
"inboundTag": [
"transparent"
],
"port": 53,
"network": "udp",
"outboundTag": "dns-out"
},
{
"type": "field",
"ip": [
"223.5.5.5"
],
"outboundTag": "direct"
},
{
"type": "field",
"ip": [
"8.8.8.8"
],
"outboundTag": "proxy"
},
{
"type": "field",
"ip": [
"geoip:private",
"geoip:cn"
],
"outboundTag": "direct"
},
{
"type": "field",
"domain": [
"geosite:cn"
],
"outboundTag": "direct"
}
]
}
} in wsl2, i run command: curl -x socks5://192.168.31.2:1080 www.cnn.com -v here is where this bug occured Mar 29 13:39:18 ubuntu v2ray[17271]: 2023/03/29 13:39:18 [Debug] app/dns: domain www.cnn.com matches following rules: [geosite:geolocation-!cn(DNS idx:1)]
Mar 29 13:39:18 ubuntu v2ray[17271]: 2023/03/29 13:39:18 [Debug] app/dns: domain www.cnn.com will use DNS in order: [UDP:8.8.8.8:53 UDP:223.5.5.5:53] [TypeA TypeAAAA]
-- query A && AAAA together
Mar 29 13:39:18 ubuntu v2ray[17271]: 2023/03/29 13:39:18 [Debug] app/dns: client.QueryIP begin
Mar 29 13:39:18 ubuntu v2ray[17271]: 2023/03/29 13:39:18 [Debug] app/dns: udp QueryIP begin
Mar 29 13:39:18 ubuntu v2ray[17271]: 2023/03/29 13:39:18 [Debug] app/dns: sendQuery begin: www.cnn.com.
Mar 29 13:39:18 ubuntu v2ray[17271]: 2023/03/29 13:39:18 [Debug] app/dns: UDP:8.8.8.8:53 querying DNS for: www.cnn.com.
Mar 29 13:39:18 ubuntu v2ray[17271]: 2023/03/29 13:39:18 [Debug] transport/internet/udp: dispatch request to: udp:8.8.8.8:53
Mar 29 13:39:18 ubuntu v2ray[17271]: 2023/03/29 13:39:18 [Info] transport/internet/udp: establishing new connection for udp:8.8.8.8:53
Mar 29 13:39:18 ubuntu v2ray[17271]: 2023/03/29 13:39:18 [Debug] transport/internet/udp: dispatch request to: udp:8.8.8.8:53
Mar 29 13:39:18 ubuntu v2ray[17271]: 2023/03/29 13:39:18 [Info] app/dispatcher: taking detour [proxy] for [udp:8.8.8.8:53]
Mar 29 13:39:18 ubuntu v2ray[17271]: 2023/03/29 13:39:18 [Info] transport/internet/tcp: dialing TCP to tcp:${proxyDomain}:443
Mar 29 13:39:18 ubuntu v2ray[17271]: 2023/03/29 13:39:18 [Debug] app/dns: sendQuery end: www.cnn.com.
Mar 29 13:39:18 ubuntu v2ray[17271]: 2023/03/29 13:39:18 [Debug] app/dns: QueryIP select begin
Mar 29 13:39:19 ubuntu v2ray[17271]: 2023/03/29 13:39:19 [Info] proxy/trojan: tunneling request to udp:8.8.8.8:53 via ${proxyDomain}:443
Mar 29 13:39:19 ubuntu v2ray[17271]: 2023/03/29 13:39:19 [Info] app/dns: UDP:8.8.8.8:53 got answer: www.cnn.com. TypeA -> [151.101.3.5 151.101.67.5 151.101.131.5 151.101.195.5] 832.263115ms
Mar 29 13:39:19 ubuntu v2ray[17271]: 2023/03/29 13:39:19 [Debug] app/dns: A
Mar 29 13:39:19 ubuntu v2ray[17271]: 2023/03/29 13:39:19 [Debug] app/dns: UDP:8.8.8.8:53 updating IP records for domain:www.cnn.com.
Mar 29 13:39:19 ubuntu v2ray[17271]: 2023/03/29 13:39:19 [Debug] app/dns: 1
Mar 29 13:39:19 ubuntu v2ray[17271]: 2023/03/29 13:39:19 [Debug] app/dns: 2
Mar 29 13:39:19 ubuntu v2ray[17271]: 2023/03/29 13:39:19 [Debug] app/dns: 3
Mar 29 13:39:19 ubuntu v2ray[17271]: 2023/03/29 13:39:19 [Debug] app/dns: 4
Mar 29 13:39:19 ubuntu v2ray[17271]: 2023/03/29 13:39:19 [Debug] app/dns: 5
Mar 29 13:39:19 ubuntu v2ray[17271]: 2023/03/29 13:39:19 [Debug] app/dns: 6
Mar 29 13:39:19 ubuntu v2ray[17271]: 2023/03/29 13:39:19 [Debug] app/dns: B
-- mark here
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: QueryIP select end with errcontext deadline exceeded
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: client.QueryIP end
-- mark here
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Info] app/dns: failed to lookup ip for domain www.cnn.com at server UDP:8.8.8.8:53 > context deadline exceeded
-- mark here
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: client.QueryIP begin
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: udp QueryIP begin
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: sendQuery begin: www.cnn.com.
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: UDP:223.5.5.5:53 querying DNS for: www.cnn.com.
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] transport/internet/udp: dispatch request to: udp:223.5.5.5:53
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Info] transport/internet/udp: establishing new connection for udp:223.5.5.5:53
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] transport/internet/udp: dispatch request to: udp:223.5.5.5:53
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: sendQuery end: www.cnn.com.
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: QueryIP select begin
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Info] app/dispatcher: taking detour [direct] for [udp:223.5.5.5:53]
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Info] proxy/freedom: opening connection to udp:223.5.5.5:53
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Info] app/dns: UDP:223.5.5.5:53 got answer: www.cnn.com. TypeA -> [151.101.111.5] 1.731517ms
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: A
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: UDP:223.5.5.5:53 updating IP records for domain:www.cnn.com.
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: 1
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: 2
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: 3
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: 4
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: 5
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: 6
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: B
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Info] app/dns: UDP:223.5.5.5:53 got answer: www.cnn.com. TypeAAAA -> [[2a04:4e42:8c::773]] 5.005411ms
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: A
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: UDP:223.5.5.5:53 updating IP records for domain:www.cnn.com.
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: 1
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: 2
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: 3
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: 4
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: 5
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: 6
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: B
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: QueryIP select end
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Debug] app/dns: client.QueryIP end
Mar 29 13:39:22 ubuntu v2ray[17271]: 2023/03/29 13:39:22 [Warning] [589579102] app/dispatcher: default route for tcp:www.cnn.com:80 it seems a socks5 query will trigger A && AAAA dns query at the same time, and the A query will success and the AAAA will fail. |
update: after replace "mux": {
"enabled": false,
"concurrency": -1
} to "mux": {
"enabled": true
} this bug disappeared, and if you disable mux, it will occur. with mux enabled, the dns app can get A && AAAA address at the same time. |
While a split configuration with two separate instances is still viable, for the sake of simplicity, I can reproduce the mentioned issues utilizing a minimal configuration that consolidates client and server setup on a fresh ubuntu:20.04 docker image with single instances of v2ray-core 5.4.1: # yaml-language-server: $schema=https://cdn.jsdelivr.net/gh/EHfive/v2ray-jsonschema/v4-config.schema.json
log:
loglevel: debug
inbounds:
- tag: client_in
protocol: socks
port: 4000
listen: 127.0.0.1
- tag: server_in
listen: 127.0.0.2
port: 5000
protocol: trojan
settings:
clients:
- password: testing
outbounds:
- tag: client_out
protocol: trojan
settings:
servers:
- address: 127.0.0.2
port: 5000
password: testing
- tag: server_out
protocol: freedom
dns:
servers:
- 1.1.1.1
routing:
domainStrategy: IPOnDemand
rules:
- outboundTag: client_out
ip:
127.1.1.1
type: field
- outboundTag: client_out
inboundTag:
- client_in
type: field
- outboundTag: server_out
inboundTag:
- server_in
type: field The utilization of v2ray When employing @HxGned Could you please rephrase the initial title and post body, given that this issues is inconsequential to the subject of transparent proxy or client inbound? |
ok will update soon |
Is this a duplicate of #1795? |
seems yes, i am trying to work this out via debuging. |
try git diff v5.4.1
diff --git a/proxy/trojan/protocol.go b/proxy/trojan/protocol.go
index 21e6a5a8..dba2cf76 100644
--- a/proxy/trojan/protocol.go
+++ b/proxy/trojan/protocol.go
@@ -101,11 +101,8 @@ type PacketWriter struct {
// WriteMultiBuffer implements buf.Writer
func (w *PacketWriter) WriteMultiBuffer(mb buf.MultiBuffer) error {
- b := make([]byte, maxLength)
- for !mb.IsEmpty() {
- var length int
- mb, length = buf.SplitBytes(mb, b)
- if _, err := w.writePacket(b[:length], w.Target); err != nil {
+ for _, b := range mb {
+ if _, err := w.writePacket(b.Bytes(), w.Target); err != nil {
buf.ReleaseMulti(mb)
return err
}
@@ -116,11 +113,8 @@ func (w *PacketWriter) WriteMultiBuffer(mb buf.MultiBuffer) error {
// WriteMultiBufferWithMetadata writes udp packet with destination specified
func (w *PacketWriter) WriteMultiBufferWithMetadata(mb buf.MultiBuffer, dest net.Destination) error {
- b := make([]byte, maxLength)
- for !mb.IsEmpty() {
- var length int
- mb, length = buf.SplitBytes(mb, b)
- if _, err := w.writePacket(b[:length], dest); err != nil {
+ for _, b := range mb {
+ if _, err := w.writePacket(b.Bytes(), dest); err != nil {
buf.ReleaseMulti(mb)
return err
}
|
genius👍, it worked client side log: 2023/04/01 09:06:19 [Info] proxy/trojan: tunneling request to udp:8.8.8.8:53 via 192.168.31.2:1443
2023/04/01 09:06:19 [Debug] transport/internet/udp: ReadMultiBuffer end
sub4 case <-sub4.Wait():
2023/04/01 09:06:19 [Info] app/dns: UDP:8.8.8.8:53 got answer: www.cnn.com. TypeA -> [146.75.115.5] 12.178ms
2023/04/01 09:06:19 [Debug] app/dns: A
2023/04/01 09:06:19 [Debug] app/dns: UDP:8.8.8.8:53 updating IP records for domain:www.cnn.com.
2023/04/01 09:06:19 [Debug] app/dns: 1
2023/04/01 09:06:19 [Debug] app/dns: 2
2023/04/01 09:06:19 [Debug] app/dns: 3
2023/04/01 09:06:19 [Debug] app/dns: 4
2023/04/01 09:06:19 [Debug] app/dns: 5
2023/04/01 09:06:19 [Debug] app/dns: 6
2023/04/01 09:06:19 [Debug] app/dns: B
2023/04/01 09:06:19 [Debug] transport/internet/udp: handleInput...
2023/04/01 09:06:19 [Debug] transport/internet/udp: ReadMultiBuffer begin
2023/04/01 09:06:19 [Debug] transport/internet/udp: ReadMultiBuffer end
2023/04/01 09:06:19 [Info] app/dns: UDP:8.8.8.8:53 got answer: www.cnn.com. TypeAAAA -> [[2a04:4e42:1a::773]] 233.5629ms server side log: 2023/04/01 01:05:37 [Warning] V2Ray 5.4.1 started
2023/04/01 01:06:19 [Info] [4070251905] proxy/trojan: firstLen = 148
2023/04/01 01:06:19 [Info] [4070251905] proxy/trojan: tunnelling request to udp:8.8.8.8:53
-- first A
2023/04/01 01:06:19 [Debug] [4070251905] transport/internet/udp: dispatch request to: udp:8.8.8.8:53
2023/04/01 01:06:19 [Info] transport/internet/udp: establishing new connection for udp:8.8.8.8:53
2023/04/01 01:06:19 [Info] [4070251905] proxy/trojan: tunnelling request to udp:8.8.8.8:53
2023/04/01 01:06:19 tcp:192.168.31.100:1618 accepted udp:8.8.8.8:53 [direct] email: love@v2fly.org
-- second AAAA
2023/04/01 01:06:19 [Debug] [4070251905] transport/internet/udp: dispatch request to: udp:8.8.8.8:53
2023/04/01 01:06:19 [Warning] [4070251905] app/dispatcher: default route for udp:8.8.8.8:53
2023/04/01 01:06:19 [Info] [4070251905] proxy/freedom: opening connection to udp:8.8.8.8:53
2023/04/01 01:06:19 [Info] [4239477395] proxy/trojan: firstLen = 170
2023/04/01 01:06:19 [Info] [4239477395] proxy/trojan: received request for tcp:www.cnn.com:80
2023/04/01 01:06:19 [Warning] [4239477395] app/dispatcher: default route for tcp:www.cnn.com:80
2023/04/01 01:06:19 [Info] [4239477395] proxy/freedom: opening connection to tcp:www.cnn.com:80
2023/04/01 01:06:19 [Info] [4239477395] transport/internet/tcp: dialing TCP to tcp:www.cnn.com:80
2023/04/01 01:06:19 192.168.31.100:1619 accepted tcp:www.cnn.com:80 [direct] email: love@v2fly.org
2023/04/01 01:06:20 [Info] [4239477395] app/proxyman/outbound: failed to process outbound traffic > proxy/freedom: connection ends > context canceled |
close v2fly#2440, close v2fly#1795
update: 2023-03-31
经过关闭trojan协议的tls层抓取报文发现,客户端发给服务器的请求(udp associate)包含A和AAAA,但是服务器只回了A记录:
客户端日志(增加了部分打印payload的)
客户端发往服务器:(包含A和AAAA,部分包内容,去掉了部分SHA224信息)
服务器回包,只包含A记录:
update:2023-03-30
经过换多个outbound配置进行测试,发现outbound是trojan,以及关闭mux的情况下,若内置dns同时查询A和AAAA记录(例如route策略为IPOnDemend,freedom出口按IP,最简复现配置晚些提供。),开放一个inbound为socks5或者http,然后curl使用这个inbound,则会触发这个bug(需要远程服务器延迟比较大)。
@mydogshitgold 使用docker镜像和ymal配置也复现了这个bug,使用vmess和vless则不涉及。
你正在使用哪个版本的 V2Ray?
[Warning] V2Ray 5.4.1 started
服务器版本相同
你的使用场景是什么?
按照白话文配置的透明代理环境,透明代理模式下,一切工作正常,dns根据域名也能合理分流国内国外。
教程链接:https://guide.v2fly.org/app/tproxy.html
环境信息:
v2ray网关:192.168.31.2, N5105 x86,ubuntu 22.04,tproxy端口1088,socks5服务端口1080
IPTABLES配置如下:
你看到的异常现象是什么?
浏览器使用socks5代理访问(switchyomega)的情况下,打开网页非常慢,需要5-6秒才能打开(用海外dns解析的),国内网站正常(使用阿里dns解析的),日志出现大量dns解析超时的报错,奇怪的是remote已经返回结果了,然后update dns记录时报错,然后打印context deadline exceeded
你期待看到的正常表现是怎样的?
socks5使用正常
请附上你的配置
服务端配置:
需要同时支持trojan和ss-websocket for windows模式,服务端应该没有任何问题
客户端配置:
请附上出错时软件输出的错误日志
服务器端错误日志:
应该与服务器无关,服务器一切正常
客户端错误日志:
客户端有报错
-- stuck here那里有阻塞一会,时间和服务器日志不同因为GMT不同,UTC是一样的
第二个stuck here的地方,remote返回dns结果只有600多毫秒,但是也更新记录那里卡住然后失败了。
failed to lookup ip for domain www.cnn.com at server UDP:1.1.1.1:53 > context deadline exceeded
请附上访问日志
未配置,应该不涉及
// 在这里附上服务器端日志
其它相关的配置文件(如 Nginx)和相关日志
不涉及
如果 V2Ray 无法启动,请附上
--test
命令的输出不涉及
如果 V2Ray 服务运行异常,请附上 journal 日志
不涉及
The text was updated successfully, but these errors were encountered: