fix: socks5 proxy not working on https target (#2228)

* fix: socks5 proxy not working on https target

* small name refactor

Co-authored-by: mzack <marco.rivoli.nvh@gmail.com>
dev
anykno 2022-07-01 18:01:00 +08:00 committed by GitHub
parent 476773ff8c
commit 73a0043f2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -221,6 +221,14 @@ func wrappedGet(options *types.Options, configuration *Configuration) (*retryabl
})
if proxyErr == nil {
transport.DialContext = dc.DialContext
transport.DialTLSContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
// upgrade proxy connection to tls
conn, err := dc.DialContext(ctx, network, addr)
if err != nil {
return nil, err
}
return tls.Client(conn, tlsConfig), nil
}
}
}