mosdns/dns-memory-optimized.yaml

94 lines
3.1 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.

################ DNS Plugins - 内存缓存优化版 #################
# 🚀 核心优化:
# 1. 程序启动时从MikroTik加载现有IP到内存
# 2. 完全移除验证功能
# 3. 内存判断IP存在性避免重复写入
# 4. 使用/24网段掩码减少条目数量
plugins:
- tag: mikrotik-one
type: forward
args:
concurrent: 1
upstreams:
- addr: "udp://10.248.0.1"
- tag: cn-dns
type: forward
args:
concurrent: 6
upstreams:
- addr: "udp://202.96.128.86"
- addr: "udp://202.96.128.166"
- addr: "udp://119.29.29.29"
- addr: "udp://223.5.5.5"
- addr: "udp://114.114.114.114"
- addr: "udp://180.76.76.76"
- tag: jp-dns
type: forward
args:
concurrent: 4
upstreams:
- addr: "tls://1dot1dot1dot1.cloudflare-dns.com"
dial_addr: "1.1.1.1"
enable_pipeline: true
- addr: "tls://1dot1dot1dot1.cloudflare-dns.com"
dial_addr: "1.0.0.1"
enable_pipeline: true
- addr: "tls://dns.google"
dial_addr: "8.8.8.8"
enable_pipeline: true
- addr: "tls://dns.google"
dial_addr: "8.8.4.4"
enable_pipeline: true
# 🚀 MikroTik Address List 插件 - 内存缓存优化配置
- tag: mikrotik_amazon
type: mikrotik_addresslist
args:
host: "10.248.0.1"
port: 9728
username: "admin"
password: "szn0s!nw@pwd()"
use_tls: false
timeout: 3 # 🚀 快速连接超时
# 地址列表配置
address_list4: "gfw" # IPv4地址列表名
address_list6: "gfw6" # IPv6地址列表名可选
# 🚀 核心优化:网段掩码配置
mask4: 24 # 使用/24网段减少条目数量
mask6: 64 # IPv6使用/64网段
# 超时和缓存配置
comment: "auto-amazon" # 自动添加的注释
timeout_addr: 43200 # 12小时地址超时
cache_ttl: 7200 # 2小时内存缓存TTL
# 🚀 性能优化开关
verify_add: false # 🔥 完全关闭验证功能
add_all_ips: true # 启用多IP支持
max_ips: 15 # 每个域名最多15个IP
# 🚀 新增:内存缓存优化参数
preload_existing: true # 启动时预加载现有IP
memory_cache_size: 10000 # 内存缓存最大条目数
subnet_cache_ttl: 14400 # 网段缓存4小时TTL
# 工作线程优化
worker_pool_size: 20 # 增加工作线程池
batch_size: 25 # 增加批处理大小
# 连接优化
max_retries: 2 # 最大重试次数
retry_backoff_ms: 100 # 重试退避时间(毫秒)
connection_pool_size: 3 # 连接池大小
# 🚀 启动行为配置
startup_load_timeout: 30 # 启动加载超时时间(秒)
log_cache_stats: true # 记录缓存统计信息
cleanup_interval: 3600 # 缓存清理间隔(秒)