Created
April 20, 2023 07:02
-
-
Save luoboQAQ/7d7c9b1495e53536d7f2b95022feedee to your computer and use it in GitHub Desktop.
mosdns配置文件及更新脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Powered by luoboQAQ | |
log: | |
level: info | |
# file: ./log.txt | |
plugins: | |
# 缓存插件 | |
- tag: cache | |
type: cache | |
args: | |
size: 10240 | |
lazy_cache_ttl: 86400 | |
# 将缓存保存在磁盘 | |
dump_file: ./cache.dump | |
# 转发至本地服务器的插件 | |
- tag: forward_local | |
type: forward | |
args: | |
# concurrent: 2 # 并发请求 | |
upstreams: | |
- tag: alidns_doh | |
addr: "https://223.5.5.5/dns-query" | |
- tag: dnspod_doh | |
addr: "https://120.53.53.53/dns-query" | |
# 转发至远程服务器的插件 | |
- tag: forward_remote | |
type: forward | |
args: | |
upstreams: | |
#- tag: easymosdns | |
# addr: "https://doh.apad.pro/dns-query" | |
# bootstrap: "223.5.5.5" | |
#- tag: dns_sb | |
# addr: "https://45.11.45.11/dns-query" | |
#- tag: dns_google_v6 | |
# addr: "https://dns64.dns.google/dns-query" | |
# dial_addr: "2001:4860:4860::64" | |
- tag: dns_Cloudflare_v6 | |
addr: "https://[2606:4700:4700::1001]/dns-query" | |
# fallback 用本地服务器 sequence | |
# 返回不包含本地 ip 则 reject | |
- tag: local_ip_sequence | |
type: sequence | |
args: | |
- exec: $forward_local | |
- matches: resp_ip &./data/CN-ip-cidr.txt | |
exec: accept | |
- exec: drop_resp # v5.1.2 以后不能用 reject | |
# fallback 用远程服务器 sequence | |
- tag: remote_sequence | |
type: sequence | |
args: | |
- exec: $forward_remote | |
# CloudFlare劫持到优选IP | |
- matches: resp_ip &./data/cloudflare.txt | |
exec: black_hole 2606:4700:3014:cf7f:8d51:65ef:1ec6:71f1 2a06:98c1:51:4707:877d:5bf9:d7ea:14b7 | |
- exec: accept | |
# fallback插件 | |
- tag: fallback | |
type: fallback | |
args: | |
primary: local_ip_sequence | |
secondary: remote_sequence | |
threshold: 500 | |
always_standby: true | |
# 主要运行逻辑插件 | |
- tag: main_sequence | |
type: sequence | |
args: | |
- matches: qtype 65 | |
exec: reject 3 | |
# 去广告 | |
- matches: qname &./data/reject-list.txt | |
exec: reject 3 | |
- matches: qname &./data/ad-domains.txt | |
exec: reject 3 | |
- exec: prefer_ipv6 | |
- exec: $cache | |
- matches: has_resp | |
exec: accept | |
# 匹配校园网域名,用本地DNS解析 | |
- matches: qname yzu.edu.cn | |
exec: forward 221.131.143.69 | |
- matches: has_resp | |
exec: accept | |
- matches: qname &./data/direct-list.txt | |
exec: $forward_local | |
- matches: has_resp | |
exec: accept | |
- exec: $fallback | |
# 启动 udp服务器 | |
- type: udp_server | |
args: | |
entry: main_sequence | |
listen: 127.0.0.1:53 | |
- tag: udp_server_v6 | |
type: udp_server | |
args: | |
entry: main_sequence | |
listen: "[::1]:53" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -RunAsAdministrator | |
Invoke-WebRequest -Uri "https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/direct-list.txt" -OutFile ".\data\direct-list.txt" | |
Invoke-WebRequest -Uri "https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/reject-list.txt" -OutFile ".\data\reject-list.txt" | |
Invoke-WebRequest -Uri "https://cdn.jsdelivr.net/gh/Hackl0us/GeoIP2-CN@release/CN-ip-cidr.txt" -OutFile ".\data\CN-ip-cidr.txt" | |
Invoke-WebRequest -Uri "https://anti-ad.net/domains.txt" -OutFile ".\data\ad-domains.txt" | |
Stop-Service -Name "mosdns" | |
Start-Service -Name "mosdns" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment