From 412707b7232800150b1a9497f0e42dee975ca41f Mon Sep 17 00:00:00 2001 From: lqqyt2423 <974923609@qq.com> Date: Mon, 7 Dec 2020 17:41:58 +0800 Subject: [PATCH] debug --- README.md | 1 + proxy/mitm.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index a1506cb..2d47003 100644 --- a/README.md +++ b/README.md @@ -9,3 +9,4 @@ - [ ] cert - [ ] https handler - [ ] http2 +- [ ] logger diff --git a/proxy/mitm.go b/proxy/mitm.go index 25dc0b4..08d131f 100644 --- a/proxy/mitm.go +++ b/proxy/mitm.go @@ -5,6 +5,7 @@ import ( "log" "net" "net/http" + "time" "github.com/lqqyt2423/go-mitmproxy/cert" ) @@ -26,6 +27,7 @@ func (m *MitmForward) Dial(host string) (net.Conn, error) { } // 内部解析 https 流量 +// 每个连接都会消耗掉两个文件描述符,可能会达到打开文件上限 type MitmServer struct { Proxy *Proxy CA *cert.CA @@ -45,6 +47,7 @@ func NewMitmServer(proxy *Proxy) (Mitm, error) { } server := &http.Server{ + IdleTimeout: time.Millisecond * 100, // 尽快关闭内部的连接,释放文件描述符 Handler: m, TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler)), // disable http2 TLSConfig: &tls.Config{