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 - _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 exec: - forward_local - _return - if: - query_is_ad_domain exec: - _block_with_nxdomain - _return - mem_cache - if: - query_is_local_domain - "!_query_is_common" exec: - forward_local - _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 - modify_ttl - tag: mem_cache type: cache args: size: ${{ uci -q get mosdns.mosdns.cache_size }} - tag: modify_ttl type: ttl args: minimal_ttl: ${{ uci -q get mosdns.mosdns.minimal_ttl }} maximum_ttl: ${{ uci -q get mosdns.mosdns.maximum_ttl }} - 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: 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 }}