fake

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2017 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

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

Addr is an implementation of net.Addr.

func NewAddr

func NewAddr(addr string) *Addr

NewAddr returns a Addr by receiving a custom network information.

func (*Addr) Network

func (a *Addr) Network() string

Network always returns "fake".

func (*Addr) String

func (a *Addr) String() string

String to return network information.

type Listener

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

Listener is an implementation of net.Listener. It receives incoming net.Conn through the Put method and returns net.Conn through the Accept method.

func NewListener

func NewListener(pool int) *Listener

NewListener returns a listener to build a net.Conn channel of pool size.

func (*Listener) Accept

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

Accept returns a net.Conn.

func (*Listener) Addr

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

Addr returns a fake addr.

func (*Listener) Close

func (l *Listener) Close() (err error)

Close all the net.Conn.

func (*Listener) IsClosed

func (l *Listener) IsClosed() bool

IsClosed returns true if listener is closed.

func (*Listener) Put

func (l *Listener) Put(conn net.Conn) (err error)

Put a net.Conn to listener.

Jump to

Keyboard shortcuts

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