0
1
mirror of https://github.com/golang/go synced 2025-02-24 04:05:04 +00:00
go/src/net/hook.go
Nikita Vaniasin 33d4a5105c net: respect hosts file when resolving names for Windows
Fixes #57757.

Change-Id: I896dae8e5905ae98539ab83c9379fd1c9886d44a
Reviewed-on: https://go-review.googlesource.com/c/go/+/467335
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
Run-TryBot: Mateusz Poliwczak <mpoliwczak34@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Joedian Reid <joedian@golang.org>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
2023-09-04 07:21:38 +00:00

32 lines
894 B
Go

// 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
import (
"context"
"time"
)
var (
// if non-nil, overrides dialTCP.
testHookDialTCP func(ctx context.Context, net string, laddr, raddr *TCPAddr) (*TCPConn, error)
testHookLookupIP = func(
ctx context.Context,
fn func(context.Context, string, string) ([]IPAddr, error),
network string,
host string,
) ([]IPAddr, error) {
return fn(ctx, network, host)
}
testHookSetKeepAlive = func(time.Duration) {}
// testHookStepTime sleeps until time has moved forward by a nonzero amount.
// This helps to avoid flakes in timeout tests by ensuring that an implausibly
// short deadline (such as 1ns in the future) is always expired by the time
// a relevant system call occurs.
testHookStepTime = func() {}
)