You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dev-sidecar/packages/mitmproxy/test/dnsTest.mjs

78 lines
2.1 KiB

import dns from '../src/lib/dns/index.js'
const dnsProviders = dns.initDNS({
aliyun: {
type: 'https',
server: 'https://dns.alidns.com/dns-query',
cacheSize: 1000
},
usa: {
type: 'https',
server: 'https://1.1.1.1/dns-query',
cacheSize: 1000
4 years ago
},
ipaddress: {
type: 'ipaddress',
server: 'ipaddress',
cacheSize: 1000
},
quad9: {
type: 'https',
server: 'https://9.9.9.9/dns-query',
cacheSize: 1000
},
rubyfish: {
type: 'https',
server: 'https://rubyfish.cn/dns-query',
cacheSize: 1000
},
py233: {
type: 'https',
server: ' https://i.233py.com/dns-query',
cacheSize: 1000
}
// sb: {
// type: 'https',
// server: 'https://doh.dns.sb/dns-query',
// cacheSize: 1000
// },
// adguard: {
// type: 'https',
// server: ' https://dns.adguard.com/dns-query',
// cacheSize: 1000
// }
})
4 years ago
// const test = '111<tr><th>IP Address</th><td><ul class="comma-separated"><li>140.82.113.4</li></ul></td></tr>2222'
// // <tr><th>IP Address</th><td><ul class="comma-separated"><li>140.82.113.4</li></ul></td></tr>
// // <tr><th>IP Address</th><td><ul class="comma-separated"><li>(.*)</li></ul></td></tr>
// const regexp = /<tr><th>IP Address<\/th><td><ul class="comma-separated"><li>(.*)<\/li><\/ul><\/td><\/tr>/
// const matched = regexp.exec(test)
// console.log('data:', matched)
const hostname0 = 'github.com'
4 years ago
// console.log('first')
// dnsProviders.usa.lookup(hostname0)
console.log('test')
dnsProviders.py233.lookup(hostname0)
4 years ago
// dnsProviders.usa.lookup(hostname0)
// dnsProviders.ipaddress.lookup(hostname0)
// dnsProviders.ipaddress.lookup(hostname0)
// const hostname = 'api.github.com'
// dnsProviders.usa.lookup(hostname)
// const hostname1 = 'api.github.com'
// dnsProviders.usa.lookup(hostname1)
//
// const hostname2 = 'hk.docmirror.cn'
// dnsProviders.usa.lookup(hostname2)
// const hostname3 = 'github.docmirror.cn'
// dnsProviders.usa.lookup(hostname3)
// const hostname4 = 'gh.docmirror.top'
// dnsProviders.usa.lookup(hostname4)
// const hostname5 = 'gh2.docmirror.top'
// dnsProviders.usa.lookup(hostname5)