Browse Source

optimize: 移除 sniList 相关的代码,因为已经没在使用。

pull/375/head
王良 1 month ago
parent
commit
938ca58421
  1. 3
      packages/core/src/config/index.js
  2. 3
      packages/gui/src/view/pages/server.vue
  3. 8
      packages/mitmproxy/src/lib/proxy/mitmproxy/createConnectHandler.js
  4. 6
      packages/mitmproxy/src/lib/proxy/mitmproxy/index.js
  5. 1
      packages/mitmproxy/src/options.js

3
packages/core/src/config/index.js

@ -347,9 +347,6 @@ module.exports = {
'*.baidu.com': true,
'192.168.*': true
},
sniList: {
// 'github.com': 'abaidu.com'
},
dns: {
providers: {
aliyun: {

3
packages/gui/src/view/pages/server.vue

@ -238,7 +238,6 @@ export default {
dnsMappings: [],
speedTestList: [],
whiteList: []
// sniList: []
}
},
created () {
@ -277,7 +276,6 @@ export default {
ready () {
this.initDnsMapping()
this.initWhiteList()
// this.initSniList()
if (this.config.server.dns.speedTest.dnsProviders) {
this.speedDns = this.config.server.dns.speedTest.dnsProviders
}
@ -285,7 +283,6 @@ export default {
async applyBefore () {
this.submitDnsMapping()
this.submitWhiteList()
// this.submitSniList()
},
async applyAfter () {
if (this.status.server.enabled) {

8
packages/mitmproxy/src/lib/proxy/mitmproxy/createConnectHandler.js

@ -17,7 +17,7 @@ function isSslConnect (sslConnectInterceptors, req, cltSocket, head) {
}
// create connectHandler function
module.exports = function createConnectHandler (sslConnectInterceptor, middlewares, fakeServerCenter, dnsConfig, sniConfig) {
module.exports = function createConnectHandler (sslConnectInterceptor, middlewares, fakeServerCenter, dnsConfig) {
// return
const sslConnectInterceptors = []
sslConnectInterceptors.push(sslConnectInterceptor)
@ -27,11 +27,11 @@ module.exports = function createConnectHandler (sslConnectInterceptor, middlewar
}
}
// log.info('sni config:', sniConfig)
// const sniRegexpMap = matchUtil.domainMapRegexply(sniConfig)
return function connectHandler (req, cltSocket, head) {
// eslint-disable-next-line node/no-deprecated-api
const { hostname, port } = url.parse(`https://${req.url}`)
let { hostname, port } = url.parse(`https://${req.url}`)
port = parseInt(port)
if (isSslConnect(sslConnectInterceptors, req, cltSocket, head)) {
// 需要拦截,代替目标服务器,让客户端连接DS在本地启动的代理服务
fakeServerCenter.getServerPromise(hostname, port).then((serverObj) => {

6
packages/mitmproxy/src/lib/proxy/mitmproxy/index.js

@ -20,8 +20,7 @@ module.exports = {
middlewares = [],
externalProxy,
dnsConfig,
setting,
sniConfig
setting
}, callback) {
// Don't reject unauthorized
// process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
@ -76,8 +75,7 @@ module.exports = {
sslConnectInterceptor,
middlewares,
fakeServersCenter,
dnsConfig,
sniConfig
dnsConfig
)
const server = new http.Server()

1
packages/mitmproxy/src/options.js

@ -99,7 +99,6 @@ module.exports = (serverConfig) => {
speedTest: serverConfig.dns.speedTest
},
setting,
sniConfig: serverConfig.sniList,
middlewares,
sslConnectInterceptor: (req, cltSocket, head) => {
const hostname = req.url.split(':')[0]

Loading…
Cancel
Save