Skip to content
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

内置DNS服务器解析一些特殊域名还是存在问题 #293

Closed
chazikai24 opened this issue Feb 22, 2021 · 11 comments
Closed

内置DNS服务器解析一些特殊域名还是存在问题 #293

chazikai24 opened this issue Feb 22, 2021 · 11 comments
Assignees

Comments

@chazikai24
Copy link

chazikai24 commented Feb 22, 2021

以前有人在v2ray项目上反馈过,并修复过issues
实际测试下来还是无法解析mijia cloud

1.你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明)
xray1.30,规则采用v2ray加强版

2.你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。
openwrt使用tproxy透明代理,luci使用v2ray的修改支持xray

3.你看到的不正常的现象是什么?(请描述具体现象,比如访问超时,TLS 证书错误等)
米家APP内设备离线,目前就一台小米加湿器与一个wifi智能插座蓝牙网关版离线,日志如下
2021/02/22 10:04:57 [Info] [1073340634] app/dispatcher: sniffed domain: mijia cloud
2021/02/22 10:04:57 [Debug] app/dns: domain mijia cloud matches following rules: [regexp:^[^.]+$(DNS idx:2)]
2021/02/22 10:04:57 [Debug] app/dns: domain mijia cloud uses following DNS first: [localhost]
2021/02/22 10:04:57 [Info] app/dns: failed to lookup ip for domain mijia cloud at server localhost > lookup mijia cloud: no such host
2021/02/22 10:04:57 [Debug] app/dns: UDP:1.1.1.1:53 querying DNS for: mijia cloud.
2021/02/22 10:04:57 [Debug] transport/internet/udp: dispatch request to: udp:1.1.1.1:53
2021/02/22 10:04:57 [Debug] transport/internet/udp: dispatch request to: udp:1.1.1.1:53

另外一些v2ray的历史问题,比如ios推送域名解析不准备,开启透明代理后无法收到推送消息等情况,暂时通过直连白名单解决
push.apple.com
ess.apple.com
issues

配置如下:

{
	"log": {
		"access": "/dev/null",
		"loglevel": "debug",
		"error": "/var/log/v2ray-error.log"
	},
	"dns": {
		"servers": [
			"1.1.1.1",
			"8.8.8.8",
			"localhost",
			{
				"address": "https+local://223.5.5.5/dns-query",
				"port": 53,
				"domains": [
					"geosite:cn",
				]
			}
		]
	},
	"routing": {
		"domainStrategy": "IPOnDemand",
		"rules": [
			{
				"type": "field",
				"port": "53",
				"network": "udp",
				"inboundTag": [
					"transparent"
				],
				"outboundTag": "dns_out"
			},
			{
				"type": "field",
				"ip": [
					"114.114.114.114",
					"223.5.5.5"
				],
				"outboundTag": "direct"
			},
			{
				"type": "field",
				"ip": [
					"1.1.1.1",
					"8.8.8.8",
					"208.67.222.222"
				],
				"outboundTag": "proxy"
			},
			{
				"type": "field",
				"domain": [
					"geosite:private",
					"geosite:apple-cn",
					"geosite:google-cn",
					"geosite:tld-cn"
				],
				"outboundTag": "direct"
			},
			{
				"type": "field",
				"domain": [
					"geosite:speedtest"
				],
				"outboundTag": "direct"
			},
			{
				"type": "field",
				"protocol": [
					"bittorrent"
				],
				"outboundTag": "direct"
			},
			{
				"type": "field",
				"port": "123",
				"network": "udp",
				"outboundTag": "direct"
			},
			{
				"type": "field",
				"domain": [
					"geosite:gfw",
					"geosite:greatfire"
				],
				"outboundTag": "proxy"
			},
			{
				"type": "field",
				"ip": [
					"geoip:telegram"
				],
				"outboundTag": "proxy"
			},
			{
				"type": "field",
				"network": "tcp,udp",
				"outboundTag": "direct"
			}
		]
	},
	"inbounds": [
		{
			"listen": "0.0.0.0",
			"port": 1080,
			"protocol": "socks",
			"settings": {
				"auth": "noauth",
				"udp": true,
				"ip": "127.0.0.1"
			},
			"streamSettings": {
				"sockopt": {
					
				}
			},
			"sniffing": {
				"enabled": true,
				"destOverride": [
					"http",
					"tls"
				]
			}
		},
		{
			"port": 12345,
			"protocol": "dokodemo-door",
			"settings": {
				"followRedirect": true,
				"network": "tcp,udp"
			},
			"streamSettings": {
				"sockopt": {
					"tproxy": "tproxy"
				}
			},
			"tag": "transparent",
			"sniffing": {
				"enabled": true,
				"destOverride": [
					"http",
					"tls"
				]
			}
		}
	],
	"outbounds": [
		{
			"protocol": "freedom",
			"settings": {
				"domainStrategy": "UseIPv4"
			},
			"streamSettings": {
				"sockopt": {
					"mark": 255
				}
			},
			"tag": "direct"
		},
		{
			"protocol": "vless",
			"settings": {
				"vnext": [
					{
						"address": "",
						"port": 443,
						"users": [
							{
								"id": "",
								"flow": "xtls-rprx-splice",
								"encryption": "none"
							}
						]
					}
				]
			},
			"streamSettings": {
				"network": "tcp",
				"security": "xtls",
				"xtlsSettings": {
					"allowInsecure": false,
					"disableSystemRoot": false,
					"certificates": [
						
					]
				},
				"tcpSettings": {
					
				},
				"sockopt": {
					"mark": 255
				}
			},
			"tag": "proxy"
		},
		{
			"protocol": "dns",
			"settings": {
				
			},
			"streamSettings": {
				"sockopt": {
					"mark": 255
				}
			},
			"tag": "dns_out"
		}
	]
}
@AkinoKaede
Copy link
Contributor

