全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 2388|回复: 3

使用mosdns让全部使用cloudflare cdn的网站走优选IP

[复制链接]
发表于 2022-7-2 09:06:19 | 显示全部楼层 |阅读模式
利用mosdns的response_matcher和blackhole两个内置插件实现

以下配置文件适用于mosdns v4版本

下载地址: https://github.com/IrineSistiana/mosdns/releases

运行:./mosdns start -c config.yaml

  1. log:
  2.   level: debug
  3.   file: ""

  4. plugins:

  5.   - tag: forward_remote
  6.     type: fast_forward
  7.     args:
  8.       upstream:
  9.         - addr: https://dns.alidns.com/dns-query
  10.           dial_addr: "223.5.5.5:443"

  11.   - tag: response_has_cloudflare_ip
  12.     type: response_matcher
  13.     args:
  14.       ip:
  15.         - "173.245.48.0/20"
  16.         - "103.21.244.0/22"
  17.         - "103.22.200.0/22"
  18.         - "103.31.4.0/22"
  19.         - "141.101.64.0/18"
  20.         - "108.162.192.0/18"
  21.         - "190.93.240.0/20"
  22.         - "188.114.96.0/20"
  23.         - "197.234.240.0/22"
  24.         - "198.41.128.0/17"
  25.         - "162.158.0.0/15"
  26.         - "104.16.0.0/13"
  27.         - "104.24.0.0/14"
  28.         - "172.64.0.0/13"
  29.         - "131.0.72.0/22"
  30.         - "2400:cb00::/32"
  31.         - "2606:4700::/32"
  32.         - "2803:f800::/32"
  33.         - "2405:b500::/32"
  34.         - "2405:8100::/32"
  35.         - "2a06:98c0::/29"
  36.         - "2c0f:f248::/32"

  37.   - tag: replace_cloudflare_ip
  38.     type: blackhole
  39.     args:
  40.       rcode: 0
  41.       ipv4: "${优选IPv4}"
  42.       ipv6: "${优选IPv6}"

  43.   - tag: main_sequence
  44.     type: sequence
  45.     args:
  46.       exec:

  47.         - forward_remote

  48.         - if: response_has_cloudflare_ip
  49.           exec:
  50.             - replace_cloudflare_ip
  51.             - _return

  52.         - _return

  53. servers:
  54.   - exec: main_sequence
  55.     listeners:
  56.       - protocol: udp
  57.         addr: 127.0.0.1:53
复制代码


发表于 2022-7-2 09:09:30 | 显示全部楼层
可惜了,路由器拉了
发表于 2022-7-9 01:34:09 | 显示全部楼层
有没有不是V4的配置问题的
我整的V4这个配置运行不起来
不知道什么缘故
发表于 2022-7-9 11:01:34 | 显示全部楼层
虽然我国外的全部梯子代理了,但是还是赞一个,大佬nb
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-4-24 14:55 , Processed in 0.058968 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表