diff --git a/README.md b/README.md
index 97d7a4c..ea3aff2 100644
--- a/README.md
+++ b/README.md
@@ -218,9 +218,9 @@ const intercepts = {
```js
dns: {
mapping: {
- 'api.github.com': 'usa', // "解决push的时候需要输入密码的问题",
- 'gist.github.com': 'usa' // 解决gist无法访问的问题
- '*.githubusercontent.com': 'usa' // 解决github头像经常下载不到的问题
+ 'api.github.com': 'cloudflare', // "解决push的时候需要输入密码的问题",
+ 'gist.github.com': 'cloudflare' // 解决gist无法访问的问题
+ '*.githubusercontent.com': 'cloudflare' // 解决github头像经常下载不到的问题
}
}
```
diff --git a/packages/gui/src/view/components/settings.vue b/packages/gui/src/view/components/settings.vue
index 34e3b1f..c333b09 100644
--- a/packages/gui/src/view/components/settings.vue
+++ b/packages/gui/src/view/components/settings.vue
@@ -1,3 +1,4 @@
+
diff --git a/packages/gui/src/view/pages/server.vue b/packages/gui/src/view/pages/server.vue
index a71f060..c367e67 100644
--- a/packages/gui/src/view/pages/server.vue
+++ b/packages/gui/src/view/pages/server.vue
@@ -7,7 +7,6 @@
-
-
{{ element.host }}
{{ element.time }}{{ element.time ? 'ms' : '' }}
@@ -230,8 +229,8 @@ export default {
key: 'server',
dnsMappings: [],
speedTestList: [],
- whiteList: [],
- sniList: []
+ whiteList: []
+ // sniList: []
}
},
created () {
@@ -270,7 +269,7 @@ export default {
ready () {
this.initDnsMapping()
this.initWhiteList()
- this.initSniList()
+ // this.initSniList()
if (this.config.server.dns.speedTest.dnsProviders) {
this.speedDns = this.config.server.dns.speedTest.dnsProviders
}
@@ -278,7 +277,7 @@ export default {
async applyBefore () {
this.submitDnsMapping()
this.submitWhiteList()
- this.submitSniList()
+ // this.submitSniList()
},
async applyAfter () {
if (this.status.server.enabled) {
@@ -343,34 +342,34 @@ export default {
this.whiteList.unshift({ key: '', value: true })
},
- // sniList
- initSniList () {
- this.sniList = []
- for (const key in this.config.server.sniList) {
- const value = this.config.server.sniList[key]
- this.sniList.push({
- key, value
- })
- }
- },
- submitSniList () {
- const sniList = {}
- for (const item of this.sniList) {
- if (item.key) {
- sniList[item.key] = item.value
- }
- }
- this.config.server.sniList = sniList
- },
- deleteSniList (item, index) {
- this.sniList.splice(index, 1)
- },
- restoreDefSniList (item, index) {
-
- },
- addSniList () {
- this.sniList.unshift({ key: '', value: true })
- },
+ // // sniList
+ // initSniList () {
+ // this.sniList = []
+ // for (const key in this.config.server.sniList) {
+ // const value = this.config.server.sniList[key]
+ // this.sniList.push({
+ // key, value
+ // })
+ // }
+ // },
+ // submitSniList () {
+ // const sniList = {}
+ // for (const item of this.sniList) {
+ // if (item.key) {
+ // sniList[item.key] = item.value
+ // }
+ // }
+ // this.config.server.sniList = sniList
+ // },
+ // deleteSniList (item, index) {
+ // this.sniList.splice(index, 1)
+ // },
+ // restoreDefSniList (item, index) {
+ //
+ // },
+ // addSniList () {
+ // this.sniList.unshift({ key: '', value: true })
+ // },
async openLog () {
const dir = await this.$api.info.getConfigDir()
diff --git a/packages/mitmproxy/src/lib/dns/https.js b/packages/mitmproxy/src/lib/dns/https.js
index 4168f4c..4d0deb9 100644
--- a/packages/mitmproxy/src/lib/dns/https.js
+++ b/packages/mitmproxy/src/lib/dns/https.js
@@ -54,6 +54,7 @@ module.exports = class DNSOverHTTPS extends BaseDNS {
return ['54.156.140.159', '52.44.227.212', '44.221.37.199']
}
+ // 未预设当前域名的IP列表,则从dns服务器获取
try {
const result = await dohQueryAsync({ url: this.dnsServer }, [{ type: 'A', name: hostname }])
if (result.answers.length === 0) {
diff --git a/packages/mitmproxy/src/lib/dns/index.js b/packages/mitmproxy/src/lib/dns/index.js
index af11da9..7fdc6da 100644
--- a/packages/mitmproxy/src/lib/dns/index.js
+++ b/packages/mitmproxy/src/lib/dns/index.js
@@ -17,7 +17,13 @@ module.exports = {
return dnsMap
},
hasDnsLookup (dnsConfig, hostname) {
- const providerName = matchUtil.matchHostname(dnsConfig.mapping, hostname, 'get dns providerName')
+ let providerName = matchUtil.matchHostname(dnsConfig.mapping, hostname, 'get dns providerName')
+
+ // usa已重命名为cloudflare,以下为向下兼容处理
+ if (providerName === 'usa') {
+ providerName = 'cloudflare'
+ }
+
if (providerName) {
return dnsConfig.providers[providerName]
}
diff --git a/packages/mitmproxy/test/dnsSpeed.js b/packages/mitmproxy/test/dnsSpeedTest.js
similarity index 98%
rename from packages/mitmproxy/test/dnsSpeed.js
rename to packages/mitmproxy/test/dnsSpeedTest.js
index 5f7281c..a8c6e5d 100644
--- a/packages/mitmproxy/test/dnsSpeed.js
+++ b/packages/mitmproxy/test/dnsSpeedTest.js
@@ -8,7 +8,7 @@ const dnsMap = dns.initDNS({
// server: 'ipaddress',
// cacheSize: 1000
// },
- usa: {
+ cloudflare: {
type: 'https',
server: 'https://1.1.1.1/dns-query',
cacheSize: 1000
diff --git a/packages/mitmproxy/test/dnsTest.mjs b/packages/mitmproxy/test/dnsTest.mjs
index f344b03..66df322 100644
--- a/packages/mitmproxy/test/dnsTest.mjs
+++ b/packages/mitmproxy/test/dnsTest.mjs
@@ -6,7 +6,7 @@ const dnsProviders = dns.initDNS({
server: 'https://dns.alidns.com/dns-query',
cacheSize: 1000
},
- usa: {
+ cloudflare: {
type: 'https',
server: 'https://1.1.1.1/dns-query',
cacheSize: 1000
@@ -54,24 +54,24 @@ const dnsProviders = dns.initDNS({
const hostname0 = 'github.com'
// console.log('first')
-// dnsProviders.usa.lookup(hostname0)
+// dnsProviders.cloudflare.lookup(hostname0)
console.log('test')
dnsProviders.py233.lookup(hostname0)
-// dnsProviders.usa.lookup(hostname0)
+// dnsProviders.cloudflare.lookup(hostname0)
// dnsProviders.ipaddress.lookup(hostname0)
// dnsProviders.ipaddress.lookup(hostname0)
// const hostname = 'api.github.com'
-// dnsProviders.usa.lookup(hostname)
+// dnsProviders.cloudflare.lookup(hostname)
// const hostname1 = 'api.github.com'
-// dnsProviders.usa.lookup(hostname1)
+// dnsProviders.cloudflare.lookup(hostname1)
//
// const hostname2 = 'hk.docmirror.cn'
-// dnsProviders.usa.lookup(hostname2)
+// dnsProviders.cloudflare.lookup(hostname2)
// const hostname3 = 'github.docmirror.cn'
-// dnsProviders.usa.lookup(hostname3)
+// dnsProviders.cloudflare.lookup(hostname3)
// const hostname4 = 'gh.docmirror.top'
-// dnsProviders.usa.lookup(hostname4)
+// dnsProviders.cloudflare.lookup(hostname4)
// const hostname5 = 'gh2.docmirror.top'
-// dnsProviders.usa.lookup(hostname5)
+// dnsProviders.cloudflare.lookup(hostname5)