2021-06-08 19:40:17 +02:00
|
|
|
package dialer
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"net"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2021-06-08 21:56:57 +02:00
|
|
|
// underlyingDialer is the underlying net.Dialer.
|
|
|
|
var underlyingDialer = &net.Dialer{
|
2021-06-08 19:40:17 +02:00
|
|
|
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) {
|
2021-06-08 21:56:57 +02:00
|
|
|
return underlyingDialer.DialContext(ctx, network, address)
|
2021-06-08 19:40:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Default is the dialer we use by default.
|
|
|
|
var Default = SystemDialer{}
|