testnet

package module
v0.0.0-...-cc5f457 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: MIT Imports: 6 Imported by: 0

README

testnet-go

testnet-go provides helper function to easily write benchmark and test code about network.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufioConn

type BufioConn struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

BufioConn implements the net.Conn and dicard the read but holds the write data.

func NewBufioConn

func NewBufioConn(d []byte) *BufioConn

NewBufioConn returns a new bufio connection.

func (*BufioConn) Bytes

func (c *BufioConn) Bytes() []byte

Bytes return the buffer.

func (*BufioConn) Close

func (c *BufioConn) Close() error

Close does nothing.

func (*BufioConn) LocalAddr

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

LocalAddr returns the local address.

func (*BufioConn) Read

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

Read do nothing.

func (*BufioConn) RemoteAddr

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

RemoteAddr returns the remote address.

func (*BufioConn) Reset

func (c *BufioConn) Reset()

Reset resets the connection buffer.

func (*BufioConn) SetDeadline

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

SetDeadline sets the deadline.

func (*BufioConn) SetReadDeadline

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

SetReadDeadline sets the deadline.

func (*BufioConn) SetWriteDeadline

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

SetWriteDeadline sets the deadline.

func (*BufioConn) Write

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

Write writes to the buffer.

type DataConn

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

DataConn implements the net.Conn interface which writes to nil and reads from data.

func NewDataConn

func NewDataConn(data []byte) *DataConn

NewDataConn returns a new DataConn.

func (*DataConn) Close

func (c *DataConn) Close() error

Close does nothing.

func (*DataConn) LocalAddr

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

LocalAddr returns the local address.

func (*DataConn) Read

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

Read reads to b.

func (*DataConn) RemoteAddr

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

RemoteAddr returns the remote address.

func (*DataConn) SetDeadline

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

SetDeadline sets the deadline.

func (*DataConn) SetReadDeadline

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

SetReadDeadline sets the read deadline.

func (*DataConn) SetWriteDeadline

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

SetWriteDeadline sets the write deadline.

func (*DataConn) Write

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

Read write to nil.

type DataListener

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

DataListener implements the net.Listener interface and prepares the connections to accept.

func NewDataListener

func NewDataListener() *DataListener

NewDataListener returns a data listener.

func (*DataListener) Accept

func (ml *DataListener) Accept() (net.Conn, error)

Accept accepts a connection from the listener.

func (*DataListener) AddConn

func (ml *DataListener) AddConn(c net.Conn)

AddConn adds a connection to listener.

func (DataListener) Addr

func (ml DataListener) Addr() net.Addr

Addr returns the address.

func (DataListener) Close

func (ml DataListener) Close() error

Close does nothing.

type MultiConn

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

func NewMultiConn

func NewMultiConn(r io.ReadCloser, w io.WriteCloser) *MultiConn

func (*MultiConn) Close

func (mc *MultiConn) Close() error

func (*MultiConn) LocalAddr

func (mc *MultiConn) LocalAddr() net.Addr

func (*MultiConn) Read

func (mc *MultiConn) Read(b []byte) (n int, err error)

func (*MultiConn) RemoteAddr

func (mc *MultiConn) RemoteAddr() net.Addr

func (*MultiConn) SetDeadline

func (mc *MultiConn) SetDeadline(t time.Time) error

func (*MultiConn) SetReadDeadline

func (mc *MultiConn) SetReadDeadline(t time.Time) error

func (*MultiConn) SetWriteDeadline

func (mc *MultiConn) SetWriteDeadline(t time.Time) error

func (*MultiConn) Write

func (mc *MultiConn) Write(b []byte) (n int, err error)

type NopCloser

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

func NewNopCloser

func NewNopCloser(w io.Writer) *NopCloser

func (*NopCloser) Close

func (nc *NopCloser) Close() error

func (*NopCloser) Write

func (nc *NopCloser) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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