...

Source file src/net/hook.go

     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		"context"
     9		"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	)
    27	

View as plain text