2015-10-31 01:59:47 +01:00
|
|
|
// Copyright 2015 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package net
|
|
|
|
|
2019-01-18 20:04:36 +01:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"time"
|
|
|
|
)
|
2016-07-22 20:15:38 +02:00
|
|
|
|
2015-10-31 01:59:47 +01:00
|
|
|
var (
|
2016-07-22 20:15:38 +02:00
|
|
|
// if non-nil, overrides dialTCP.
|
|
|
|
testHookDialTCP func(ctx context.Context, net string, laddr, raddr *TCPAddr) (*TCPConn, error)
|
|
|
|
|
|
|
|
testHookHostsPath = "/etc/hosts"
|
|
|
|
testHookLookupIP = func(
|
|
|
|
ctx context.Context,
|
2019-01-18 20:04:36 +01:00
|
|
|
fn func(context.Context, string, string) ([]IPAddr, error),
|
|
|
|
network string,
|
2016-07-22 20:15:38 +02:00
|
|
|
host string,
|
|
|
|
) ([]IPAddr, error) {
|
2019-01-18 20:04:36 +01:00
|
|
|
return fn(ctx, network, host)
|
2016-07-22 20:15:38 +02:00
|
|
|
}
|
2019-01-18 20:04:36 +01:00
|
|
|
testHookSetKeepAlive = func(time.Duration) {}
|
2015-10-31 01:59:47 +01:00
|
|
|
)
|