saucelabs / forwarder

Forwarder is a production-ready, fast MITM proxy with PAC support. It's suitable for debugging, intercepting and manipulating HTTP traffic. It's used as a core component of Sauce Labs Sauce Connect Proxy.
https://forwarder-proxy.io
Mozilla Public License 2.0
225 stars 13 forks source link

dialvia: add connect timeout #789

Closed Choraden closed 5 months ago

Choraden commented 5 months ago

Fixes #781

Choraden commented 5 months ago

Thinking about the http.Transport behaviour[1] maybe we should be doing the same. This is always set a constant 60s timeout not to leak any goroutines. After all we support context cancellation.

[1] https://cs.opensource.google/go/go/+/refs/tags/go1.22.2:src/net/http/transport.go;l=1727

mmatczuk commented 5 months ago

This looks good to me.

    newCtx, cancel := context.WithTimeout(ctx, 1*time.Minute)