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 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
| cat >> /usr/local/etc/mosdns/config.yaml << EOF log: level: error file: "./mosdns.log"
plugins:
- tag: cn_domainList type: "domain_set" args: files: - "./rules/china_domain_list.txt"
- tag: cn_ipList type: "ip_set" args: files: - "./rules/china_ip_list.txt"
- tag: block_domains type: "domain_set" args: files: - "./rules/ad_domain_list.txt"
- tag: custom_hosts type: "hosts" args: files: - "./rules/hosts"
- tag: cache type: "cache" args: size: 65535 dump_file: "./cache.dump" lazy_cache_ttl: 86400 dump_interval: 600
- tag: cn_DNS type: "forward" args: concurrent: 2 upstreams: - tag: ali_doh addr: "https://223.5.5.5/dns-query" enable_pipeline: true insecure_skip_verify: false
- tag: dnspod_doh addr: "https://1.12.12.12/dns-query" enable_pipeline: true insecure_skip_verify: false
- tag: global_DNS type: "forward" args: concurrent: 2 upstreams: - tag: google_doh addr: "https://8.8.8.8/dns-query" enable_pipeline: true insecure_skip_verify: false
- tag: google_dot addr: "tls://8.8.4.4" enable_pipeline: true insecure_skip_verify: false
- tag: modify_ttl type: "sequence" args: - exec: ttl 60-300
- tag: modify_black_ttl type: "sequence" args: - exec: ttl 600-3600
- tag: modify_resp_ttl type: "sequence" args: - matches: "qname \$block_domains" exec: mark 1 - matches: "mark 1" exec: jump modify_black_ttl - matches: "!mark 1" exec: jump modify_ttl
- tag: custom_hosts_resp type: "sequence" args: - exec: jump modify_resp_ttl - matches: "has_resp" exec: query_summary hit_custom_hosts - matches: "has_resp" exec: accept
- tag: hit_cache_resp type: "sequence" args: - exec: jump modify_resp_ttl - matches: "has_resp" exec: query_summary hit_cache - matches: "has_resp" exec: accept
- tag: query_is_reject type: "sequence" args: - exec: black_hole 127.0.0.1 ::1 0.0.0.0 - exec: query_summary hit_block_domains - matches: "qtype 65" exec: reject 3 - matches: "has_resp" exec: accept
- tag: cn_resolve type: "sequence" args: - exec: ecs 211.100.0.0 - exec: \$cn_DNS - exec: jump modify_resp_ttl - exec: query_summary hit_cn_DNS
- tag: global_resolve type: "sequence" args: - exec: ecs 211.100.0.0 - exec: \$global_DNS - exec: jump modify_resp_ttl - exec: query_summary hit_global_DNS - matches: "has_resp" exec: accept
- tag: cn_resolve_sequence type: "sequence" args: - exec: \$cn_resolve - matches: "resp_ip \$cn_ipList" exec: accept
- tag: global_resolve_sequence type: "sequence" args: - exec: \$global_resolve - matches: "has_resp" exec: accept
- tag: resolve_process type: "sequence" args: - exec: prefer_ipv4
- exec: \$custom_hosts - matches: "has_resp" exec: goto custom_hosts_resp
- exec: \$cache - matches: "has_resp" exec: goto hit_cache_resp
- matches: "qname \$block_domains" exec: jump query_is_reject
- matches: "qname \$cn_domainList" exec: jump cn_resolve_sequence
- exec: goto global_resolve_sequence
- tag: server_http type: "http_server" args: entries: - path: /dns-query exec: resolve_process src_ip_header: "X-Real-IP" listen: 127.0.0.1:8443 cert: "" key: "" idle_timeout: 10 EOF
|