mock

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0, UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	ReadFn             readDelegate
	WriteFn            writeDelegate
	CloseFn            closeDelegate
	LocalAddrFn        localAddrDelegate
	RemoteAddrFn       remoteAddrDelegate
	SetDeadlineFn      setDeadlineDelegate
	SetReadDeadlineFn  setDeadlineDelegate
	SetWriteDeadlineFn setDeadlineDelegate
}

func (*Conn) Close

func (m *Conn) Close() error

func (*Conn) LocalAddr

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

func (*Conn) Read

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

func (*Conn) RemoteAddr

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

func (*Conn) SetDeadline

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

func (*Conn) SetReadDeadline

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

func (*Conn) SetWriteDeadline

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

func (*Conn) Write

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

type MConn

type MConn struct {
	FlushFn   flushStopDelegate
	StartFn   startDelegate
	StopFn    stopDelegate
	SendFn    sendDelegate
	TrySendFn trySendDelegate
	StatusFn  statusDelegate
	StringFn  stringDelegate
}

func (*MConn) FlushStop

func (m *MConn) FlushStop()

func (*MConn) Send

func (m *MConn) Send(ch byte, data []byte) bool

func (*MConn) SetLogger

func (m *MConn) SetLogger(_ *slog.Logger)

func (*MConn) Start

func (m *MConn) Start() error

func (*MConn) Status

func (m *MConn) Status() conn.ConnectionStatus

func (*MConn) Stop

func (m *MConn) Stop() error

func (*MConn) String

func (m *MConn) String() string

func (*MConn) TrySend

func (m *MConn) TrySend(ch byte, data []byte) bool

type Peer

type Peer struct {
	service.BaseService

	FlushStopFn    flushStopDelegate
	IDFn           idDelegate
	RemoteIPFn     remoteIPDelegate
	RemoteAddrFn   remoteAddrDelegate
	IsOutboundFn   isOutboundDelegate
	IsPersistentFn isPersistentDelegate
	IsPrivateFn    isPrivateDelegate
	CloseConnFn    closeConnDelegate
	NodeInfoFn     nodeInfoDelegate
	StopFn         stopDelegate
	StatusFn       statusDelegate
	SocketAddrFn   socketAddrDelegate
	SendFn         sendDelegate
	TrySendFn      trySendDelegate
	SetFn          setDelegate
	GetFn          getDelegate
}

func GeneratePeers

func GeneratePeers(t *testing.T, count int) []*Peer

GeneratePeers generates random peers

func (*Peer) CloseConn

func (m *Peer) CloseConn() error

func (*Peer) FlushStop

func (m *Peer) FlushStop()

func (*Peer) Get

func (m *Peer) Get(key string) any

func (*Peer) ID

func (m *Peer) ID() types.ID

func (*Peer) IsOutbound

func (m *Peer) IsOutbound() bool

func (*Peer) IsPersistent

func (m *Peer) IsPersistent() bool

func (*Peer) IsPrivate

func (m *Peer) IsPrivate() bool

func (*Peer) NodeInfo

func (m *Peer) NodeInfo() types.NodeInfo

func (*Peer) RemoteAddr

func (m *Peer) RemoteAddr() net.Addr

func (*Peer) RemoteIP

func (m *Peer) RemoteIP() net.IP

func (*Peer) Send

func (m *Peer) Send(classifier byte, data []byte) bool

func (*Peer) Set

func (m *Peer) Set(key string, data any)

func (*Peer) SocketAddr

func (m *Peer) SocketAddr() *types.NetAddress

func (*Peer) Status

func (m *Peer) Status() conn.ConnectionStatus

func (*Peer) Stop

func (m *Peer) Stop() error

func (*Peer) TrySend

func (m *Peer) TrySend(classifier byte, data []byte) bool

Jump to

Keyboard shortcuts

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