Browse Source

feat: 增强功能,允许配置某个域名为 `禁用`,跳过梯子,即使它收录在PAC内

build-arm64
王良 2 weeks ago
parent
commit
784bc05770
  1. 25
      packages/gui/src/view/pages/plugin/overwall.vue
  2. 2
      packages/mitmproxy/src/lib/proxy/middleware/overwall.js
  3. 6
      packages/mitmproxy/src/utils/util.match.js

25
packages/gui/src/view/pages/plugin/overwall.vue

@ -24,7 +24,7 @@
<a-checkbox v-model="config.plugin.overwall.pac.enabled">
启用PAC
</a-checkbox>
<div class="form-help">PAC内收录了常见的被封杀的域名当里面某些域名你不想被拦截时可以关闭PAC</div>
<div class="form-help">PAC内收录了常见的被封杀的域名<br/>当里面某些域名你不想被拦截时你可以配置这些域名为<code>禁用</code>可以关闭PAC</div>
</a-form-item>
<a-form-item label="自动更新PAC" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-checkbox v-model="config.plugin.overwall.pac.autoUpdate">
@ -46,16 +46,23 @@
<div>
<a-row :gutter="10" style="">
<a-col :span="22">
<span>PAC没有拦截到的域名可以在此处定义</span>
<span>PAC没有拦截到的域名可以在此处定义配置为<code>禁用</code>将不使用梯子</span>
</a-col>
<a-col :span="2">
<a-button type="primary" icon="plus" @click="addTarget()"/>
</a-col>
</a-row>
<a-row :gutter="10" v-for="(item,index) of targets" :key="index">
<a-col :span="22">
<a-col :span="18">
<a-input v-model="item.key"></a-input>
</a-col>
<a-col :span="4">
<a-select v-model="item.value" style="width:100%">
<a-select-option v-for="(item) of overwallOptions" :key="item.value" :value="item.value">
{{ item.label }}
</a-select-option>
</a-select>
</a-col>
<a-col :span="2">
<a-button type="danger" icon="minus" @click="deleteTarget(item,index)"/>
</a-col>
@ -116,7 +123,17 @@ export default {
return {
key: 'plugin.overwall',
targets: undefined,
servers: undefined
servers: undefined,
overwallOptions: [
{
value: true,
label: '启用'
},
{
value: false,
label: '禁用'
}
]
}
},
created () {

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

@ -15,7 +15,7 @@ function matched (hostname, overWallTargetMap) {
if (ret1) {
return 'in config'
} else if (ret1 === false || ret1 === 'false') {
log.info(`域名 ${hostname} 的overwall配置为 false,跳过增强功能,即使它在 pac.txt 里`)
log.debug(`域名 ${hostname} 的overwall配置为 false,跳过增强功能,即使它在 pac.txt 里`)
return null
}

6
packages/mitmproxy/src/utils/util.match.js

@ -61,17 +61,17 @@ function matchHostname (hostMap, hostname, action) {
// 域名快速匹配:直接匹配 或者 两种前缀通配符匹配
let value = hostMap.origin[hostname]
if (value) {
if (value != null) {
log.info(`matchHostname: ${action}: '${hostname}' -> { "${hostname}": ${JSON.stringify(value)} }`)
return value // 快速匹配成功
}
value = hostMap.origin['*' + hostname]
if (value) {
if (value != null) {
log.info(`matchHostname: ${action}: '${hostname}' -> { "*${hostname}": ${JSON.stringify(value)} }`)
return value // 快速匹配成功
}
value = hostMap.origin['*.' + hostname]
if (value) {
if (value != null) {
log.info(`matchHostname: ${action}: '${hostname}' -> { "*.${hostname}": ${JSON.stringify(value)} }`)
return value // 快速匹配成功
}

Loading…
Cancel
Save