From 52a86328fb61bb1c09f9d3a7e2c11b4bf0ef9c4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Thu, 17 Oct 2024 15:20:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=B0=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/proxy/mitmproxy/createConnectHandler.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/mitmproxy/src/lib/proxy/mitmproxy/createConnectHandler.js b/packages/mitmproxy/src/lib/proxy/mitmproxy/createConnectHandler.js index a7e0b32bfa..8a4a769df9 100644 --- a/packages/mitmproxy/src/lib/proxy/mitmproxy/createConnectHandler.js +++ b/packages/mitmproxy/src/lib/proxy/mitmproxy/createConnectHandler.js @@ -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() @@ -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)