AkinoKaede commented Feb 23, 2021

mijia cloud 不是一个规范的域名,可以试试在 sniffing 中配置

"domainsExcluded": [
  "mijia cloud"
]

@chazikai24
Copy link
Author

mijia cloud 不是一个规范的域名,可以试试在 sniffing 中配置

"domainsExcluded": [
  "mijia cloud"
]

无效,因为中间有空格,测试过了,没用。V2ray那边的那个修复主要是针对没有点的域名使用本地DNS查询。但是实际测试下来没用。关闭透明代理小米设备就连上了,一打开就离线

@Zzz3m
Copy link

Zzz3m commented Feb 24, 2021

打开TG时的Warning:和ipv6有关

2021/02/24 10:05:54 127.0.0.1:10558 accepted http://kfaixih/ [http -> proxy]
2021/02/24 10:05:54 127.0.0.1:10559 accepted http://ayykywp/ [http -> proxy]
2021/02/24 10:05:54 127.0.0.1:10560 accepted http://vlzfmaldaywsayh/ [http -> proxy]
2021/02/24 10:05:55 [Warning] [909152990] proxy/http: failed to read response from vlzfmaldaywsayh > io: read/write on closed pipe
2021/02/24 10:05:56 [Warning] [489887526] proxy/http: failed to read response from ayykywp > io: read/write on closed pipe
2021/02/24 10:05:56 [Warning] [3048981832] proxy/http: failed to read response from kfaixih > io: read/write on closed pipe
2021/02/24 10:07:57 [Warning] [1194764995] app/proxyman/inbound: connection ends > proxy/http: malformed proxy host: 2001:b28:f23d:f001::a:443 > address 2001:b28:f23d:f001::a:443: too many colons in address
2021/02/24 10:07:57 127.0.0.1:10974 accepted http://149.154.175.57:80/api [http -> proxy]
2021/02/24 10:07:57 127.0.0.1:10976 accepted http://[2001:b28:f23d:f001::a]:80/api [http -> proxy]
2021/02/24 10:07:57 127.0.0.1:10975 accepted http://149.154.175.54:80/api [http -> proxy]
2021/02/24 10:07:57 127.0.0.1:10972 accepted //149.154.175.54:443 [http -> proxy]
2021/02/24 10:07:57 127.0.0.1:10971 accepted //149.154.175.57:443 [http -> proxy]
2021/02/24 10:07:58 [Warning] [2677043794] proxy/http: failed to read response from [2001:b28:f23d:f001::a]:80 > io: read/write on closed pipe
2021/02/24 10:07:58 [Warning] [2677043794] app/proxyman/inbound: connection ends > proxy/http: connection ends > proxy/http: failed to write response > write tcp 127.0.0.1:10809->127.0.0.1:10976: wsasend: An established connection was aborted by the software in your host machine.

@RPRX
Copy link
Member

RPRX commented Feb 24, 2021

或许在解析前把 替换成.

@chazikai24
Copy link
Author

或许在解析前把 替换成.

v2fly/v2ray-core#89
v2ray/v2ray-core#1913
v2那边修复过无点域名的问题,交给localhost解析。小米这个问题,看别人的解释是这样的:That's because the IP address of "Mijia Cloud" is hard coded into the Yeelight lamp, it is not using the DNS server to resolve the IP address. In this case, the domain sniffed by v2ray is a dummy domain, which cannot be resolved.
看上述debug日志,匹配到了无点域名,交给了localhost解析,但是没有解析成功。

@chazikai24
Copy link
Author

chazikai24 commented Feb 25, 2021

或许在解析前把 替换成.

