parent
2511b9c6f0
commit
aa7ee434b3
@ -2,6 +2,12 @@ log:
|
|||||||
level: info
|
level: info
|
||||||
file: "/tmp/mosdns.log"
|
file: "/tmp/mosdns.log"
|
||||||
|
|
||||||
|
# API 入口设置
|
||||||
|
api:
|
||||||
|
http: "0.0.0.0:9091"
|
||||||
|
|
||||||
|
include: []
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
# 国内域名
|
# 国内域名
|
||||||
- tag: geosite_cn
|
- tag: geosite_cn
|
||||||
@ -45,6 +51,13 @@ plugins:
|
|||||||
files:
|
files:
|
||||||
- "/etc/mosdns/rule/greylist.txt"
|
- "/etc/mosdns/rule/greylist.txt"
|
||||||
|
|
||||||
|
# DDNS域名 加入的域名始终使用 “本地 DNS” 进行解析,并且修改 TTL 为 5 秒,解析结果不进行缓存
|
||||||
|
- tag: ddnslist
|
||||||
|
type: domain_set
|
||||||
|
args:
|
||||||
|
files:
|
||||||
|
- "/etc/mosdns/rule/ddnslist.txt"
|
||||||
|
|
||||||
# 自定义 Hosts 重写
|
# 自定义 Hosts 重写
|
||||||
- tag: hosts
|
- tag: hosts
|
||||||
type: hosts
|
type: hosts
|
||||||
@ -74,7 +87,7 @@ plugins:
|
|||||||
- "/usr/share/mosdns/sp_low.tdata"
|
- "/usr/share/mosdns/sp_low.tdata"
|
||||||
|
|
||||||
# 缓存
|
# 缓存
|
||||||
- tag: cache
|
- tag: lazy_cache
|
||||||
type: cache
|
type: cache
|
||||||
args:
|
args:
|
||||||
size: 20000
|
size: 20000
|
||||||
@ -105,6 +118,12 @@ plugins:
|
|||||||
args:
|
args:
|
||||||
- exec: ttl 0-0
|
- exec: ttl 0-0
|
||||||
|
|
||||||
|
# 修改 ddns 域名 ttl(默认 5秒)
|
||||||
|
- tag: modify_ddns_ttl
|
||||||
|
type: sequence
|
||||||
|
args:
|
||||||
|
- exec: ttl 5-5
|
||||||
|
|
||||||
# 国内解析
|
# 国内解析
|
||||||
- tag: local_sequence
|
- tag: local_sequence
|
||||||
type: sequence
|
type: sequence
|
||||||
@ -118,11 +137,14 @@ plugins:
|
|||||||
- exec: prefer_ipv4
|
- exec: prefer_ipv4
|
||||||
- exec: $forward_remote
|
- exec: $forward_remote
|
||||||
|
|
||||||
# 有响应终止返回
|
# 有响应则修改 TTL 并终止返回
|
||||||
- tag: has_resp_sequence
|
- tag: has_resp_sequence
|
||||||
type: sequence
|
type: sequence
|
||||||
args:
|
args:
|
||||||
- exec: $modify_ttl
|
- matches: qname $ddnslist
|
||||||
|
exec: $modify_ddns_ttl
|
||||||
|
- matches: "!qname $ddnslist"
|
||||||
|
exec: $modify_ttl
|
||||||
- matches: has_resp
|
- matches: has_resp
|
||||||
exec: accept
|
exec: accept
|
||||||
|
|
||||||
@ -150,6 +172,13 @@ plugins:
|
|||||||
threshold: 500
|
threshold: 500
|
||||||
always_standby: true
|
always_standby: true
|
||||||
|
|
||||||
|
# 查询 DDNS 域名
|
||||||
|
- tag: query_is_ddns_domain
|
||||||
|
type: sequence
|
||||||
|
args:
|
||||||
|
- matches: qname $ddnslist
|
||||||
|
exec: $local_sequence
|
||||||
|
|
||||||
# 查询国内域名
|
# 查询国内域名
|
||||||
- tag: query_is_local_domain
|
- tag: query_is_local_domain
|
||||||
type: sequence
|
type: sequence
|
||||||
@ -169,9 +198,7 @@ plugins:
|
|||||||
type: sequence
|
type: sequence
|
||||||
args:
|
args:
|
||||||
- matches: qname $whitelist
|
- matches: qname $whitelist
|
||||||
exec: $cache
|
exec: $local_sequence
|
||||||
- exec: $local_sequence
|
|
||||||
- exec: jump has_resp_sequence
|
|
||||||
|
|
||||||
# 查询灰名单
|
# 查询灰名单
|
||||||
- tag: query_is_greylist_domain
|
- tag: query_is_greylist_domain
|
||||||
@ -195,6 +222,17 @@ plugins:
|
|||||||
- matches: qtype 65
|
- matches: qtype 65
|
||||||
exec: reject 3
|
exec: reject 3
|
||||||
|
|
||||||
|
# 非 拒绝名单 或 DDNS域名 则启用缓存
|
||||||
|
- tag: cache
|
||||||
|
type: sequence
|
||||||
|
args:
|
||||||
|
- matches:
|
||||||
|
- "!qname $ddnslist"
|
||||||
|
- "!qname $blocklist"
|
||||||
|
- "!qname $sp_low"
|
||||||
|
- "!qname $local_ptr"
|
||||||
|
exec: $lazy_cache
|
||||||
|
|
||||||
# 主要的运行逻辑插件
|
# 主要的运行逻辑插件
|
||||||
# sequence 插件中调用的插件 tag 必须在 sequence 前定义,
|
# sequence 插件中调用的插件 tag 必须在 sequence 前定义,
|
||||||
# 否则 sequence 找不到对应插件。
|
# 否则 sequence 找不到对应插件。
|
||||||
@ -203,11 +241,14 @@ plugins:
|
|||||||
args:
|
args:
|
||||||
- exec: $hosts
|
- exec: $hosts
|
||||||
- exec: jump has_resp_sequence
|
- exec: jump has_resp_sequence
|
||||||
|
- exec: $cache
|
||||||
- exec: $redirect
|
- exec: $redirect
|
||||||
- exec: jump has_resp_sequence
|
- exec: jump has_resp_sequence
|
||||||
|
- exec: $query_is_ddns_domain
|
||||||
|
- exec: jump has_resp_sequence
|
||||||
- exec: $query_is_whitelist_domain
|
- exec: $query_is_whitelist_domain
|
||||||
|
- exec: jump has_resp_sequence
|
||||||
- exec: $query_is_reject_domain
|
- exec: $query_is_reject_domain
|
||||||
- exec: $cache
|
|
||||||
- exec: jump has_resp_sequence
|
- exec: jump has_resp_sequence
|
||||||
- exec: $query_is_greylist_domain
|
- exec: $query_is_greylist_domain
|
||||||
- exec: jump has_resp_sequence
|
- exec: jump has_resp_sequence
|
||||||
|
@ -80,7 +80,7 @@ plugins:
|
|||||||
files:
|
files:
|
||||||
- "/usr/share/mosdns/sp_low.tdata"
|
- "/usr/share/mosdns/sp_low.tdata"
|
||||||
|
|
||||||
- tag: cache
|
- tag: lazy_cache
|
||||||
type: cache
|
type: cache
|
||||||
args:
|
args:
|
||||||
size: cache_size
|
size: cache_size
|
||||||
@ -105,6 +105,11 @@ plugins:
|
|||||||
args:
|
args:
|
||||||
- exec: ttl minimal_ttl_custom-maximum_ttl_custom
|
- exec: ttl minimal_ttl_custom-maximum_ttl_custom
|
||||||
|
|
||||||
|
- tag: modify_ddns_ttl
|
||||||
|
type: sequence
|
||||||
|
args:
|
||||||
|
- exec: ttl 5-5
|
||||||
|
|
||||||
- tag: local_sequence
|
- tag: local_sequence
|
||||||
type: sequence
|
type: sequence
|
||||||
args:
|
args:
|
||||||
@ -120,7 +125,10 @@ plugins:
|
|||||||
- tag: has_resp_sequence
|
- tag: has_resp_sequence
|
||||||
type: sequence
|
type: sequence
|
||||||
args:
|
args:
|
||||||
- exec: $modify_ttl
|
- matches: qname $ddnslist
|
||||||
|
exec: $modify_ddns_ttl
|
||||||
|
- matches: "!qname $ddnslist"
|
||||||
|
exec: $modify_ttl
|
||||||
- matches: has_resp
|
- matches: has_resp
|
||||||
exec: accept
|
exec: accept
|
||||||
|
|
||||||
@ -148,10 +156,7 @@ plugins:
|
|||||||
type: sequence
|
type: sequence
|
||||||
args:
|
args:
|
||||||
- matches: qname $ddnslist
|
- matches: qname $ddnslist
|
||||||
exec: ttl 5
|
exec: $local_sequence
|
||||||
- exec: $forward_local
|
|
||||||
- matches: has_resp
|
|
||||||
exec: accept
|
|
||||||
|
|
||||||
- tag: query_is_local_domain
|
- tag: query_is_local_domain
|
||||||
type: sequence
|
type: sequence
|
||||||
@ -169,9 +174,7 @@ plugins:
|
|||||||
type: sequence
|
type: sequence
|
||||||
args:
|
args:
|
||||||
- matches: qname $whitelist
|
- matches: qname $whitelist
|
||||||
exec: $cache
|
exec: $local_sequence
|
||||||
- exec: $local_sequence
|
|
||||||
- exec: jump has_resp_sequence
|
|
||||||
|
|
||||||
- tag: query_is_greylist_domain
|
- tag: query_is_greylist_domain
|
||||||
type: sequence
|
type: sequence
|
||||||
@ -195,17 +198,30 @@ plugins:
|
|||||||
- matches: qtype 65
|
- matches: qtype 65
|
||||||
exec: reject 3
|
exec: reject 3
|
||||||
|
|
||||||
|
- tag: cache
|
||||||
|
type: sequence
|
||||||
|
args:
|
||||||
|
- matches:
|
||||||
|
- "!qname $ddnslist"
|
||||||
|
- "!qname $blocklist"
|
||||||
|
- "!qname $adlist"
|
||||||
|
- "!qname $sp_low"
|
||||||
|
- "!qname $local_ptr"
|
||||||
|
exec: $lazy_cache
|
||||||
|
|
||||||
- tag: main_sequence
|
- tag: main_sequence
|
||||||
type: sequence
|
type: sequence
|
||||||
args:
|
args:
|
||||||
- exec: $hosts
|
- exec: $hosts
|
||||||
- exec: jump has_resp_sequence
|
- exec: jump has_resp_sequence
|
||||||
|
- exec: $cache
|
||||||
- exec: $redirect
|
- exec: $redirect
|
||||||
- exec: jump has_resp_sequence
|
- exec: jump has_resp_sequence
|
||||||
- exec: $query_is_ddns_domain
|
- exec: $query_is_ddns_domain
|
||||||
|
- exec: jump has_resp_sequence
|
||||||
- exec: $query_is_whitelist_domain
|
- exec: $query_is_whitelist_domain
|
||||||
|
- exec: jump has_resp_sequence
|
||||||
- exec: $query_is_reject_domain
|
- exec: $query_is_reject_domain
|
||||||
- exec: $cache
|
|
||||||
- exec: jump has_resp_sequence
|
- exec: jump has_resp_sequence
|
||||||
- exec: $query_is_greylist_domain
|
- exec: $query_is_greylist_domain
|
||||||
- exec: jump has_resp_sequence
|
- exec: jump has_resp_sequence
|
||||||
|
Loading…
Reference in New Issue
Block a user