| 1 |
package types |
| 2 |
|
| 3 |
import ( |
| 4 |
"context" |
| 5 |
"net" |
| 6 |
) |
| 7 |
|
| 8 |
// DialContextFunc is the signature of [net.Dialer.DialContext] and |
| 9 |
// [http.Transport.DialContext]. |
| 10 |
// |
| 11 |
// Implementations must be safe for concurrent use. A nil value means the |
| 12 |
// service should use its default dialer. |
| 13 |
type DialContextFunc func(ctx context.Context, network, addr string) (net.Conn, error) |
| 14 |
|
| 15 |
// DialContextSetter is implemented by services that accept a custom TCP dial |
| 16 |
// function for non-HTTP connections. This enables callers to control egress |
| 17 |
// and destination policy without global side effects. |
| 18 |
type DialContextSetter interface { |
| 19 |
SetDialContext(dial DialContextFunc) |
| 20 |
} |