mitm 内部服务器设置 socket 尽快关闭

addon-dailer
lqqyt2423 4 years ago
parent 315b163dfd
commit b86c05f093

@ -4,7 +4,6 @@ import (
"crypto/tls" "crypto/tls"
"net" "net"
"net/http" "net/http"
"time"
"github.com/lqqyt2423/go-mitmproxy/cert" "github.com/lqqyt2423/go-mitmproxy/cert"
) )
@ -46,7 +45,6 @@ func NewMitmServer(proxy *Proxy) (Mitm, error) {
} }
server := &http.Server{ server := &http.Server{
IdleTimeout: time.Millisecond * 100, // 尽快关闭内部的连接,释放文件描述符
Handler: m, Handler: m,
TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler)), // disable http2 TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler)), // disable http2
TLSConfig: &tls.Config{ TLSConfig: &tls.Config{
@ -57,6 +55,9 @@ func NewMitmServer(proxy *Proxy) (Mitm, error) {
}, },
} }
// 尽快关闭内部的连接,释放文件描述符
server.SetKeepAlivesEnabled(false)
m.Server = server m.Server = server
return m, nil return m, nil

Loading…
Cancel
Save