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

pull/375/head
王良 2024-10-16 16:56:29 +08:00
parent d97ec57797
commit 938ca58421
5 changed files with 6 additions and 15 deletions

View File

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

View File

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

View File

@ -17,7 +17,7 @@ function isSslConnect (sslConnectInterceptors, req, cltSocket, head) {
} }
// create connectHandler function // create connectHandler function
module.exports = function createConnectHandler (sslConnectInterceptor, middlewares, fakeServerCenter, dnsConfig, sniConfig) { module.exports = function createConnectHandler (sslConnectInterceptor, middlewares, fakeServerCenter, dnsConfig) {
// return // return
const sslConnectInterceptors = [] const sslConnectInterceptors = []
sslConnectInterceptors.push(sslConnectInterceptor) 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) { return function connectHandler (req, cltSocket, head) {
// eslint-disable-next-line node/no-deprecated-api // 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)) { if (isSslConnect(sslConnectInterceptors, req, cltSocket, head)) {
// 需要拦截代替目标服务器让客户端连接DS在本地启动的代理服务 // 需要拦截代替目标服务器让客户端连接DS在本地启动的代理服务
fakeServerCenter.getServerPromise(hostname, port).then((serverObj) => { fakeServerCenter.getServerPromise(hostname, port).then((serverObj) => {

View File

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

View File

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