# ======================================== # MosDNS 配置文件 - 智能防污染版本 # 包含: Web UI + 热加载 + 智能防污染 # ======================================== # 日志配置 log: level: info file: "" # API 管理接口配置 api: http: "0.0.0.0:8080" # Web 管理界面配置 web: http: "0.0.0.0:5555" # 插件配置(严格按依赖顺序排列) plugins: # ======================================== # 1. 数据源插件(最基础,无依赖) # ======================================== - tag: geoip_cn type: ip_set args: files: - "./data/chn_ip.txt" - tag: geosite_cn type: domain_set args: files: - "./data/geosite_china-list.txt" # ======================================== # 2. DNS 上游服务器(无依赖) # ======================================== - tag: forward_local type: forward args: concurrent: 2 upstreams: - addr: "223.5.5.5" - addr: "119.29.29.29" - tag: forward_remote type: forward args: concurrent: 2 upstreams: - addr: "https://1.1.1.1/dns-query" enable_http3: false - addr: "https://8.8.8.8/dns-query" enable_http3: false # ======================================== # 3. 智能防污染插件(依赖上游服务器) # ======================================== - tag: smart_fallback_handler type: smart_fallback args: primary: forward_local secondary: forward_remote china_ip: - "./data/chn_ip.txt" timeout: 3000 always_standby: false verbose: true # ======================================== # 4. 缓存插件(无依赖,但被 main 引用) # ======================================== - tag: main_cache type: cache args: size: 100000 lazy_cache_ttl: 86400 dump_file: "./cache.dump" dump_interval: 3600 # ======================================== # 5. 主执行序列(依赖所有上面的插件) # ======================================== - tag: main type: sequence args: - exec: $main_cache - matches: - qname $geosite_cn exec: $forward_local - exec: $smart_fallback_handler - matches: - has_resp exec: $main_cache # ======================================== # 6. 服务器插件(最后,依赖 main) # ======================================== - tag: udp_server type: udp_server args: entry: main listen: ":5310" - tag: tcp_server type: tcp_server args: entry: main listen: ":5310"