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

feat: 支持导入系统hosts追加至dns设置 #4464

Merged
merged 1 commit into from
Dec 1, 2023
Merged

feat: 支持导入系统hosts追加至dns设置 #4464

merged 1 commit into from
Dec 1, 2023

Conversation

ShiinaRinne
Copy link
Contributor

为了解决
#4458 (comment)
#4452
#3922

添加 使用系统hosts 选项,在生成配置文件时从系统hosts读取规则追加到dns设置
image

  • 默认情况
    200df38c3fb2a30e75014ffc96d535f1

  • 使用系统hosts
    bbd728b79ea83e81a11ce4b3006fd8b5

  • 使用系统hosts+导入默认设置
    583efe3589bc01734d0d7b76b2ed83a7

@ShiinaRinne
Copy link
Contributor Author

https://xtls.github.io/Xray-docs-next/config/dns.html#dns-%E6%9C%8D%E5%8A%A1%E5%99%A8
受Core限制,需要将路由规则的域名匹配策略设置为 IpIfNotMatchIpOnDemand,使用内置服务器进行DNS查询才可生效,不确定这个功能是否有必要

@2dust 2dust marked this pull request as ready for review December 1, 2023 08:21
@2dust 2dust merged commit 843b881 into 2dust:master Dec 1, 2023
1 check passed
@SN-9527
Copy link

SN-9527 commented Dec 6, 2023

请问一下 , 我自己建了一个DNS服务器 (确定可用),将其填入DNS配置后,我的服务器没有收到任何来自v2的请求,看起来DNS配置并没有生效,这是正常的吗?

@ShiinaRinne
Copy link
Contributor Author

在路由阶段, 解析域名为 IP, 并且根据域名解析得到的 IP 进行规则匹配以分流. 是否解析域名及分流和路由配置模块中 domainStrategy 的值有关, 只有在设置以下两种值时,才会使用内置 DNS 服务器进行 DNS 查询:

  • "IPIfNonMatch", 请求一个域名时,进行路由里面的 domain 进行匹配,若无法匹配到结果,则对这个域名使用内置 DNS 服务器进行 DNS 查询,并且使用查询返回的 IP 地址再重新进行 IP 路由匹配。
  • "IPOnDemand", 当匹配时碰到任何基于 IP 的规则,将域名立即解析为 IP 进行匹配。

先确认域名匹配策略是否设置为 IpIfNotMatchIpOnDemand

也可以参考一下xray文档里dns的配置规范
https://xtls.github.io/Xray-docs-next/config/dns.html#dnsobject

如果仍然无法解决,可以发到xray那边问问,我没有研究过xray具体是怎样来使用这些规则的

@aaffjj
Copy link

aaffjj commented Dec 30, 2023

这个添加dns的功能是新版本的功能吧,
5.3.9的没这个功能

@2dust
Copy link
Owner

2dust commented Dec 30, 2023

这个添加dns的功能是新版本的功能吧, 5.3.9的没这个功能

当然只会维护最新版

@aaffjj
Copy link

aaffjj commented Dec 30, 2023

这个添加dns的功能是新版本的功能吧, 5.3.9的没这个功能

当然只会维护最新版
嗯,我说刚才找了一下,老版本没这个功能,

@ShiinaRinne ShiinaRinne deleted the host branch January 2, 2024 07:00
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 this pull request may close these issues.

4 participants