Documentation ¶
Index ¶
- type Conn
- type NbrPeers
- func (this *NbrPeers) Broadcast(msg types.Message)
- func (this *NbrPeers) GetNbrNodeCnt() uint32
- func (this *NbrPeers) GetNeighborAddrs() []common.PeerAddr
- func (this *NbrPeers) GetNeighborHeights() map[common.PeerId]uint64
- func (this *NbrPeers) GetNeighborMostHeight() uint64
- func (this *NbrPeers) GetNeighbors() []*peer.Peer
- func (this *NbrPeers) GetPeer(id common.PeerId) *peer.Peer
- func (this *NbrPeers) NodeExisted(uid common.PeerId) bool
- func (self *NbrPeers) ReplacePeer(p *peer.Peer, net *NetServer) *peer.Peer
- type NetServer
- func (this *NetServer) Broadcast(msg types.Message)
- func (this *NetServer) Connect(addr string)
- func (ns *NetServer) ConnectController() *connect_controller.ConnectController
- func (this *NetServer) GetConnectionCnt() uint32
- func (this *NetServer) GetHostInfo() *peer.PeerInfo
- func (this *NetServer) GetID() common.PeerId
- func (this *NetServer) GetMaxPeerBlockHeight() uint64
- func (this *NetServer) GetNeighborAddrs() []common.PeerAddr
- func (this *NetServer) GetNeighbors() []*peer.Peer
- func (this *NetServer) GetOutConnRecordLen() uint
- func (this *NetServer) GetPeer(id common.PeerId) *peer.Peer
- func (self *NetServer) GetSubnetMembersInfo() []common.SubnetMemberInfo
- func (this *NetServer) IsOwnAddress(addr string) bool
- func (ns *NetServer) Protocol() p2p.Protocol
- func (this *NetServer) ReplacePeer(remotePeer *peer.Peer)
- func (this *NetServer) Send(p *peer.Peer, msg types.Message) error
- func (this *NetServer) SendTo(p common.PeerId, msg types.Message)
- func (this *NetServer) SetHeight(height uint64)
- func (this *NetServer) Start() error
- func (this *NetServer) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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) GetNbrNodeCnt ¶ added in v1.10.0
GetNbrNodeCnt return count of establish peers in nbrlist
func (*NbrPeers) GetNeighborAddrs ¶ added in v1.10.0
GetNeighborAddrs return all establish Peer address
func (*NbrPeers) GetNeighborHeights ¶ added in v1.10.0
GetNeighborHeights return the id-height map of nbr peers
func (*NbrPeers) GetNeighborMostHeight ¶ added in v1.10.0
GetNeighborMostHeight return the most height of nbr peers
func (*NbrPeers) GetNeighbors ¶ added in v1.10.0
GetNeighbors return all establish peers in nbr list
func (*NbrPeers) NodeExisted ¶ added in v1.10.0
NodeExisted return when Peer in nbr list
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 NewNetServer ¶
func NewNetServer(protocol p2p.Protocol, conf *config.P2PNodeConfig, reserveAddrFilter p2p.AddressFilter) (*NetServer, error)
NewNetServer return the net object in p2p
func (*NetServer) ConnectController ¶ added in v1.10.0
func (ns *NetServer) ConnectController() *connect_controller.ConnectController
func (*NetServer) GetConnectionCnt ¶
GetConnectionCnt return the total number of valid connections
func (*NetServer) GetHostInfo ¶ added in v1.10.0
GetVersion return self peer`s version
func (*NetServer) GetMaxPeerBlockHeight ¶ added in v1.8.1
GetMaxPeerBlockHeight return the most height of valid connections
func (*NetServer) GetNeighborAddrs ¶
GetNeighborAddrs return all the nbr peer`s addr
func (*NetServer) GetNeighbors ¶
GetNeighbors return all nbr peer
func (*NetServer) GetOutConnRecordLen ¶ added in v0.9.2
GetOutConnRecordLen return length of outConnRecord
func (*NetServer) GetSubnetMembersInfo ¶ added in v1.11.0
func (self *NetServer) GetSubnetMembersInfo() []common.SubnetMemberInfo
func (*NetServer) IsOwnAddress ¶ added in v0.9.3
check own network address