2021/02/22 10:04:57 [Info] app/dns: UDP:1.1.1.1:53 got answer: mijia cloud. TypeA -> [] 142.03223ms
2021/02/22 10:04:57 [Debug] app/dns: UDP:1.1.1.1:53 updating IP records for domain:mijia cloud.
2021/02/22 10:04:57 [Info] app/dns: UDP:1.1.1.1:53 got answer: mijia cloud. TypeAAAA -> [] 142.060426ms
2021/02/22 10:04:57 [Debug] app/dns: UDP:1.1.1.1:53 updating IP records for domain:mijia cloud.
2021/02/22 10:04:57 [Info] app/dns: failed to lookup ip for domain mijia cloud at server UDP:1.1.1.1:53 > rcode: 3
2021/02/22 10:04:57 [Info] features/routing/dns: resolve ip for mijia cloud > rcode: 3
2021/02/22 10:04:57 [Debug] app/dns: domain mijia cloud matches following rules: [regexp:^[^.]+$(DNS idx:2)]
2021/02/22 10:04:57 [Debug] app/dns: domain mijia cloud uses following DNS first: [localhost]
2021/02/22 10:04:57 [Info] app/dns: failed to lookup ip for domain mijia cloud at server localhost > lookup mijia cloud: no such host
2021/02/22 10:04:57 [Debug] app/dns: UDP:1.1.1.1:53 cache HIT mijia cloud -> [] > rcode: 3
2021/02/22 10:04:57 [Info] app/dns: failed to lookup ip for domain mijia cloud at server UDP:1.1.1.1:53 > rcode: 3
2021/02/22 10:04:57 [Info] features/routing/dns: resolve ip for mijia cloud > rcode: 3
2021/02/22 10:04:57 [Info] [1073340634] app/dispatcher: taking detour [direct] for [tcp:mijia cloud:443]
2021/02/22 10:04:57 [Info] [1073340634] proxy/freedom: opening connection to tcp:mijia cloud:443
2021/02/22 10:04:57 [Debug] app/dns: domain mijia cloud matches following rules: [regexp:^[^.]+$(DNS idx:2)]
2021/02/22 10:04:57 [Debug] app/dns: domain mijia cloud uses following DNS first: [localhost]
2021/02/22 10:04:57 [Info] app/dns: failed to lookup ip for domain mijia cloud at server localhost > lookup mijia cloud: no such host
2021/02/22 10:04:57 [Debug] app/dns: UDP:1.1.1.1:53 cache HIT mijia cloud -> [] > rcode: 3
2021/02/22 10:04:57 [Info] app/dns: failed to lookup ip for domain mijia cloud at server UDP:1.1.1.1:53 > rcode: 3
2021/02/22 10:04:57 [Info] [1073340634] proxy/freedom: failed to get IP address for domain mijia cloud > rcode: 3
2021/02/22 10:04:57 [Info] [1073340634] transport/internet/tcp: dialing TCP to tcp:mijia cloud:443
2021/02/22 10:04:57 [Debug] app/dns: domain mijia cloud matches following rules: [regexp:^[^.]+$(DNS idx:2)]
2021/02/22 10:04:57 [Debug] app/dns: domain mijia cloud uses following DNS first: [localhost]
2021/02/22 10:04:57 [Info] app/dns: failed to lookup ip for domain mijia cloud at server localhost > lookup mijia cloud: no such host
2021/02/22 10:04:57 [Debug] app/dns: UDP:1.1.1.1:53 cache HIT mijia cloud -> [] > rcode: 3
2021/02/22 10:04:57 [Info] app/dns: failed to lookup ip for domain mijia cloud at server UDP:1.1.1.1:53 > rcode: 3
2021/02/22 10:04:57 [Info] [1073340634] proxy/freedom: failed to get IP address for domain mijia cloud > rcode: 3
2021/02/22 10:04:57 [Info] [1073340634] transport/internet/tcp: dialing TCP to tcp:mijia cloud:443

目前使用下来,还是有问题,日志里全是无法解析mijia cloud的信息,有两个设备打开xray透明代理就离线

@AkinoKaede
Copy link
Contributor

@chazikai24
Copy link
Author

Try to use #426, https://github.com/XTLS/Xray-core/actions/runs/676449857

经过测试,米家设备已经工作正常。
2021/03/23 21:25:13 [Info] [2870031783] app/dispatcher: destination override ignores invalid domain [mijia cloud]

@AkinoKaede
Copy link
Contributor

Try to use #426, https://github.com/XTLS/Xray-core/actions/runs/676449857

经过测试,米家设备已经工作正常。
2021/03/23 21:25:13 [Info] [2870031783] app/dispatcher: destination override ignores invalid domain [mijia cloud]

感谢测试,有兴趣的话可以再试试 https://github.com/XTLS/Xray-core/actions/runs/680010260

@chazikai24
Copy link
Author

Try to use #426, https://github.com/XTLS/Xray-core/actions/runs/676449857

经过测试,米家设备已经工作正常。
2021/03/23 21:25:13 [Info] [2870031783] app/dispatcher: destination override ignores invalid domain [mijia cloud]

感谢测试,有兴趣的话可以再试试 https://github.com/XTLS/Xray-core/actions/runs/680010260

测试正常
2021/03/24 20:16:18 [Info] [909152927] app/dispatcher: destination override ignores invalid domain [mijia cloud]

@chazikai24
Copy link
Author

继续魔改luci xray插件,修改配置domainsExcluded排除mijia cloud,之后正常了。这个问题luci插件那边估计因为luci交互问题不太好解决。mijia cloud被识别为两个域名,一个mijia一个cloud。总之这个锅不是xray的。问题关闭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants