Skip to content

Commit

Permalink
optimize: 移除 sniList 相关的代码,因为已经没在使用。
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 committed Oct 16, 2024
1 parent d97ec57 commit 938ca58
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 15 deletions.
3 changes: 0 additions & 3 deletions packages/core/src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,6 @@ module.exports = {
'*.baidu.com': true,
'192.168.*': true
},
sniList: {
// 'github.com': 'abaidu.com'
},
dns: {
providers: {
aliyun: {
Expand Down
3 changes: 0 additions & 3 deletions packages/gui/src/view/pages/server.vue
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ export default {
dnsMappings: [],
speedTestList: [],
whiteList: []
// sniList: []
}
},
created () {
Expand Down Expand Up @@ -277,15 +276,13 @@ export default {
ready () {
this.initDnsMapping()
this.initWhiteList()
// this.initSniList()
if (this.config.server.dns.speedTest.dnsProviders) {
this.speedDns = this.config.server.dns.speedTest.dnsProviders
}
},
async applyBefore () {
this.submitDnsMapping()
this.submitWhiteList()
// this.submitSniList()
},
async applyAfter () {
if (this.status.server.enabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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) => {
Expand Down
6 changes: 2 additions & 4 deletions packages/mitmproxy/src/lib/proxy/mitmproxy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ module.exports = {
middlewares = [],
externalProxy,
dnsConfig,
setting,
sniConfig
setting
}, callback) {
// Don't reject unauthorized
// process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
Expand Down Expand Up @@ -76,8 +75,7 @@ module.exports = {
sslConnectInterceptor,
middlewares,
fakeServersCenter,
dnsConfig,
sniConfig
dnsConfig
)

const server = new http.Server()
Expand Down
1 change: 0 additions & 1 deletion packages/mitmproxy/src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 938ca58

Please sign in to comment.