dev-sidecar/packages/mitmproxy/test/dnsSpeed.js

39 lines
941 B
JavaScript
Raw Normal View History

2021-03-24 05:59:19 +00:00
const SpeedTester = require('../src/lib/speed/SpeedTester.js')
const SpeedTest = require('../src/lib/speed/index.js')
const dns = require('../src/lib/dns/index.js')
const dnsMap = dns.initDNS({
2021-03-24 06:18:27 +00:00
// ipaddress: {
// type: 'ipaddress',
// server: 'ipaddress',
// cacheSize: 1000
// },
2021-03-24 05:59:19 +00:00
usa: {
type: 'https',
server: 'https://1.1.1.1/dns-query',
cacheSize: 1000
}
2021-03-24 06:18:27 +00:00
// py233: { //污染
// type: 'https',
// server: ' https://i.233py.com/dns-query',
// cacheSize: 1000
// }
// google: { //不可用
2021-03-24 05:59:19 +00:00
// type: 'https',
// server: 'https://8.8.8.8/dns-query',
// cacheSize: 1000
// },
2021-03-24 06:18:27 +00:00
// dnsSB: { //不可用
2021-03-24 05:59:19 +00:00
// type: 'https',
// server: 'https://doh.dns.sb/dns-query',
// cacheSize: 1000
// }
})
SpeedTest.initSpeedTest({ hostnameList: {}, dnsMap })
2021-03-24 05:59:19 +00:00
const tester = new SpeedTester({ hostname: 'github.com' })
tester.test().then(ret => {
console.log(tester.alive)
})