refactor: speed test 优化

pull/67/head
xiaojunnuo 2021-03-26 00:21:48 +08:00
parent 8cd5708529
commit e2caf406fd
4 changed files with 11 additions and 8 deletions

View File

@ -152,11 +152,11 @@ module.exports = {
server: 'https://dns.alidns.com/dns-query',
cacheSize: 1000
},
ipaddress: {
type: 'ipaddress',
server: 'ipaddress',
cacheSize: 1000
},
// ipaddress: {
// type: 'ipaddress',
// server: 'ipaddress',
// cacheSize: 1000
// },
usa: {
type: 'https',
server: 'https://1.1.1.1/dns-query',
@ -192,7 +192,7 @@ module.exports = {
'*.githubusercontent.com': 'usa',
'*.githubassets.com': 'usa',
// "解决push的时候需要输入密码的问题",
'github.com': 'usa',
'github.com': 'quad9',
'*github.com': 'usa',
'*.vuepress.vuejs.org': 'usa',
'gh.docmirror.top': 'usa'

View File

@ -25,6 +25,7 @@
<img v-if="!startup.loading && status.server.enabled" width="50" src="/logo/logo-fff.svg">
</a-button>
<div style="margin-top: 10px">{{ status.server.enabled ? '已开启' : '已关闭' }}</div>
</div>
</div>
<div :span="12">

View File

@ -80,7 +80,9 @@ class SpeedTester {
}
async test () {
this.backupList = await this.getIpListFromDns(this.dnsMap)
const newList = await this.getIpListFromDns(this.dnsMap)
const newBackupList = [...newList, ...this.backupList]
this.backupList = _.unionBy(newBackupList, 'host')
log.info('[speed]', this.hostname, ' ips:', this.backupList)
await this.testBackups()
if (config.notify) {

View File

@ -16,7 +16,7 @@ function initSpeedTest ({ enabled, hostnameList, dnsMap }) {
SpeedTestPool[hostname] = new SpeedTester({ hostname })
})
log.info('[speed] dnsMap', dnsMap)
log.info('[speed] enabled')
}
function getAllSpeedTester () {