refactor: 支持配置端口
parent
014d2027e9
commit
8317b6a734
|
@ -1,10 +1,10 @@
|
|||
module.exports = {
|
||||
name: '梯子',
|
||||
enabled: false, // 默认关闭梯子
|
||||
server: {
|
||||
},
|
||||
server: {},
|
||||
serverDefault: {
|
||||
'ow-prod.docmirror.top': {
|
||||
port: 443,
|
||||
path: 'X2dvX292ZXJfd2FsbF8',
|
||||
password: 'dev_sidecar_is_666'
|
||||
}
|
||||
|
|
|
@ -53,13 +53,16 @@
|
|||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="10" v-for="(item,index) of servers" :key = 'index'>
|
||||
<a-col :span="8">
|
||||
<a-input addon-before="域名" placeholder="yourdomain.com" v-model="item.key"></a-input>
|
||||
<a-col :span="6">
|
||||
<a-input addon-before="域名" placeholder="yourdomain.com" v-model="item.key"/>
|
||||
</a-col>
|
||||
<a-col :span="7">
|
||||
<a-col :span="5">
|
||||
<a-input addon-before="端口" placeholder="443" v-model="item.value.port"/>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-input addon-before="路径" placeholder="xxxxxx" v-model="item.value.path"/>
|
||||
</a-col>
|
||||
<a-col :span="7">
|
||||
<a-col :span="5">
|
||||
<a-input addon-before="密码" type="password" placeholder="password" v-model="item.value.password"/>
|
||||
</a-col>
|
||||
<a-col :span="2">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const url = require('url')
|
||||
const pac = require('./source/pac')
|
||||
const matchUtil = require('../../../utils/util.match')
|
||||
const lodash = require('lodash')
|
||||
|
||||
function matched (hostname, regexpMap) {
|
||||
const ret1 = matchUtil.matchHostname(regexpMap, hostname)
|
||||
if (ret1) {
|
||||
|
@ -63,6 +63,7 @@ module.exports = function createOverWallIntercept (overWallConfig) {
|
|||
}
|
||||
|
||||
const domain = proxyServer
|
||||
const port = server[domain].port
|
||||
const path = server[domain].path
|
||||
const password = server[domain].password
|
||||
const proxyTarget = domain + '/' + path + '/' + hostname + req.url
|
||||
|
@ -80,7 +81,7 @@ module.exports = function createOverWallIntercept (overWallConfig) {
|
|||
}
|
||||
rOptions.path = URL.path
|
||||
if (URL.port == null) {
|
||||
rOptions.port = rOptions.protocol === 'https:' ? 443 : 80
|
||||
rOptions.port = port || (rOptions.protocol === 'https:' ? 443 : 80)
|
||||
}
|
||||
log.info('OverWall:', rOptions.hostname, proxyTarget)
|
||||
if (context.requestCount) {
|
||||
|
|
Loading…
Reference in New Issue