Documentation ¶
Index ¶
- type NbrPeers
- func (this *NbrPeers) AddNbrNode(p *Peer)
- func (this *NbrPeers) Broadcast(msg types.Message, isConsensus bool)
- func (this *NbrPeers) DelNbrNode(id uint64) (*Peer, bool)
- func (this *NbrPeers) GetNbrNodeCnt() uint32
- func (this *NbrPeers) GetNeighborAddrs() []common.PeerAddr
- func (this *NbrPeers) GetNeighborHeights() map[uint64]uint64
- func (this *NbrPeers) GetNeighbors() []*Peer
- func (this *NbrPeers) GetPeer(id uint64) *Peer
- func (this *NbrPeers) Init()
- func (this *NbrPeers) NodeEstablished(id uint64) bool
- func (this *NbrPeers) NodeExisted(uid uint64) bool
- type Peer
- func (this *Peer) AttachConsChan(msgchan chan *types.MsgPayload)
- func (this *Peer) AttachSyncChan(msgchan chan *types.MsgPayload)
- func (this *Peer) CloseCons()
- func (this *Peer) CloseSync()
- func (this *Peer) DumpInfo()
- func (this *Peer) GetAddr() string
- func (this *Peer) GetAddr16() ([16]byte, error)
- func (this *Peer) GetConsConn() *conn.Link
- func (this *Peer) GetConsPort() uint16
- func (this *Peer) GetConsState() uint32
- func (this *Peer) GetContactTime() time.Time
- func (this *Peer) GetHeight() uint64
- func (this *Peer) GetHttpInfoPort() uint16
- func (this *Peer) GetHttpInfoState() bool
- func (this *Peer) GetID() uint64
- func (this *Peer) GetRelay() bool
- func (this *Peer) GetServices() uint64
- func (this *Peer) GetSyncPort() uint16
- func (this *Peer) GetSyncState() uint32
- func (this *Peer) GetTimeStamp() int64
- func (this *Peer) GetVersion() uint32
- func (this *Peer) Send(msg types.Message, isConsensus bool) error
- func (this *Peer) SendToCons(msg types.Message) error
- func (this *Peer) SendToSync(msg types.Message) error
- func (this *Peer) SetConsConn(consLink *conn.Link)
- func (this *Peer) SetConsPort(port uint16)
- func (this *Peer) SetConsState(state uint32)
- func (this *Peer) SetHeight(height uint64)
- func (this *Peer) SetHttpInfoPort(port uint16)
- func (this *Peer) SetHttpInfoState(httpInfo bool)
- func (this *Peer) SetSyncState(state uint32)
- func (this *Peer) UpdateInfo(t time.Time, version uint32, services uint64, syncPort uint16, consPort uint16, ...)
- type PeerCom
- func (this *PeerCom) GetConsPort() uint16
- func (this *PeerCom) GetHeight() uint64
- func (this *PeerCom) GetHttpInfoPort() uint16
- func (this *PeerCom) GetID() uint64
- func (this *PeerCom) GetRelay() bool
- func (this *PeerCom) GetServices() uint64
- func (this *PeerCom) GetSyncPort() uint16
- func (this *PeerCom) GetVersion() uint32
- func (this *PeerCom) SetConsPort(port uint16)
- func (this *PeerCom) SetHeight(height uint64)
- func (this *PeerCom) SetHttpInfoPort(port uint16)
- func (this *PeerCom) SetID(id uint64)
- func (this *PeerCom) SetRelay(relay bool)
- func (this *PeerCom) SetServices(services uint64)
- func (this *PeerCom) SetSyncPort(port uint16)
- func (this *PeerCom) SetVersion(version uint32)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NbrPeers ¶
NbrPeers: The neigbor list
func (*NbrPeers) AddNbrNode ¶
AddNbrNode add peer to nbr list
func (*NbrPeers) DelNbrNode ¶
DelNbrNode delete peer from nbr list
func (*NbrPeers) GetNbrNodeCnt ¶
GetNbrNodeCnt return count of establish peers in nbrlist
func (*NbrPeers) GetNeighborAddrs ¶
GetNeighborAddrs return all establish peer address
func (*NbrPeers) GetNeighborHeights ¶
GetNeighborHeights return the id-height map of nbr peers
func (*NbrPeers) GetNeighbors ¶
GetNeighbors return all establish peers in nbr list
func (*NbrPeers) NodeEstablished ¶
NodeEstablished whether peer established according to id
func (*NbrPeers) NodeExisted ¶
NodeExisted return when peer in nbr list
type Peer ¶
type Peer struct { SyncLink *conn.Link ConsLink *conn.Link // contains filtered or unexported fields }
Peer represent the node in p2p
func (*Peer) AttachConsChan ¶
func (this *Peer) AttachConsChan(msgchan chan *types.MsgPayload)
AttachConsChan set msg chan to consensus link
func (*Peer) AttachSyncChan ¶
func (this *Peer) AttachSyncChan(msgchan chan *types.MsgPayload)
AttachSyncChan set msg chan to sync link
func (*Peer) GetConsConn ¶
GetConsConn return consensus link
func (*Peer) GetConsPort ¶
GetConsPort return peer`s consensus port
func (*Peer) GetConsState ¶
GetConsState return peer`s consensus state
func (*Peer) GetContactTime ¶
GetContactTime return peer`s latest contact time in Time struct
func (*Peer) GetHttpInfoPort ¶
GetHttpInfoPort return peer`s httpinfo port
func (*Peer) GetHttpInfoState ¶
GetHttpInfoState return peer`s httpinfo state
func (*Peer) GetServices ¶
GetServices return peer`s service state
func (*Peer) GetSyncPort ¶
GetSyncPort return peer`s sync port
func (*Peer) GetTimeStamp ¶
GetTimeStamp return peer`s latest contact time in ticks
func (*Peer) SendToCons ¶
SendToCons call consensus link to send buffer
func (*Peer) SendToSync ¶
SendToSync call sync link to send buffer
func (*Peer) SetConsConn ¶
SetConsConn set consensue link to peer
func (*Peer) SetConsPort ¶
SetConsPort set peer`s consensus port
func (*Peer) SetConsState ¶
SetConsState set consensus state to peer
func (*Peer) SetHttpInfoPort ¶
SetHttpInfoPort set peer`s httpinfo port
func (*Peer) SetHttpInfoState ¶
SetHttpInfoState set peer`s httpinfo state
func (*Peer) SetSyncState ¶
SetSyncState set sync state to peer
type PeerCom ¶
type PeerCom struct {
// contains filtered or unexported fields
}
PeerCom provides the basic information of a peer
func (*PeerCom) GetConsPort ¶
GetConsPort returns a peer's consensus port
func (*PeerCom) GetHttpInfoPort ¶
GetHttpInfoPort returns a peer's http info port
func (*PeerCom) GetServices ¶
GetServices returns a peer's services
func (*PeerCom) GetSyncPort ¶
GetSyncPort returns a peer's sync port
func (*PeerCom) GetVersion ¶
GetVersion returns a peer's version
func (*PeerCom) SetConsPort ¶
SetConsPort sets a peer's consensus port
func (*PeerCom) SetHttpInfoPort ¶
SetHttpInfoPort sets a peer's http info port
func (*PeerCom) SetServices ¶
SetServices sets a peer's services
func (*PeerCom) SetSyncPort ¶
SetSyncPort sets a peer's sync port
func (*PeerCom) SetVersion ¶
SetVersion sets a peer's version