sockettest

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package sockettest implements net.Listener and net.Conn types based on *socket.Conn for use in the package's tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn added in v0.3.0

type Conn struct {
	Conn *socket.Conn
	// contains filtered or unexported fields
}

A Conn is a net.Conn which can be extended with context support.

func Dial

func Dial(ctx context.Context, addr net.Addr, cfg *socket.Config) (*Conn, error)

Dial creates an IPv4 or IPv6 TCP net.Conn backed by a *socket.Conn with optional configuration.

func (*Conn) Close added in v0.3.0

func (c *Conn) Close() error

func (*Conn) CloseRead added in v0.3.0

func (c *Conn) CloseRead() error

func (*Conn) CloseWrite added in v0.3.0

func (c *Conn) CloseWrite() error

func (*Conn) Context added in v0.3.0

func (c *Conn) Context(ctx context.Context) *Conn

func (*Conn) LocalAddr added in v0.3.0

func (c *Conn) LocalAddr() net.Addr

func (*Conn) Read added in v0.3.0

func (c *Conn) Read(b []byte) (int, error)

func (*Conn) RemoteAddr added in v0.3.0

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) SetDeadline added in v0.3.0

func (c *Conn) SetDeadline(t time.Time) error

func (*Conn) SetReadDeadline added in v0.3.0

func (c *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetWriteDeadline added in v0.3.0

func (c *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) Write added in v0.3.0

func (c *Conn) Write(b []byte) (int, error)

type Listener added in v0.3.0

type Listener struct {
	// contains filtered or unexported fields
}

A Listener is a net.Listener which can be extended with context support.

func FileListener added in v0.2.0

func FileListener(f *os.File) (*Listener, error)

FileListener creates an IPv6 TCP net.Listener backed by a *socket.Conn from the input file.

func Listen

func Listen(port int, cfg *socket.Config) (*Listener, error)

Listen creates an IPv6 TCP net.Listener backed by a *socket.Conn on the specified port with optional configuration. Context ctx will be passed to accept and accepted connections.

func (*Listener) Accept added in v0.3.0

func (l *Listener) Accept() (net.Conn, error)

func (*Listener) Addr added in v0.3.0

func (l *Listener) Addr() net.Addr

func (*Listener) Close added in v0.3.0

func (l *Listener) Close() error

func (*Listener) Context added in v0.3.0

func (l *Listener) Context(ctx context.Context) *Listener

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL