Skip to content

Commit

Permalink
日志小调整
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 committed Oct 17, 2024
1 parent a51ba69 commit 52a8632
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ module.exports = function createConnectHandler (sslConnectInterceptor, middlewar
})
} else {
log.info(`未匹配到任何 sslConnectInterceptors,不拦截请求,直接连接目标服务器: ${hostname}:${port}, headers:`, req.headers)
connect(req, cltSocket, head, hostname, port, dnsConfig)
connect(req, cltSocket, head, hostname, port, dnsConfig, true)
}
}
}

function connect (req, cltSocket, head, hostname, port, dnsConfig) {
function connect (req, cltSocket, head, hostname, port, dnsConfig = null, isDirect = false) {
// tunneling https
// log.info('connect:', hostname, port)
const start = new Date()
Expand All @@ -72,7 +72,7 @@ function connect (req, cltSocket, head, hostname, port, dnsConfig) {
cltSocket.write('HTTP/1.1 200 Connection Established\r\n' +
'Proxy-agent: dev-sidecar\r\n' +
'\r\n')
log.info('Proxy connect start:', hostport)
log.info(`Proxy connect start: ${isDirect ? '直连' : ''} ${hostport}`)
proxySocket.write(head)
proxySocket.pipe(cltSocket)

Expand Down

0 comments on commit 52a8632

Please sign in to comment.