fakeconn

package
v0.0.0-...-522cc97 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeConn

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

FakeConn is a faked connection which reads from a reader and writes to a writer.

func New

func New(name string, r io.Reader, w io.Writer) *FakeConn

func (*FakeConn) Close

func (c *FakeConn) Close() error

func (*FakeConn) LocalAddr

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

func (*FakeConn) Read

func (c *FakeConn) Read(b []byte) (n int, err error)

func (*FakeConn) RemoteAddr

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

func (*FakeConn) Run

func (c *FakeConn) Run()

Run runs FakeConn and blocks the current goroutine until c is closed. Calling Run twice or more causes undefined behavior.

Run starts 2 additional goroutines.

func (*FakeConn) SetDeadline

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

func (*FakeConn) SetReadDeadline

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

func (*FakeConn) SetWriteDeadline

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

func (*FakeConn) Write

func (c *FakeConn) Write(b []byte) (n int, err error)

type FakeListener

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

func NewFakeListener

func NewFakeListener(addr net.Addr) *FakeListener

NewFakeListener returns a newly allocated *FakeListener.

func (*FakeListener) Accept

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

func (*FakeListener) AddConn

func (l *FakeListener) AddConn(conn net.Conn)

AddConn adds

func (*FakeListener) Addr

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

Addr returns the listener's network address.

func (*FakeListener) Close

func (l *FakeListener) Close() error

Close closes the listener. Any blocked Accept operations will be unblocked and return errors.

Jump to

Keyboard shortcuts

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