luci-app-mosdns/root/etc/mosdns/def_config.yaml
2022-04-08 20:40:30 +08:00

102 lines
2.2 KiB
YAML

log:
level: ${{ uci -q get mosdns.mosdns.loglv }}
file: ${{ uci -q get mosdns.mosdns.logfile }}
plugin:
- tag: main_server
type: server
args:
entry:
- _no_ecs
- lazy_cache
- _prefer_ipv4
- _single_flight
- main_sequence
server:
- protocol: udp
addr: ":5335"
- protocol: tcp
addr: ":5335"
- tag: main_sequence
type: sequence
args:
exec:
- if:
- query_is_whitelist_domain
- query_is_local_domain
- "!_query_is_common"
exec:
- forward_local
- _return
- if:
- query_is_ad_domain
exec:
- _block_with_nxdomain
- _return
- if:
- query_is_non_local_domain
exec:
- forward_remote
- _return
- primary:
- forward_local
- if:
- "!response_has_local_ip"
exec:
- _drop_response
secondary:
- forward_remote
fast_fallback: 150
always_standby: true
- tag: forward_local
type: fast_forward
args:
upstream:
- addr: ${{ ./dns.sh 0 }}
- addr: ${{ ./dns.sh 1 }}
- tag: query_is_whitelist_domain
type: query_matcher
args:
domain:
- "ext:./whitelist.txt"
- tag: forward_remote
type: fast_forward
args:
upstream:
- addr: ${{ uci -q get mosdns.mosdns.dns_forward }}
- tag: lazy_cache
type: cache
args:
size: 512000
lazy_cache_ttl: 259200
- tag: query_is_local_domain
type: query_matcher
args:
domain:
- "ext:/usr/share/v2ray/geosite.dat:cn"
- "ext:/usr/share/v2ray/geosite.dat:apple-cn"
- tag: query_is_non_local_domain
type: query_matcher
args:
domain:
- "ext:/usr/share/v2ray/geosite.dat:geolocation-!cn"
- tag: response_has_local_ip
type: response_matcher
args:
ip:
- "ext:/usr/share/v2ray/geoip.dat:cn"
- tag: query_is_ad_domain
type: query_matcher
args:
domain:
- ${{ ./ad_domain.sh }}