Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4097a34

Browse files
committedMar 3, 2025·
移除dns:ipaddress
1 parent f9f7d26 commit 4097a34

File tree

4 files changed

+2
-56
lines changed

4 files changed

+2
-56
lines changed
 

‎packages/mitmproxy/src/lib/dns/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const matchUtil = require('../../utils/util.match')
22
const DNSOverPreSetIpList = require('./preset.js')
3-
const DNSOverIpAddress = require('./ipaddress.js')
43
const DNSOverHTTPS = require('./https.js')
54
const DNSOverTLS = require('./tls.js')
65
const DNSOverTCP = require('./tcp.js')
@@ -39,9 +38,7 @@ module.exports = {
3938
conf.type = conf.type.toLowerCase()
4039
}
4140

42-
if (conf.type === 'ipaddress') {
43-
dnsMap[provider] = new DNSOverIpAddress(provider, conf.cacheSize, preSetIpList)
44-
} else if (conf.type === 'https') {
41+
if (conf.type === 'https') {
4542
dnsMap[provider] = new DNSOverHTTPS(provider, conf.cacheSize, preSetIpList, server)
4643
} else if (conf.type === 'tls') {
4744
if (server.startsWith('tls://')) {

‎packages/mitmproxy/src/lib/dns/ipaddress.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

‎packages/mitmproxy/test/dnsSpeedTest.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ const SpeedTest = require('../src/lib/speed/index.js')
33
const SpeedTester = require('../src/lib/speed/SpeedTester.js')
44

55
const dnsMap = dns.initDNS({
6-
// ipaddress: {
7-
// type: 'ipaddress',
8-
// server: 'ipaddress',
9-
// cacheSize: 1000
10-
// },
116
cloudflare: {
127
type: 'https',
138
server: 'https://1.1.1.1/dns-query',

‎packages/mitmproxy/test/dnsTest.mjs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ import dns from '../src/lib/dns/index.js'
44
const presetIp = '100.100.100.100'
55

66
const dnsProviders = dns.initDNS({
7-
ipaddress: {
8-
type: 'ipaddress',
9-
server: 'ipaddress',
10-
cacheSize: 1000,
11-
},
12-
137
// https
148
cloudflare: {
159
type: 'https',
@@ -93,6 +87,7 @@ const dnsProviders = dns.initDNS({
9387
}
9488
})
9589

90+
9691
const presetHostname = 'xxx.com'
9792
const hostname1 = 'github.com'
9893
const hostname2 = 'api.github.com'
@@ -103,18 +98,6 @@ const hostname6 = 'gh2.docmirror.top'
10398

10499
let ip
105100

106-
// const test = '111<tr><th>IP Address</th><td><ul class="comma-separated"><li>140.82.113.4</li></ul></td></tr>2222'
107-
// // <tr><th>IP Address</th><td><ul class="comma-separated"><li>140.82.113.4</li></ul></td></tr>
108-
// // <tr><th>IP Address</th><td><ul class="comma-separated"><li>(.*)</li></ul></td></tr>
109-
// const regexp = /<tr><th>IP Address<\/th><td><ul class="comma-separated"><li>(.*)<\/li><\/ul><\/td><\/tr>/
110-
// const matched = regexp.exec(test)
111-
// console.log('data:', matched)
112-
//
113-
// console.log('\n--------------- test ipaddress ---------------\n')
114-
// ip = await dnsProviders.ipaddress.lookup(hostname1)
115-
// console.log('===> test ipaddress:', ip, '\n\n')
116-
assert.strictEqual(dnsProviders.ipaddress.type, 'ipaddress')
117-
118101

119102
console.log('\n--------------- test PreSet ---------------\n')
120103
ip = await dnsProviders.PreSet.lookup(presetHostname)

0 commit comments

Comments
 (0)
Please sign in to comment.