netserver

package
v1.13.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: LGPL-3.0 Imports: 13 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn added in v1.10.0

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

Conn is a net.Conn wrapper to do some clean up when Close.

func (*Conn) Close added in v1.10.0

func (self *Conn) Close() error

Close overwrite net.Conn

type NbrPeers added in v1.10.0

type NbrPeers struct {
	sync.RWMutex
	List map[common.PeerId]connectedPeer
	// contains filtered or unexported fields
}

NbrPeers: The neigbor list

func NewNbrPeers added in v1.10.0

func NewNbrPeers() *NbrPeers

func (*NbrPeers) Broadcast added in v1.10.0

func (this *NbrPeers) Broadcast(msg types.Message)

Broadcast tranfer msg buffer to all establish Peer

func (*NbrPeers) GetNbrNodeCnt added in v1.10.0

func (this *NbrPeers) GetNbrNodeCnt() uint32

GetNbrNodeCnt return count of establish peers in nbrlist

func (*NbrPeers) GetNeighborAddrs added in v1.10.0

func (this *NbrPeers) GetNeighborAddrs() []common.PeerAddr

GetNeighborAddrs return all establish Peer address

func (*NbrPeers) GetNeighborHeights added in v1.10.0

func (this *NbrPeers) GetNeighborHeights() map[common.PeerId]uint64

GetNeighborHeights return the id-height map of nbr peers

func (*NbrPeers) GetNeighborMostHeight added in v1.10.0

func (this *NbrPeers) GetNeighborMostHeight() uint64

GetNeighborMostHeight return the most height of nbr peers

func (*NbrPeers) GetNeighbors added in v1.10.0

func (this *NbrPeers) GetNeighbors() []*peer.Peer

GetNeighbors return all establish peers in nbr list

func (*NbrPeers) GetPeer added in v1.10.0

func (this *NbrPeers) GetPeer(id common.PeerId) *peer.Peer

GetPeer return Peer according to id

func (*NbrPeers) NodeExisted added in v1.10.0

func (this *NbrPeers) NodeExisted(uid common.PeerId) bool

NodeExisted return when Peer in nbr list

func (*NbrPeers) ReplacePeer added in v1.10.0

func (self *NbrPeers) ReplacePeer(p *peer.Peer, net *NetServer) *peer.Peer

type NetServer

type NetServer struct {
	NetChan chan *types.MsgPayload
	Np      *NbrPeers
	// contains filtered or unexported fields
}

NetServer represent all the actions in net layer

func NewCustomNetServer added in v1.10.0

func NewCustomNetServer(id *common.PeerKeyId, info *peer.PeerInfo, proto p2p.Protocol,
	listener net.Listener, opt connect_controller.ConnCtrlOption, logger common.Logger) *NetServer

func NewNetServer

func NewNetServer(protocol p2p.Protocol, conf *config.P2PNodeConfig, reserveAddrFilter p2p.AddressFilter) (*NetServer, error)

NewNetServer return the net object in p2p

func (*NetServer) Broadcast added in v1.10.0

func (this *NetServer) Broadcast(msg types.Message)

Broadcast called by actor, broadcast msg

func (*NetServer) Connect

func (this *NetServer) Connect(addr string)

Connect used to connect net address under sync or cons mode

func (*NetServer) ConnectController added in v1.10.0

func (ns *NetServer) ConnectController() *connect_controller.ConnectController

func (*NetServer) GetConnectionCnt

func (this *NetServer) GetConnectionCnt() uint32

GetConnectionCnt return the total number of valid connections

func (*NetServer) GetHostInfo added in v1.10.0

func (this *NetServer) GetHostInfo() *peer.PeerInfo

GetVersion return self peer`s version

func (*NetServer) GetID

func (this *NetServer) GetID() common.PeerId

GetId return peer`s id

func (*NetServer) GetMaxPeerBlockHeight added in v1.8.1

func (this *NetServer) GetMaxPeerBlockHeight() uint64

GetMaxPeerBlockHeight return the most height of valid connections

func (*NetServer) GetNeighborAddrs

func (this *NetServer) GetNeighborAddrs() []common.PeerAddr

GetNeighborAddrs return all the nbr peer`s addr

func (*NetServer) GetNeighbors

func (this *NetServer) GetNeighbors() []*peer.Peer

GetNeighbors return all nbr peer

func (*NetServer) GetOutConnRecordLen added in v0.9.2

func (this *NetServer) GetOutConnRecordLen() uint

GetOutConnRecordLen return length of outConnRecord

func (*NetServer) GetPeer

func (this *NetServer) GetPeer(id common.PeerId) *peer.Peer

GetPeer returns a peer with the peer id

func (*NetServer) GetSubnetMembersInfo added in v1.11.0

func (self *NetServer) GetSubnetMembersInfo() []common.SubnetMemberInfo

func (*NetServer) IsOwnAddress added in v0.9.3

func (this *NetServer) IsOwnAddress(addr string) bool

check own network address

func (*NetServer) Protocol added in v1.10.0

func (ns *NetServer) Protocol() p2p.Protocol

func (*NetServer) ReplacePeer added in v1.10.0

func (this *NetServer) ReplacePeer(remotePeer *peer.Peer)

func (*NetServer) Send

func (this *NetServer) Send(p *peer.Peer, msg types.Message) error

Tx sendMsg data buf to peer

func (*NetServer) SendTo added in v1.10.0

func (this *NetServer) SendTo(p common.PeerId, msg types.Message)

func (*NetServer) SetHeight

func (this *NetServer) SetHeight(height uint64)

SetHeight sets the local's height

func (*NetServer) Start

func (this *NetServer) Start() error

InitListen start listening on the config port

func (*NetServer) Stop added in v1.10.0

func (this *NetServer) Stop()

Stop stop all net layer logic

Jump to

Keyboard shortcuts

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