hook.go 628 B

1234567891011121314151617181920212223242526
  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. package net
  5. import (
  6. "context"
  7. "time"
  8. )
  9. var (
  10. // if non-nil, overrides dialTCP.
  11. testHookDialTCP func(ctx context.Context, net string, laddr, raddr *TCPAddr) (*TCPConn, error)
  12. testHookHostsPath = "/etc/hosts"
  13. testHookLookupIP = func(
  14. ctx context.Context,
  15. fn func(context.Context, string, string) ([]IPAddr, error),
  16. network string,
  17. host string,
  18. ) ([]IPAddr, error) {
  19. return fn(ctx, network, host)
  20. }
  21. testHookSetKeepAlive = func(time.Duration) {}
  22. )