Browse Source

feat: 增强功能,允许远程配置文件配置某个域名为 false,跳过 pac.txt

build-arm64
王良 2 weeks ago
parent
commit
1f3786ac6f
  1. 10
      packages/mitmproxy/src/lib/proxy/middleware/overwall.js

10
packages/mitmproxy/src/lib/proxy/middleware/overwall.js

@ -10,17 +10,23 @@ const { Buffer } = require('buffer')
let pacClient = null
function matched (hostname, overWallTargetMap) {
// 匹配配置文件
const ret1 = matchUtil.matchHostname(overWallTargetMap, hostname, 'matched overwall')
if (ret1) {
return 'overwall config'
return 'in config'
} else if (ret1 === false || ret1 === 'false') {
log.info(`域名 ${hostname} 的overwall配置为 false,跳过增强功能,即使它在 pac.txt 里`)
return null
}
// 匹配 pac.txt
if (pacClient == null) {
return null
}
const ret = pacClient.FindProxyForURL('https://' + hostname, hostname)
if (ret && ret.indexOf('PROXY ') === 0) {
log.info(`matchHostname: matched overwall: '${hostname}' -> '${ret}' in pac.txt`)
return 'overwall pac'
return 'in pac.txt'
} else {
log.debug(`matchHostname: matched overwall: Not-Matched '${hostname}' -> '${ret}' in pac.txt`)
return null

Loading…
Cancel
Save