feat: 增强功能,允许远程配置文件配置某个域名为 false,跳过 pac.txt
parent
48c17b2c70
commit
1f3786ac6f
|
@ -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…
Reference in New Issue