|
log: |
|
level: info |
|
file: "/var/log/mosdns.log" |
|
|
|
api: |
|
http: "0.0.0.0:8338" |
|
|
|
include: [] |
|
|
|
plugins: |
|
- tag: geosite_cn |
|
type: domain_set |
|
args: |
|
files: |
|
- "/var/mosdns/geosite_cn.txt" |
|
|
|
- tag: geoip_cn |
|
type: ip_set |
|
args: |
|
files: |
|
- "/var/mosdns/geoip_cn.txt" |
|
|
|
- tag: geosite_no_cn |
|
type: domain_set |
|
args: |
|
files: |
|
- "/var/mosdns/geosite_geolocation-!cn.txt" |
|
|
|
- tag: whitelist |
|
type: domain_set |
|
args: |
|
files: |
|
- "/etc/mosdns/rule/whitelist.txt" |
|
|
|
- tag: blocklist |
|
type: domain_set |
|
args: |
|
files: |
|
- "/etc/mosdns/rule/blocklist.txt" |
|
|
|
- tag: greylist |
|
type: domain_set |
|
args: |
|
files: |
|
- "/etc/mosdns/rule/greylist.txt" |
|
|
|
- tag: ddnslist |
|
type: domain_set |
|
args: |
|
files: |
|
- "/etc/mosdns/rule/ddnslist.txt" |
|
|
|
- tag: hosts |
|
type: hosts |
|
args: |
|
files: |
|
- "/etc/mosdns/rule/hosts.txt" |
|
|
|
- tag: redirect |
|
type: redirect |
|
args: |
|
files: |
|
- "/etc/mosdns/rule/redirect.txt" |
|
|
|
- tag: adlist |
|
type: domain_set |
|
args: |
|
files: |
|
- "/etc/mosdns/rule/adlist.txt" |
|
|
|
- tag: local_ptr |
|
type: domain_set |
|
args: |
|
files: |
|
- "/etc/mosdns/rule/local-ptr.txt" |
|
|
|
- tag: lazy_cache |
|
type: cache |
|
args: |
|
size: 20000 |
|
lazy_cache_ttl: 86400 |
|
|
|
- tag: reject_3 |
|
type: sequence |
|
args: |
|
- exec: reject 3 |
|
|
|
- tag: reject_blocklist |
|
type: sequence |
|
args: |
|
- exec: query_summary reject_blocklist |
|
- exec: $reject_3 |
|
|
|
- tag: reject_adlist |
|
type: sequence |
|
args: |
|
- exec: query_summary reject_adlist |
|
- exec: $reject_3 |
|
|
|
- tag: reject_ptrlist |
|
type: sequence |
|
args: |
|
- exec: query_summary reject_ptrlist |
|
- exec: $reject_3 |
|
|
|
- tag: reject_qtype65 |
|
type: sequence |
|
args: |
|
- exec: query_summary reject_qtype65 |
|
- exec: $reject_3 |
|
|
|
- tag: forward_local |
|
type: forward |
|
args: |
|
concurrent: 1 |
|
upstreams: |
|
- addr: 119.29.29.29 |
|
bootstrap: 119.29.29.29 |
|
enable_pipeline: false |
|
max_conns: 2 |
|
insecure_skip_verify: false |
|
idle_timeout: 30 |
|
- addr: 223.5.5.5 |
|
bootstrap: 119.29.29.29 |
|
enable_pipeline: false |
|
max_conns: 2 |
|
insecure_skip_verify: false |
|
idle_timeout: 30 |
|
|
|
- tag: forward_remote |
|
type: forward |
|
args: |
|
concurrent: 1 |
|
upstreams: |
|
- addr: tls://8.8.8.8 |
|
bootstrap: 119.29.29.29 |
|
enable_pipeline: false |
|
max_conns: 2 |
|
insecure_skip_verify: false |
|
idle_timeout: 30 |
|
enable_http3: false |
|
- addr: tls://8.8.4.4 |
|
bootstrap: 119.29.29.29 |
|
enable_pipeline: false |
|
max_conns: 2 |
|
insecure_skip_verify: false |
|
idle_timeout: 30 |
|
enable_http3: false |
|
- addr: tls://1.1.1.1 |
|
bootstrap: 119.29.29.29 |
|
enable_pipeline: false |
|
max_conns: 2 |
|
insecure_skip_verify: false |
|
idle_timeout: 30 |
|
enable_http3: false |
|
- addr: tls://208.67.222.222 |
|
bootstrap: 119.29.29.29 |
|
enable_pipeline: false |
|
max_conns: 2 |
|
insecure_skip_verify: false |
|
idle_timeout: 30 |
|
enable_http3: false |
|
|
|
- tag: modify_ttl |
|
type: sequence |
|
args: |
|
- exec: ttl 0-0 |
|
|
|
- tag: modify_ddns_ttl |
|
type: sequence |
|
args: |
|
- exec: ttl 5-5 |
|
|
|
- tag: local_sequence |
|
type: sequence |
|
args: |
|
- exec: query_summary forward_local |
|
- exec: $forward_local |
|
|
|
- tag: remote_sequence |
|
type: sequence |
|
args: |
|
- exec: query_summary forward_remote |
|
- exec: prefer_ipv4 |
|
- exec: $forward_remote |
|
|
|
- tag: has_resp_sequence |
|
type: sequence |
|
args: |
|
- matches: qname $ddnslist |
|
exec: $modify_ddns_ttl |
|
- matches: "!qname $ddnslist" |
|
exec: $modify_ttl |
|
- matches: has_resp |
|
exec: accept |
|
|
|
- tag: query_is_local_ip |
|
type: sequence |
|
args: |
|
- exec: $local_sequence |
|
- matches: "!resp_ip $geoip_cn" |
|
exec: drop_resp |
|
|
|
- tag: query_is_remote |
|
type: sequence |
|
args: |
|
- exec: $remote_sequence |
|
|
|
- tag: fallback |
|
type: fallback |
|
args: |
|
primary: query_is_local_ip |
|
secondary: query_is_remote |
|
threshold: 500 |
|
always_standby: true |
|
|
|
- tag: query_is_ddns_domain |
|
type: sequence |
|
args: |
|
- matches: qname $ddnslist |
|
exec: $local_sequence |
|
|
|
- tag: query_is_local_domain |
|
type: sequence |
|
args: |
|
- matches: qname $geosite_cn |
|
exec: $local_sequence |
|
|
|
- tag: query_is_no_local_domain |
|
type: sequence |
|
args: |
|
- matches: qname $geosite_no_cn |
|
exec: $remote_sequence |
|
|
|
- tag: query_is_whitelist_domain |
|
type: sequence |
|
args: |
|
- matches: qname $whitelist |
|
exec: $local_sequence |
|
|
|
- tag: query_is_greylist_domain |
|
type: sequence |
|
args: |
|
- matches: qname $greylist |
|
exec: $remote_sequence |
|
|
|
- tag: query_is_reject_domain |
|
type: sequence |
|
args: |
|
- matches: qname $blocklist |
|
exec: $reject_blocklist |
|
- matches: qname $adlist |
|
exec: $reject_adlist |
|
- matches: |
|
- qtype 12 |
|
- qname $local_ptr |
|
exec: $reject_ptrlist |
|
- matches: qtype 65 |
|
exec: $reject_qtype65 |
|
|
|
- tag: fallback_sequence |
|
type: sequence |
|
args: |
|
- exec: query_summary fallback |
|
- exec: $fallback |
|
|
|
- tag: main_sequence |
|
type: sequence |
|
args: |
|
- exec: metrics_collector metrics |
|
- exec: $hosts |
|
- exec: jump has_resp_sequence |
|
- matches: |
|
- "!qname $ddnslist" |
|
- "!qname $blocklist" |
|
- "!qname $adlist" |
|
- "!qname $local_ptr" |
|
exec: $lazy_cache |
|
- exec: $redirect |
|
- exec: jump has_resp_sequence |
|
- exec: $query_is_ddns_domain |
|
- exec: jump has_resp_sequence |
|
- exec: $query_is_whitelist_domain |
|
- exec: jump has_resp_sequence |
|
- exec: $query_is_reject_domain |
|
- exec: jump has_resp_sequence |
|
- exec: $query_is_greylist_domain |
|
- exec: jump has_resp_sequence |
|
- exec: $query_is_local_domain |
|
- exec: jump has_resp_sequence |
|
- exec: $query_is_no_local_domain |
|
- exec: jump has_resp_sequence |
|
- exec: $fallback_sequence |
|
|
|
- tag: udp_server |
|
type: udp_server |
|
args: |
|
entry: main_sequence |
|
listen: ":5335" |
|
|
|
- tag: tcp_server |
|
type: tcp_server |
|
args: |
|
entry: main_sequence |
|
listen: ":5335" |
@fonlan 目前只有 river_leaves 的版本,我自己的因为数据源混了 loki 这个方案还没彻底一体化解决暂时无法公开