github.com/s1s1ty/go@v0.0.0-20180207192209-104445e3140f/src/net/hook.go (about)

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package net
     6  
     7  import "context"
     8  
     9  var (
    10  	// if non-nil, overrides dialTCP.
    11  	testHookDialTCP func(ctx context.Context, net string, laddr, raddr *TCPAddr) (*TCPConn, error)
    12  
    13  	testHookHostsPath = "/etc/hosts"
    14  	testHookLookupIP  = func(
    15  		ctx context.Context,
    16  		fn func(context.Context, string) ([]IPAddr, error),
    17  		host string,
    18  	) ([]IPAddr, error) {
    19  		return fn(ctx, host)
    20  	}
    21  	testHookSetKeepAlive = func() {}
    22  )