From 55b6755a8ab15bcc1314abc25a327de8061d9368 Mon Sep 17 00:00:00 2001 From: Brian Dwyer Date: Fri, 5 Mar 2021 11:40:58 -0500 Subject: [PATCH] Clean up dialer logic --- pkg/gontlm-proxy.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/gontlm-proxy.go b/pkg/gontlm-proxy.go index 3b8f454..9e2022e 100644 --- a/pkg/gontlm-proxy.go +++ b/pkg/gontlm-proxy.go @@ -78,18 +78,18 @@ func Run() { // // Proxy Dialer // - dialer := func(network, addr string) (net.Conn, error) { + proxy.Tr.DialContext = proxyplease.NewDialContext(proxyplease.Proxy{ + URL: proxyUrl, + Username: ProxyUser, + Password: ProxyPass, + Domain: ProxyDomain, + }) + proxy.ConnectDial = func(network, addr string) (net.Conn, error) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - return proxyplease.NewDialContext(proxyplease.Proxy{ - URL: proxyUrl, - Username: ProxyUser, - Password: ProxyPass, - Domain: ProxyDomain, - })(ctx, network, addr) + return proxy.Tr.DialContext(ctx, network, addr) } - proxy.ConnectDial = dialer - proxy.Tr.Dial = dialer + proxy.Tr.Proxy = nil //