github.com/x04/go/src@v0.0.0-20200202162449-3d481ceb3525/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 ( 8 "github.com/x04/go/src/context" 9 "github.com/x04/go/src/time" 10 ) 11 12 var ( 13 // if non-nil, overrides dialTCP. 14 testHookDialTCP func(ctx context.Context, net string, laddr, raddr *TCPAddr) (*TCPConn, error) 15 16 testHookHostsPath = "/etc/hosts" 17 testHookLookupIP = func( 18 ctx context.Context, 19 fn func(context.Context, string, string) ([]IPAddr, error), 20 network string, 21 host string, 22 ) ([]IPAddr, error) { 23 return fn(ctx, network, host) 24 } 25 testHookSetKeepAlive = func(time.Duration) {} 26 )