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 52a8632 commit 0c5920e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const log = require('../../../utils/util.log')
const DnsUtil = require('../../dns/index')
const localIP = '127.0.0.1'
const dnsLookup = require('./dnsLookup')
const jsonApi = require('../../../json')

function isSslConnect (sslConnectInterceptors, req, cltSocket, head) {
for (const intercept of sslConnectInterceptors) {
Expand Down Expand Up @@ -44,7 +45,7 @@ module.exports = function createConnectHandler (sslConnectInterceptor, middlewar
log.error(`----- fakeServer getServerPromise error: ${hostname}:${port}, error:`, e)
})
} else {
log.info(`未匹配到任何 sslConnectInterceptors,不拦截请求,直接连接目标服务器: ${hostname}:${port}, headers:`, req.headers)
log.info(`不拦截请求,直连目标服务器: ${hostname}:${port}, headers:`, jsonApi.stringify2(req.headers))
connect(req, cltSocket, head, hostname, port, dnsConfig, true)
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/mitmproxy/src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const path = require('path')
const fs = require('fs')
const lodash = require('lodash')
const scriptInterceptor = require('./lib/interceptor/impl/res/script')
const jsonApi = require('./json')

const { getTmpPacFilePath, downloadPacAsync, createOverwallMiddleware } = require('./lib/proxy/middleware/overwall')

Expand Down Expand Up @@ -110,7 +111,7 @@ module.exports = (serverConfig) => {
// 配置了白名单的域名,将跳过代理
const inWhiteList = matchUtil.matchHostname(whiteList, hostname, 'in whiteList') != null
if (inWhiteList) {
log.info(`为白名单域名,不拦截: ${hostname}, headers:`, req.headers)
log.info(`为白名单域名,不拦截: ${hostname}, headers:`, jsonApi.stringify2(req.headers))
return false // 不拦截
}

Expand Down

0 comments on commit 0c5920e

Please sign in to comment.