1
0
mirror of https://github.com/golang/go synced 2024-10-04 15:11:20 -06:00
go/src/net/cgo_stub.go
Brad Fitzpatrick b615ad8fd5 net: add mechanisms to force go or cgo lookup, and to debug default strategy
GODEBUG=netdns=1 prints a one-time strategy decision. (cgo or go DNS lookups)
GODEBUG=netdns=2 prints the per-lookup strategy as a function of the hostname.

The new "netcgo" build tag forces cgo DNS lookups.

GODEBUG=netdns=go (or existing build tag "netgo") forces Go DNS resolution.
GODEBUG=netdns=cgo (or new build tag "netcgo") forces libc DNS resolution.

Options can be combined with e.g. GODEBUG=netdns=go+1 or GODEBUG=netdns=2+cgo.

Fixes #11322
Fixes #11450

Change-Id: I7a67e9f759fd0a02320e7803f9ded1638b19e861
Reviewed-on: https://go-review.googlesource.com/11584
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-09 22:19:41 +00:00

36 lines
952 B
Go

// Copyright 2011 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.
// +build !cgo netgo
package net
func init() { netGo = true }
type addrinfoErrno int
func (eai addrinfoErrno) Error() string { return "<nil>" }
func (eai addrinfoErrno) Temporary() bool { return false }
func (eai addrinfoErrno) Timeout() bool { return false }
func cgoLookupHost(name string) (addrs []string, err error, completed bool) {
return nil, nil, false
}
func cgoLookupPort(network, service string) (port int, err error, completed bool) {
return 0, nil, false
}
func cgoLookupIP(name string) (addrs []IPAddr, err error, completed bool) {
return nil, nil, false
}
func cgoLookupCNAME(name string) (cname string, err error, completed bool) {
return "", nil, false
}
func cgoLookupPTR(addr string) (ptrs []string, err error, completed bool) {
return nil, nil, false
}