github.com/epfl-dcsl/gotee@v0.0.0-20200909122901-014b35f5e5e9/src/gnet/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 gnet 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 )