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

pull/376/head
王良 3 weeks ago
parent 48c17b2c70
commit 1f3786ac6f

@ -10,17 +10,23 @@ const { Buffer } = require('buffer')
let pacClient = null let pacClient = null
function matched (hostname, overWallTargetMap) { function matched (hostname, overWallTargetMap) {
// 匹配配置文件
const ret1 = matchUtil.matchHostname(overWallTargetMap, hostname, 'matched overwall') const ret1 = matchUtil.matchHostname(overWallTargetMap, hostname, 'matched overwall')
if (ret1) { 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) { if (pacClient == null) {
return null return null
} }
const ret = pacClient.FindProxyForURL('https://' + hostname, hostname) const ret = pacClient.FindProxyForURL('https://' + hostname, hostname)
if (ret && ret.indexOf('PROXY ') === 0) { if (ret && ret.indexOf('PROXY ') === 0) {
log.info(`matchHostname: matched overwall: '${hostname}' -> '${ret}' in pac.txt`) log.info(`matchHostname: matched overwall: '${hostname}' -> '${ret}' in pac.txt`)
return 'overwall pac' return 'in pac.txt'
} else { } else {
log.debug(`matchHostname: matched overwall: Not-Matched '${hostname}' -> '${ret}' in pac.txt`) log.debug(`matchHostname: matched overwall: Not-Matched '${hostname}' -> '${ret}' in pac.txt`)
return null return null

Loading…
Cancel
Save