From e63db253726063782ceb486343336ddad9d3c792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Matczuk?= Date: Tue, 19 Dec 2023 12:30:40 +0100 Subject: [PATCH] http_proxy: unexport HTTPProxy.TLSConfig field The TLSConfig is not read, it's used in listen and set on construction. The field is moved above the listener to reflect the creation order. --- http_proxy.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/http_proxy.go b/http_proxy.go index 58479b27..c0c598b3 100644 --- a/http_proxy.go +++ b/http_proxy.go @@ -144,9 +144,9 @@ type HTTPProxy struct { proxy *martian.Proxy mitmCACert *x509.Certificate proxyFunc ProxyFunc - listener net.Listener - TLSConfig *tls.Config + tlsConfig *tls.Config + listener net.Listener } // NewHTTPProxy creates a new HTTP proxy. @@ -224,9 +224,9 @@ func (hp *HTTPProxy) configureHTTPS() error { hp.log.Debugf("loading TLS certificate from %s and %s", hp.config.CertFile, hp.config.KeyFile) } - hp.TLSConfig = httpsTLSConfigTemplate() + hp.tlsConfig = httpsTLSConfigTemplate() - return hp.config.ConfigureTLSConfig(hp.TLSConfig) + return hp.config.ConfigureTLSConfig(hp.tlsConfig) } func (hp *HTTPProxy) configureProxy() error { @@ -615,7 +615,7 @@ func (hp *HTTPProxy) listen() (net.Listener, error) { case HTTPScheme: return listener, nil case HTTPSScheme, HTTP2Scheme: - return tls.NewListener(listener, hp.TLSConfig), nil + return tls.NewListener(listener, hp.tlsConfig), nil default: listener.Close() return nil, fmt.Errorf("invalid protocol %q", hp.config.Protocol)