Documentation ¶
Overview ¶
Package nettest provides utilities for network testing.
Index ¶
- func LocalPath() (string, error)
- func LoopbackInterface() (*net.Interface, error)
- func MulticastSource(network string, ifi *net.Interface) (net.IP, error)
- func NewLocalListener(network string) (net.Listener, error)
- func NewLocalPacketListener(network string) (net.PacketConn, error)
- func RoutedInterface(network string, flags net.Flags) (*net.Interface, error)
- func SupportsIPv4() bool
- func SupportsIPv6() bool
- func SupportsRawSocket() bool
- func TestConn(t *testing.T, mp MakePipe)
- func TestableAddress(network, address string) bool
- func TestableNetwork(network string) bool
- type MakePipe
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoopbackInterface ¶
LoopbackInterface returns an available logical network interface for loopback test.
func MulticastSource ¶
MulticastSource returns a unicast IP address on ifi when ifi is an IP multicast-capable network interface.
The provided network must be "ip", "ip4" or "ip6".
func NewLocalListener ¶
NewLocalListener returns a listener which listens to a loopback IP address or local file system path.
The provided network must be "tcp", "tcp4", "tcp6", "unix" or "unixpacket".
func NewLocalPacketListener ¶
func NewLocalPacketListener(network string) (net.PacketConn, error)
NewLocalPacketListener returns a packet listener which listens to a loopback IP address or local file system path.
The provided network must be "udp", "udp4", "udp6" or "unixgram".
func RoutedInterface ¶
RoutedInterface returns a network interface that can route IP traffic and satisfies flags.
The provided network must be "ip", "ip4" or "ip6".
func SupportsIPv4 ¶
func SupportsIPv4() bool
SupportsIPv4 reports whether the platform supports IPv4 networking functionality.
func SupportsIPv6 ¶
func SupportsIPv6() bool
SupportsIPv6 reports whether the platform supports IPv6 networking functionality.
func SupportsRawSocket ¶
func SupportsRawSocket() bool
SupportsRawSocket reports whether the current session is available to use raw sockets.
func TestConn ¶
TestConn tests that a net.Conn implementation properly satisfies the interface. The tests should not produce any false positives, but may experience false negatives. Thus, some issues may only be detected when the test is run multiple times. For maximal effectiveness, run the tests under the race detector.
func TestableAddress ¶
TestableAddress reports whether address of network is testable on the current platform configuration.
func TestableNetwork ¶
TestableNetwork reports whether network is testable on the current platform configuration.
See func Dial of the standard library for the supported networks.