feature: 1)增加 `safe360` DNS,并将 `usa` 重命名为 `cloudflare`;2)为部分域名预设IP;3)PIP加速中,新增两个镜像。 (#312)
							parent
							
								
									5927f032db
								
							
						
					
					
						commit
						d1555d3238
					
				| 
						 | 
				
			
			@ -281,7 +281,7 @@ module.exports = {
 | 
			
		|||
          server: 'https://dns.alidns.com/dns-query',
 | 
			
		||||
          cacheSize: 1000
 | 
			
		||||
        },
 | 
			
		||||
        usa: {
 | 
			
		||||
        cloudflare: {
 | 
			
		||||
          type: 'https',
 | 
			
		||||
          server: 'https://1.1.1.1/dns-query',
 | 
			
		||||
          cacheSize: 1000
 | 
			
		||||
| 
						 | 
				
			
			@ -291,6 +291,11 @@ module.exports = {
 | 
			
		|||
          server: 'https://9.9.9.9/dns-query',
 | 
			
		||||
          cacheSize: 1000
 | 
			
		||||
        },
 | 
			
		||||
        safe360: {
 | 
			
		||||
          type: 'https',
 | 
			
		||||
          server: 'https://doh.360.cn/dns-query',
 | 
			
		||||
          cacheSize: 1000
 | 
			
		||||
        },
 | 
			
		||||
        rubyfish: {
 | 
			
		||||
          type: 'https',
 | 
			
		||||
          server: 'https://rubyfish.cn/dns-query',
 | 
			
		||||
| 
						 | 
				
			
			@ -320,7 +325,7 @@ module.exports = {
 | 
			
		|||
        enabled: true,
 | 
			
		||||
        interval: 300000,
 | 
			
		||||
        hostnameList: ['github.com'],
 | 
			
		||||
        dnsProviders: ['usa', 'quad9', 'rubyfish']
 | 
			
		||||
        dnsProviders: ['safe360', 'cloudflare', 'rubyfish']
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,6 +32,12 @@
 | 
			
		|||
            <a-radio-button value="https://mirrors.aliyun.com/pypi/simple/">
 | 
			
		||||
              aliyun镜像
 | 
			
		||||
            </a-radio-button>
 | 
			
		||||
            <a-radio-button value="https://mirrors.bfsu.edu.cn/pypi/web/simple">
 | 
			
		||||
              北京外国语大学镜像
 | 
			
		||||
            </a-radio-button>
 | 
			
		||||
            <a-radio-button value="https://mirror.nju.edu.cn/pypi/web/simple">
 | 
			
		||||
              南京大学镜像
 | 
			
		||||
            </a-radio-button>
 | 
			
		||||
          </a-radio-group>
 | 
			
		||||
          <div class="form-help">设置后立即生效,即使关闭ds也会继续保持</div>
 | 
			
		||||
        </a-form-item>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,49 @@ module.exports = class DNSOverHTTPS extends BaseDNS {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  async _lookup (hostname) {
 | 
			
		||||
    // 直接判断域名是否为example.com
 | 
			
		||||
    if (hostname === 'github.com') {
 | 
			
		||||
      log.info('域名github.com使用内置IP集')
 | 
			
		||||
      // 返回预设的IP地址集
 | 
			
		||||
      return ['140.82.114.4', '20.87.245.0', '20.27.177.113', '20.205.243.166', '20.248.137.48', '140.82.121.3', '140.82.116.4', '20.200.245.247', '20.26.156.215', '140.82.113.3', '140.82.121.4', '20.201.28.151']
 | 
			
		||||
    }
 | 
			
		||||
    // 直接判断域名是否为example.com
 | 
			
		||||
    if (hostname === 'api.github.com') {
 | 
			
		||||
      log.info('域名api.github.com使用内置IP集')
 | 
			
		||||
      // 返回预设的IP地址集
 | 
			
		||||
      return ['20.87.245.6', '140.82.112.5', '140.82.116.6', '20.26.156.210', '20.200.245.245', '20.27.177.116', '20.248.137.49', '20.201.28.148', '140.82.113.6', '20.205.243.168', '140.82.121.6']
 | 
			
		||||
    }
 | 
			
		||||
    if (hostname === 'codeload.github.com') {
 | 
			
		||||
      log.info('域名codeload.github.com使用内置IP集')
 | 
			
		||||
      // 返回预设的IP地址集
 | 
			
		||||
      return ['20.27.177.114', '140.82.116.10', '140.82.114.10', '20.26.156.216', '20.87.245.7', '20.200.245.246', '20.248.137.55', '20.205.243.165', '20.201.28.149', '140.82.121.9', '140.82.113.9']
 | 
			
		||||
    }
 | 
			
		||||
    if (hostname.match(/.*\.githubusercontent\.com$/)) {
 | 
			
		||||
      log.info('域名githubusercontent及其子域使用内置IP集')
 | 
			
		||||
      // 返回预设的IP地址集
 | 
			
		||||
      return ['185.199.111.133', '185.199.108.133', '185.199.109.133', '185.199.110.133']
 | 
			
		||||
    }
 | 
			
		||||
    if (hostname === 'github.githubassets.com') {
 | 
			
		||||
      log.info('域名github.githubassets.com使用内置IP集')
 | 
			
		||||
      // 返回预设的IP地址集
 | 
			
		||||
      return ['185.199.110.154', '185.199.111.154', '185.199.109.154', '185.199.108.154']
 | 
			
		||||
    }
 | 
			
		||||
    if (hostname === 'collector.github.com') {
 | 
			
		||||
      log.info('域名collector.github.com已根据AdGuard DNS filter规则拦截')
 | 
			
		||||
      // 返回预设的IP地址集
 | 
			
		||||
      return ['0.0.0.0']
 | 
			
		||||
    }
 | 
			
		||||
    if (hostname === 'github.io') {
 | 
			
		||||
      log.info('域名github.io使用内置IP集')
 | 
			
		||||
      // 返回预设的IP地址集
 | 
			
		||||
      return ['185.199.108.153', '185.199.109.153', '185.199.111.153', '185.199.110.153']
 | 
			
		||||
    }
 | 
			
		||||
    if (hostname === 'hub.docker.com') {
 | 
			
		||||
      log.info('域名hub.docker.com使用内置IP集')
 | 
			
		||||
      // 返回预设的IP地址集
 | 
			
		||||
      return ['54.156.140.159', '52.44.227.212', '44.221.37.199']
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
      const result = await dohQueryAsync({ url: this.dnsServer }, [{ type: 'A', name: hostname }])
 | 
			
		||||
      if (result.answers.length === 0) {
 | 
			
		||||
| 
						 | 
				
			
			@ -18,7 +61,7 @@ module.exports = class DNSOverHTTPS extends BaseDNS {
 | 
			
		|||
        log.info('该域名没有ip地址解析:', hostname)
 | 
			
		||||
        return []
 | 
			
		||||
      }
 | 
			
		||||
      const ret = result.answers.filter(item => { return item.type === 'A' }).map(item => { return item.data })
 | 
			
		||||
      const ret = result.answers.filter(item => item.type === 'A').map(item => item.data)
 | 
			
		||||
      if (ret.length === 0) {
 | 
			
		||||
        log.info('该域名没有IPv4地址解析:', hostname)
 | 
			
		||||
      } else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue