8ad17775fa
We already configure a timeout in the underlying dialer, hence there's no point in keeping the TimeoutDialer around. Part of https://github.com/ooni/probe/issues/1507
25 lines
550 B
Go
25 lines
550 B
Go
package dialer
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
"time"
|
|
)
|
|
|
|
// underlyingDialer is the underlying net.Dialer.
|
|
var underlyingDialer = &net.Dialer{
|
|
Timeout: 15 * time.Second,
|
|
KeepAlive: 15 * time.Second,
|
|
}
|
|
|
|
// SystemDialer is the system dialer.
|
|
type SystemDialer struct{}
|
|
|
|
// DialContext implements Dialer.DialContext
|
|
func (d SystemDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) {
|
|
return underlyingDialer.DialContext(ctx, network, address)
|
|
}
|
|
|
|
// Default is the dialer we use by default.
|
|
var Default = SystemDialer{}
|