refactor: pac转移配置
parent
09b2e65adb
commit
8b0f2d0f5d
|
@ -39,23 +39,23 @@ module.exports = {
|
|||
'/.*/.*/releases/download/': {
|
||||
redirect: 'download.fastgit.org',
|
||||
desc: 'release文件加速下载跳转地址',
|
||||
sni: 'no.sni'
|
||||
sni: 'baidu.com'
|
||||
},
|
||||
'/.*/.*/archive/': {
|
||||
redirect: 'download.fastgit.org',
|
||||
sni: 'no.sni'
|
||||
sni: 'baidu.com'
|
||||
},
|
||||
|
||||
'/.*/.*/blame/': {
|
||||
redirect: 'hub.fastgit.org',
|
||||
sni: 'no.sni'
|
||||
sni: 'baidu.com'
|
||||
},
|
||||
'^/[^/]+/[^/]+(/releases(/.*)?)?$': {
|
||||
script: [
|
||||
'github'
|
||||
],
|
||||
desc: 'clone加速复制链接脚本',
|
||||
sni: 'no.sni'
|
||||
sni: 'baidu.com'
|
||||
},
|
||||
'/.*': {
|
||||
proxy: 'github.com',
|
||||
|
@ -90,10 +90,10 @@ module.exports = {
|
|||
// google cdn
|
||||
'www.google.com': {
|
||||
'/recaptcha/.*': { proxy: 'www.recaptcha.net' }
|
||||
// '.*': {
|
||||
// proxy: 'gg.docmirror.top/_yxorp',
|
||||
// desc: '呀,被你发现了,偷偷的用,别声张'
|
||||
// }
|
||||
// '.*': {
|
||||
// proxy: 'gg.docmirror.top/_yxorp',
|
||||
// desc: '呀,被你发现了,偷偷的用,别声张'
|
||||
// }
|
||||
},
|
||||
'ajax.googleapis.com': {
|
||||
'.*': {
|
||||
|
|
|
@ -16,8 +16,9 @@ module.exports = {
|
|||
},
|
||||
pac: {
|
||||
enabled: true,
|
||||
update: [
|
||||
'https://gitlab.com/gfwlist/gfwlist/raw/master/gfwlist.txt'
|
||||
]
|
||||
// update: [
|
||||
// 'https://gitlab.com/gfwlist/gfwlist/raw/master/gfwlist.txt'
|
||||
// ],
|
||||
customPacFilePath: './extra/pac/pac.txt'
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,13 +1,14 @@
|
|||
const url = require('url')
|
||||
const pac = require('./source/pac')
|
||||
const matchUtil = require('../../../utils/util.match')
|
||||
let pacClient = null
|
||||
|
||||
function matched (hostname, regexpMap) {
|
||||
const ret1 = matchUtil.matchHostname(regexpMap, hostname)
|
||||
if (ret1) {
|
||||
return true
|
||||
}
|
||||
const ret = pac.FindProxyForURL('https://' + hostname, hostname)
|
||||
const ret = pacClient.FindProxyForURL('https://' + hostname, hostname)
|
||||
if (ret && ret.indexOf('PROXY ') === 0) {
|
||||
return true
|
||||
}
|
||||
|
@ -18,6 +19,11 @@ module.exports = function createOverWallIntercept (overWallConfig) {
|
|||
if (!overWallConfig || overWallConfig.enabled !== true) {
|
||||
return null
|
||||
}
|
||||
if (overWallConfig.pac) {
|
||||
// 初始化pac
|
||||
pacClient = pac.createPacClient(overWallConfig.pac.customPacFilePath)
|
||||
}
|
||||
|
||||
let server = overWallConfig.server
|
||||
let keys = Object.keys(server)
|
||||
if (keys.length === 0) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue