diff --git a/packages/mitmproxy/package.json b/packages/mitmproxy/package.json index c281102..f5a17cf 100644 --- a/packages/mitmproxy/package.json +++ b/packages/mitmproxy/package.json @@ -20,7 +20,7 @@ "is-browser": "^2.1.0", "json5": "^2.2.3", "lodash": "^4.17.20", - "lru-cache": "^6.0.0", + "lru-cache": "^7.15.0", "node-forge": "^1.3.1", "stream-throttle": "^0.1.3", "through2": "^4.0.2", diff --git a/packages/mitmproxy/src/lib/choice/index.js b/packages/mitmproxy/src/lib/choice/index.js index 701dbd8..d603c83 100644 --- a/packages/mitmproxy/src/lib/choice/index.js +++ b/packages/mitmproxy/src/lib/choice/index.js @@ -1,11 +1,13 @@ -const LRU = require('lru-cache') +const LRUCache = require('lru-cache').default const log = require('../../utils/util.log') const cacheSize = 1024 class ChoiceCache { constructor () { - this.cache = new LRU(cacheSize) + this.cache = new LRUCache({ + maxSize: cacheSize, + }) } get (key) { diff --git a/packages/mitmproxy/src/lib/dns/base.js b/packages/mitmproxy/src/lib/dns/base.js index 487fc53..2e8427d 100644 --- a/packages/mitmproxy/src/lib/dns/base.js +++ b/packages/mitmproxy/src/lib/dns/base.js @@ -1,4 +1,4 @@ -const LRU = require('lru-cache') +const LRUCache = require('lru-cache').default const log = require('../../utils/util.log') const { DynamicChoice } = require('../choice/index') @@ -23,7 +23,9 @@ class IpCache extends DynamicChoice { module.exports = class BaseDNS { constructor () { - this.cache = new LRU(cacheSize) + this.cache = new LRUCache({ + maxSize: cacheSize, + }) } count (hostname, ip, isError = true) {