mock

package
v100.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 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 Peer

type Peer struct {
	*service.BaseService

	Outbound, Persistent bool
	// contains filtered or unexported fields
}

func NewPeer

func NewPeer(ip net.IP) *Peer

NewPeer creates and starts a new mock peer. If the ip is nil, random routable address is used.

func (*Peer) CloseConn

func (*Peer) CloseConn() error

func (*Peer) FlushStop

func (mp *Peer) FlushStop()

func (*Peer) Get

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

func (*Peer) GetRemovalFailed

func (*Peer) GetRemovalFailed() bool

func (*Peer) ID

func (mp *Peer) ID() p2p.ID

func (*Peer) IsOutbound

func (mp *Peer) IsOutbound() bool

func (*Peer) IsPersistent

func (mp *Peer) IsPersistent() bool

func (*Peer) NodeInfo

func (mp *Peer) NodeInfo() p2p.NodeInfo

func (*Peer) RemoteAddr

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

func (*Peer) RemoteIP

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

func (*Peer) Send

func (*Peer) Send(_ p2p.Envelope) bool

func (*Peer) Set

func (mp *Peer) Set(key string, value any)

func (*Peer) SetRemovalFailed

func (*Peer) SetRemovalFailed()

func (*Peer) SocketAddr

func (mp *Peer) SocketAddr() *p2p.NetAddress

func (*Peer) Status

func (*Peer) Status() conn.ConnectionStatus

func (*Peer) TrySend

func (*Peer) TrySend(_ p2p.Envelope) bool

type Reactor

type Reactor struct {
	p2p.BaseReactor

	Channels []*conn.ChannelDescriptor
}

func NewReactor

func NewReactor() *Reactor

func (*Reactor) AddPeer

func (*Reactor) AddPeer(_ p2p.Peer)

func (*Reactor) GetChannels

func (r *Reactor) GetChannels() []*conn.ChannelDescriptor

func (*Reactor) Receive

func (*Reactor) Receive(_ p2p.Envelope)

func (*Reactor) RemovePeer

func (*Reactor) RemovePeer(_ p2p.Peer, _ any)

Jump to

Keyboard shortcuts

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