-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmosdns.conf
More file actions
146 lines (127 loc) · 3.12 KB
/
mosdns.conf
File metadata and controls
146 lines (127 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
log:
level: debug
file: ./mosdns.log
plugin:
- tag: main_server
type: server
args:
entry:
- main_sequence
- modify_ttl
server:
- protocol: udp
addr: 127.0.0.1:5335
- protocol: tcp
addr: 127.0.0.1:5335
- protocol: udp
addr: '[::1]:5335'
- protocol: tcp
addr: '[::1]:5335'
- tag: main_sequence
type: sequence
args:
exec:
- if:
- query_is_ad_domain
exec:
- _block_with_nxdomain
- _return
- mem_cache
- if:
- query_is_cn_domain
- '!_query_is_common'
exec:
- forward_local
- _return
- if:
- query_is_gfwlist_domain
exec:
- _prefer_ipv4
- forward_remote
- ipset_to_gfwlist
- _return
- if:
- query_is_no_cn_domain
exec:
- _prefer_ipv4
- forward_remote
- _return
- primary:
- forward_local
- if:
- '!response_has_local_ip'
exec:
- _drop_response
secondary:
- _prefer_ipv4
- forward_remote
fast_fallback: 200
always_standby: true
# ipset到隧道
- tag: 'ipset_to_gfwlist'
type: 'ipset'
args:
set_name4: 'gfwlist'
mask4: 24
# 缓存
- tag: 'mem_cache'
type: 'cache'
args:
size: 10240
# 修改应答 ttl
- tag: 'modify_ttl'
type: 'ttl'
args:
minimal_ttl: 300
maximum_ttl: 86400
# 转发请求至本地服务器的插件(运营商dns)
- tag: forward_local
type: fast_forward
args:
upstream:
- addr: '211.139.5.29'
- addr: '211.139.5.30'
- addr: 'https://27392.alidns.com/dns-query'
# 转发请求至远程服务器的插件(隧道dns)
- tag: forward_remote
type: fast_forward
args:
upstream:
- addr: 'https://cloudflare-dns.com/dns-query'
dial_addr: '1.1.1.1:443'
- addr: 'https://doh.opendns.com/dns-query'
dial_addr: '146.112.41.2:443'
- addr: 'https://dns.quad9.net/dns-query'
dial_addr: '9.9.9.9:443'
- addr: 'https://dns.google/dns-query'
dial_addr: '8.8.8.8:443'
# 匹配中国域名的插件
- tag: query_is_cn_domain
type: query_matcher
args:
domain:
- 'ext:./geosite.dat:cn'
# 匹配非本地域名的插件
- tag: query_is_no_cn_domain
type: query_matcher
args:
domain:
- 'ext:./geosite.dat:geolocation-!cn'
- tag: query_is_gfwlist_domain
type: query_matcher
args:
domain:
- 'ext:./geosite.dat:gfw'
- 'ext:./cm_list.txt'
# 匹配广告域名的插件
- tag: query_is_ad_domain
type: query_matcher
args:
domain:
- 'ext:./rule/blocklist.txt'
# 匹配本地 IP 的插件
- tag: response_has_local_ip
type: response_matcher
args:
ip:
- 'ext:./geoip.dat:cn'