Comments (14)
为何第二个forward_local不是放在exec里,而是在外面?
在exec里啊。这是个嵌套。外层是exec(往上看几行)。
wiki里有
args:
exec: # 执行序列,由多个命令构成。执行顺序为从上到下。
- do_something # 命令可以直接是要执行的功能性插件。
- do_something
# 也可以是 if 条件命令块。
- if: # 运行命令块的条件,必须是匹配器插件。可配置多个匹配器,关系为或运算。任意匹配器为真命令块就会被执行。
- match_something
- '!match_something' # `!` 前缀可实现取反。
exec: [] # 嵌套的执行序列,可以为空。
goto: other_sequence # 如果非空,重定向到此路由插件。如果为空,则不重定向(继续执行后面的序列)。
为何过滤本地结果没有exec,且没有forward_local?
上一步的forward_local请求完上游会产生一个应答,这个应答可以直接返回。不需要再请求一次。直接 end 就好了。
后面的forward_remote会对复写之前的应答。
from mosdns.
那我去掉外面那个forward_local,直接写在match_chn_domain里的exec是不是也是等效的?
from mosdns.
不行。你要先请求上游,拿到应答后,match_local_ip 才生效。
from mosdns.
啊?那你帮我看下我现在这样配置有何问题?但是我现在这样配,貌似也能正常使用啊。
args:
exec:
# 非 A AAAA 的请求另行处理
- if:
- "!match_qtype_A_AAAA"
exec:
- forward_chn
- add_ipset_chn
goto: end
- if:
- match_nf_domain
exec:
- forward_nf
- add_ipset_nf
goto: end
- if:
- match_jp_domain
exec:
- forward_jp
- add_ipset_jp
goto: end
- if:
- match_us_domain
exec:
- forward_us
- add_ipset_us
goto: end
- if:
- match_chn_domain
- match_chn_ip
exec:
- forward_chn
- add_ipset_chn
goto: end
# 剩余请求(既不是已知的本地域名,也没有返回本地 IP)
- forward_us # 转发至远程服务器
- add_ipset_us
next: end # 结束
from mosdns.
能用是能用,但只有域名分流。
match_local_ip 没起作用,因为没有应答给它匹配,所以永远返回 false。
from mosdns.
那要怎么改合适?就是把外面那个forward加上即可?
from mosdns.
forward_chn 移上去
from mosdns.
借楼请教下配置问题,我目前使用的配置文件如下:
exec:
- if:
- "!match_qtype_A_AAAA"
exec:
- forward_local_dnsserver
goto: end
- if:
- "match_chn_domain"
- "match_chn_ip"
exec:
- add_local_ecs
- forward_local_dnsserver
goto: end
- if:
- "match_non_chn_domain"
exec:
- forward_remote_dnsserver
goto: end
- forward_remote_dnsserver
next: end
根据该issue,要使 match_chn_ip 起作用,需要把 add_local_ecs 和 forward_local_dnsserver 提到上面去,但这样会使转发到 forward_remote_dnsserver 的请求也带上 ECS,我现在想实现仅转发到 forward_local_dnsserver 的请求带上 ECS,这个配置文件应该怎么修改下?
from mosdns.
@Hades-001 这问题好像真的无解。
目前没有去掉ECS的方法。可能只能再加个 add_remote_ecs 把之前的ECS覆盖掉。
以后可能有.(几小时以后?)
from mosdns.
@IrineSistiana 能不能把 ECS 功能部分加到 forward 插件上,这样好设置也更直观一点。
from mosdns.
@Hades-001 不行。
from mosdns.
- forward_local_dnsserver
- if:
- "match_chn_domain"
- "match_chn_ip"
exec:
- add_local_ecs
- forward_local_dnsserver
goto: end
这种写法会用第二次forward_local_dnsserver的结果覆盖第一次的结果吗?
from mosdns.
@terrytw 会。
友情提醒,刚更新的版本 end
变 _end
了。
from mosdns.
@IrineSistiana 谢谢提醒!
@Hades-001 那你的问题就可以用我上面提到的写法解决了?
第一次请求本地dns服务器,如果命中IP列表,就加上ECS再次请求本地dns服务器,获取(可能)更新过的结果
EDIT: 当我没说,作者加了删除ECS的功能
from mosdns.
Related Issues (20)
- [Bug] 群晖DSM 7.2 ( Linux 3.10)上运行报错ERROR udp get dst address from oob HOT 1
- [Bug] mosdns linux mipsle softfloat 无法监听UDP端口 HOT 1
- [Bug] Linux kernel 3.4 无法监听UDP端口 HOT 7
- [Bug] V5.3.1 数据库更新失败,提示“请检查网络状态”
- [Bug] HOT 1
- [Bug] 在经过 resp_ip 判断后 black_hole 无法替换 IPv4 或 IPv6 地址 HOT 11
- [Bug] 日志有错误信息提示无法写入缓存?
- 配置文件中的“中文域名”不识别 HOT 1
- [Bug] AAAA QTYPE 大量出现 context deadline exceeded HOT 2
- [Bug] 当其他DNS服务器的解析请求转发到mosdns上之后,无法得到解析回复 HOT 1
- DNS解锁失效
- [Feature request] 希望增加 ipset 删除功能 HOT 1
- [Bug] IPv6 DNS Server [2620:fe::fe] 识别问题 HOT 2
- [Feature request] 希望fallback插件内標記的mark可以帶回上級sequence
- [Bug] 配置文件为 wiki 中的简单转发器配置文件,mosdns 无法正常工作 HOT 2
- [Feature request] 提供将lazy_cache写入内存的选项 HOT 4
- [Feature request] prefer plugin support for HTTPS record HOT 1
- [Bug] client_ip匹配ipv6 cidr未按预期工作 HOT 2
- [Feature request] 丢弃resp_ip中指定的IP
- [Feature request] 并行请求时直接返回最快返回的应答 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mosdns.