Imports #
"syscall"
"syscall"
"bytes"
"encoding/binary"
"io"
"math/rand"
"net"
"runtime"
"sync"
"testing"
"time"
"errors"
"fmt"
"net"
"os"
"os/exec"
"runtime"
"strconv"
"strings"
"sync"
"time"
"syscall"
"syscall"
"bytes"
"encoding/binary"
"io"
"math/rand"
"net"
"runtime"
"sync"
"testing"
"time"
"errors"
"fmt"
"net"
"os"
"os/exec"
"runtime"
"strconv"
"strings"
"sync"
"time"
var aLongTimeAgo = *ast.CallExpr
var canListenTCP4OnLoopback bool
var canListenTCP6OnLoopback bool
var errNoAvailableAddress = *ast.CallExpr
var errNoAvailableInterface = *ast.CallExpr
var ipv4Enabled bool
var ipv6Enabled bool
var neverTimeout = time.Time{...}
var rawSocketSess bool
var stackOnce sync.Once
var unStrmDgramEnabled bool
MakePipe creates a connection between two endpoints and returns the pair as c1 and c2, such that anything written to c1 is read by c2 and vice-versa. The stop function closes all resources, including c1, c2, and the underlying net.Listener (if there is one), and should not be nil.
type MakePipe func() (c1 net.Conn, c2 net.Conn, stop func(), err error)
type connTester func(t *testing.T, c1 net.Conn, c2 net.Conn)
LocalPath returns a local path that can be used for Unix-domain protocol testing.
func LocalPath() (string, error)
LoopbackInterface returns an available logical network interface for loopback test.
func LoopbackInterface() (*net.Interface, error)
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 MulticastSource(network string, ifi *net.Interface) (net.IP, error)
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 NewLocalListener(network string) (net.Listener, 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 NewLocalPacketListener(network string) (net.PacketConn, error)
RoutedInterface returns a network interface that can route IP traffic and satisfies flags. The provided network must be "ip", "ip4" or "ip6".
func RoutedInterface(network string, flags net.Flags) (*net.Interface, error)
SupportsIPv4 reports whether the platform supports IPv4 networking functionality.
func SupportsIPv4() bool
SupportsIPv6 reports whether the platform supports IPv6 networking functionality.
func SupportsIPv6() bool
SupportsRawSocket reports whether the current session is available to use raw sockets.
func SupportsRawSocket() bool
checkForTimeoutError checks that the error satisfies the Error interface and that Timeout returns true.
func checkForTimeoutError(t *testing.T, err error)
chunkedCopy copies from r to w in fixed-width chunks to avoid causing a Write that exceeds the maximum packet size for packet-based connections like "unixpacket". We assume that the maximum packet size is at least 1024.
func chunkedCopy(w io.Writer, r io.Reader) error
func hasRoutableIP(network string, ifi *net.Interface) (net.IP, bool)
func probeStack()
resyncConn resynchronizes the connection into a sane state. It assumes that everything written into c is echoed back to itself. It assumes that 0xff is not currently on the wire or in the read buffer.
func resyncConn(t *testing.T, c net.Conn)
func routableIP(network string, ip net.IP) (net.IP, bool)
func supportsRawSocket() bool
func supportsRawSocket() bool
func supportsRawSocket() bool
testBasicIO tests that the data sent on c1 is properly received on c2.
func testBasicIO(t *testing.T, c1 net.Conn, c2 net.Conn)
testCloseTimeout tests that calling Close immediately times out pending Read and Write operations.
func testCloseTimeout(t *testing.T, c1 net.Conn, c2 net.Conn)
testConcurrentMethods tests that the methods of net.Conn can safely be called concurrently.
func testConcurrentMethods(t *testing.T, c1 net.Conn, c2 net.Conn)
testFutureTimeout tests that a future deadline will eventually time out Read and Write operations.
func testFutureTimeout(t *testing.T, c1 net.Conn, c2 net.Conn)
testPastTimeout tests that a deadline set in the past immediately times out Read and Write requests.
func testPastTimeout(t *testing.T, c1 net.Conn, c2 net.Conn)
testPingPong tests that the two endpoints can synchronously send data to each other in a typical request-response pattern.
func testPingPong(t *testing.T, c1 net.Conn, c2 net.Conn)
testPresentTimeout tests that a past deadline set while there are pending Read and Write operations immediately times out those operations.
func testPresentTimeout(t *testing.T, c1 net.Conn, c2 net.Conn)
testRacyRead tests that it is safe to mutate the input Read buffer immediately after cancelation has occurred.
func testRacyRead(t *testing.T, c1 net.Conn, c2 net.Conn)
testRacyWrite tests that it is safe to mutate the input Write buffer immediately after cancelation has occurred.
func testRacyWrite(t *testing.T, c1 net.Conn, c2 net.Conn)
testReadTimeout tests that Read timeouts do not affect Write.
func testReadTimeout(t *testing.T, c1 net.Conn, c2 net.Conn)
testRoundtrip writes something into c and reads it back. It assumes that everything written into c is echoed back to itself.
func testRoundtrip(t *testing.T, c net.Conn)
testWriteTimeout tests that Write timeouts do not affect Read.
func testWriteTimeout(t *testing.T, c1 net.Conn, c2 net.Conn)
func timeoutWrapper(t *testing.T, mp MakePipe, f connTester)
func unixStrmDgramEnabled() bool
Generated with Arrow