| 323 | |
| 324 | //防止dns泄露 |
| 325 | function overwriteDns(params) { |
| 326 | const cnDnsList = [ |
| 327 | "https://223.5.5.5/dns-query", |
| 328 | "https://1.12.12.12/dns-query", |
| 329 | ]; |
| 330 | const trustDnsList = [ |
| 331 | 'quic://dns.cooluc.com', |
| 332 | "https://1.0.0.1/dns-query", |
| 333 | "https://1.1.1.1/dns-query", |
| 334 | ]; |
| 335 | // const notionDns = 'tls://dns.jerryw.cn' |
| 336 | // const notionUrls = [ |
| 337 | // 'http-inputs-notion.splunkcloud.com', |
| 338 | // '+.notion-static.com', |
| 339 | // '+.notion.com', |
| 340 | // '+.notion.new', |
| 341 | // '+.notion.site', |
| 342 | // '+.notion.so', |
| 343 | // ] |
| 344 | // const combinedUrls = notionUrls.join(','); |
| 345 | const dnsOptions = { |
| 346 | enable: true, |
| 347 | "prefer-h3": true, // 如果DNS服务器支持DoH3会优先使用h3 |
| 348 | "default-nameserver": cnDnsList, // 用于解析其他DNS服务器、和节点的域名, 必须为IP, 可为加密DNS。注意这个只用来解析节点和其他的dns,其他网络请求不归他管 |
| 349 | nameserver: trustDnsList, // 其他网络请求都归他管 |
| 350 | |
| 351 | // 这个用于覆盖上面的 nameserver |
| 352 | "nameserver-policy": { |
| 353 | //[combinedUrls]: notionDns, |
| 354 | "geosite:cn": cnDnsList, |
| 355 | "geosite:geolocation-!cn": trustDnsList, |
| 356 | // 如果你有一些内网使用的DNS,应该定义在这里,多个域名用英文逗号分割 |
| 357 | // '+.公司域名.com, www.4399.com, +.baidu.com': '10.0.0.1' |
| 358 | }, |
| 359 | fallback: trustDnsList, |
| 360 | "fallback-filter": { |
| 361 | geoip: true, |
| 362 | //除了 geoip-code 配置的国家 IP, 其他的 IP 结果会被视为污染 geoip-code 配置的国家的结果会直接采用,否则将采用 fallback结果 |
| 363 | "geoip-code": "CN", |
| 364 | //geosite 列表的内容被视为已污染,匹配到 geosite 的域名,将只使用 fallback解析,不去使用 nameserver |
| 365 | geosite: ["gfw"], |
| 366 | ipcidr: ["240.0.0.0/4"], |
| 367 | domain: ["+.google.com", "+.facebook.com", "+.youtube.com"], |
| 368 | }, |
| 369 | }; |
| 370 | |
| 371 | // GitHub加速前缀 |
| 372 | const githubPrefix = "https://fastgh.lainbo.com/"; |
| 373 | |
| 374 | // GEO数据GitHub资源原始下载地址 |
| 375 | const rawGeoxURLs = { |
| 376 | geoip: |
| 377 | "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.dat", |
| 378 | geosite: |
| 379 | "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat", |
| 380 | mmdb: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country-lite.mmdb", |
| 381 | }; |
| 382 | |