loopback

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package loopback defines a net.PacketConn implementation where sent messages are echoed back on the same connection.

Index

Constants

View Source
const (
	// Number of packets that can fit into Conn buffers until the writer blocks
	PktBufferSize = 16
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

type Addr struct{}

Addr implements net.Addr. It always returns the same constant strings.

func (*Addr) Network

func (a *Addr) Network() string

Network always returns "loopback".

func (*Addr) String

func (a *Addr) String() string

String always returns "loopback address".

type Conn

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

Connects a client-server app to itself to simplify testing.

func New

func New() *Conn

New creates a new loopback connection with capacity PktBufferSize.

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) LocalAddr

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

LocalAddr always returns nil.

func (*Conn) ReadFrom

func (c *Conn) ReadFrom(b []byte) (int, net.Addr, error)

func (*Conn) SetDeadline

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

SetDeadline is a NOP.

func (*Conn) SetReadDeadline

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

SetReadDeadline is a NOP.

func (*Conn) SetWriteDeadline

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

SetWriteDeadline is a NOP.

func (*Conn) WriteTo

func (c *Conn) WriteTo(b []byte, a net.Addr) (int, error)

Jump to

Keyboard shortcuts

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