Skip to content

Commit

Permalink
http_proxy: unexport HTTPProxy.TLSConfig field
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mmatczuk committed Dec 19, 2023
1 parent 57d08e8 commit e63db25
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions http_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit e63db25

Please sign in to comment.