neoFelhz / neohosts

自由·负责·克制 去广告 Hosts 项目
https://hosts.nfz.moe
Other
1.78k stars 136 forks source link

[功能请求]增加AdGuardHome/Pi-Hole等专用DNS Server支持 #82

Closed Mosney closed 4 years ago

Mosney commented 4 years ago

neoFelhz commented 4 years ago

AdGuardHome 要求 Hosts 文件必须要有 MIME-Typetext/plain 的 Hosts 源。而目前 neoHosts 的 MIME-Type 是 oceat-stream 所以不兼容。

现在 neoHosts 已经构建了 AdGuardHome 可以直接使用的 Hosts 源,请在 README 中查看。

Mosney commented 4 years ago

可能是我没有表达清楚,我所提到的不完全兼容是指具体的配置文件内容,AGH支持使用多种屏蔽策略以实现更多功能(例如1.2.)。
如下图所示,上面是AGH默认策略组的拦截效果,下面是neoHosts的拦截效果,而目前的neoHosts的配置文件是直接指定0.0.0.0作为返回的查询结果,会使AGH这一特性丧失。

image

AGH过滤器规则范例:

||example.org^ – 拦截 example.org 域名及其所有子域名
@@||example.org^ – 放行 example.org 及其所有子域名
127.0.0.1 example.org – AdGuard Home 现在将会把 example.org(但不包括它的子域名)解析到 127.0.0.1。
! 这是一行注释 – 只是一条注释
# 这也是一行注释 – 只是一条注释
/REGEX/ – 阻止访问与example_regex_meaning匹配的域
Mosney commented 4 years ago

另外这种格式 127.0.0.1 example.org 的规则只能过滤单个域名,||example.org^则可以包含所有子域,可以有效压缩规则数量和潜在的未添加的子域。

Mosney commented 4 years ago

或者我去AGH那边提个功能请求让他们做适配吧