Browse Source

日志优化。

pull/376/head
王良 1 month ago
parent
commit
0c5920ee1b
  1. 3
      packages/mitmproxy/src/lib/proxy/mitmproxy/createConnectHandler.js
  2. 3
      packages/mitmproxy/src/options.js

3
packages/mitmproxy/src/lib/proxy/mitmproxy/createConnectHandler.js

@ -4,6 +4,7 @@ const log = require('../../../utils/util.log')
const DnsUtil = require('../../dns/index') const DnsUtil = require('../../dns/index')
const localIP = '127.0.0.1' const localIP = '127.0.0.1'
const dnsLookup = require('./dnsLookup') const dnsLookup = require('./dnsLookup')
const jsonApi = require('../../../json')
function isSslConnect (sslConnectInterceptors, req, cltSocket, head) { function isSslConnect (sslConnectInterceptors, req, cltSocket, head) {
for (const intercept of sslConnectInterceptors) { for (const intercept of sslConnectInterceptors) {
@ -44,7 +45,7 @@ module.exports = function createConnectHandler (sslConnectInterceptor, middlewar
log.error(`----- fakeServer getServerPromise error: ${hostname}:${port}, error:`, e) log.error(`----- fakeServer getServerPromise error: ${hostname}:${port}, error:`, e)
}) })
} else { } 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) connect(req, cltSocket, head, hostname, port, dnsConfig, true)
} }
} }

3
packages/mitmproxy/src/options.js

@ -6,6 +6,7 @@ const path = require('path')
const fs = require('fs') const fs = require('fs')
const lodash = require('lodash') const lodash = require('lodash')
const scriptInterceptor = require('./lib/interceptor/impl/res/script') const scriptInterceptor = require('./lib/interceptor/impl/res/script')
const jsonApi = require('./json')
const { getTmpPacFilePath, downloadPacAsync, createOverwallMiddleware } = require('./lib/proxy/middleware/overwall') const { getTmpPacFilePath, downloadPacAsync, createOverwallMiddleware } = require('./lib/proxy/middleware/overwall')
@ -110,7 +111,7 @@ module.exports = (serverConfig) => {
// 配置了白名单的域名,将跳过代理 // 配置了白名单的域名,将跳过代理
const inWhiteList = matchUtil.matchHostname(whiteList, hostname, 'in whiteList') != null const inWhiteList = matchUtil.matchHostname(whiteList, hostname, 'in whiteList') != null
if (inWhiteList) { if (inWhiteList) {
log.info(`为白名单域名,不拦截: ${hostname}, headers:`, req.headers) log.info(`为白名单域名,不拦截: ${hostname}, headers:`, jsonApi.stringify2(req.headers))
return false // 不拦截 return false // 不拦截
} }

Loading…
Cancel
Save