Documentation
¶
Overview ¶
Package testutil holds shared test helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Internet ¶
type Internet struct {
// contains filtered or unexported fields
}
Internet is a pretend public internet for tests of code behind a netguard.Guard: host names resolve to public addresses, and connections to them land on local test servers. The guard's rules stay untouched, so a test server is never reached through its real loopback address.
func (*Internet) Guard ¶
Guard returns a guard that resolves and connects through this internet. allowPrivate may be nil (private networks refused).
func (*Internet) Host ¶
Host makes name resolve to a public address served by the listener at addr (an httptest server's Listener.Addr().String()).
func (*Internet) LookupIPAddr ¶
LookupIPAddr implements netguard.Resolver.
func (*Internet) PrivateHost ¶
PrivateHost makes name resolve to an address of a private network.