Skip to content

Commit

Permalink
feat: 增强功能,允许配置某个域名为 禁用,跳过梯子,即使它收录在PAC内
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 committed Nov 6, 2024
1 parent 1f3786a commit 784bc05
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
25 changes: 21 additions & 4 deletions packages/gui/src/view/pages/plugin/overwall.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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>
Expand Down Expand Up @@ -116,7 +123,17 @@ export default {
return {
key: 'plugin.overwall',
targets: undefined,
servers: undefined
servers: undefined,
overwallOptions: [
{
value: true,
label: '启用'
},
{
value: false,
label: '禁用'
}
]
}
},
created () {
Expand Down
2 changes: 1 addition & 1 deletion packages/mitmproxy/src/lib/proxy/middleware/overwall.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions packages/mitmproxy/src/utils/util.match.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 // 快速匹配成功
}
Expand Down

0 comments on commit 784bc05

Please sign in to comment.