mosdns/config-smart-fallback.yaml
dengxiongjian 0413ee5d44
Some checks failed
Test mosdns / build (push) Has been cancelled
二次开发
2025-10-16 21:07:48 +08:00

83 lines
2.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# YLTX-DNS 智能防污染系统主配置文件
# 此配置文件展示了如何使用智能防污染功能
log:
level: info
api:
http: "0.0.0.0:5541"
web:
http: "0.0.0.0:5555"
# ==================== 基础DNS上游定义 ====================
plugins:
# 国内DNS并行查询提升速度
- tag: china-dns
type: forward
args:
concurrent: 3 # 并发查询3个上游
upstreams:
- addr: "223.5.5.5" # 阿里DNS
- addr: "119.29.29.29" # 腾讯DNS
- addr: "114.114.114.114" # 114DNS
# 国际DNS使用DoH加密提升隐私
- tag: overseas-dns
type: forward
args:
upstreams:
- addr: "https://1.1.1.1/dns-query" # Cloudflare DoH
- addr: "https://8.8.8.8/dns-query" # Google DoH
# ==================== 智能防污染插件 ====================
# 智能防污染处理器(核心功能)
- tag: smart_fallback_handler
type: smart_fallback
args:
primary: $china-dns # 主上游国内DNS
secondary: $overseas-dns # 备用上游国际DNS
china_ip: # CN IP地址表文件
- "/data/chn_ip.txt" # IPv4地址段
- "/data/chn_ipv6.txt" # IPv6地址段可选
timeout: 2000 # 超时2秒
always_standby: false # 顺序查询(节省资源)
verbose: true # 启用详细日志
# ==================== 主处理序列 ====================
- tag: main
type: sequence
args:
# 规则1匹配特定域名规则
# 注意这里的规则将通过Web界面动态添加和管理
# 例如添加OpenAI规则后会自动生成
# - matches: qname $domains_openai
# exec: $china-dns
# 默认处理:所有未匹配的域名使用智能防污染
- exec: $smart_fallback_handler
# ==================== DNS服务器配置 ====================
- tag: udp_server
type: udp_server
args:
entry: main
listen: ":53"
- tag: tcp_server
type: tcp_server
args:
entry: main
listen: ":53"
# ==================== 引入动态规则 ====================
# 注意规则文件将通过Web界面动态生成和管理
# 请确保 config.d/rules 目录存在,或者暂时注释掉此行
include:
# - "/usr/local/yltx-dns/config.d/rules/*.yaml" # 动态规则文件