Documentation ¶
Index ¶
- type FetchOutOfRangeState
- type NbrPeers
- func (this *NbrPeers) AddNbrNode(p *Peer)
- func (this *NbrPeers) Broadcast(mesg types.Message, isConsensus bool, magic uint32)
- func (this *NbrPeers) DelNbrNode(p *Peer) (*Peer, bool)
- func (this *NbrPeers) GetNbrNodeCnt() uint32
- func (this *NbrPeers) GetNeighborAddrs() []*types.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(log *logrus.Logger)
- func (this *Peer) GetAddr() string
- func (this *Peer) GetAddr16() ([16]byte, error)
- func (this *Peer) GetConsConn() *conn.Link
- func (this *Peer) GetConsPort() uint32
- func (this *Peer) GetConsState() uint32
- func (this *Peer) GetContactTime() time.Time
- func (this *Peer) GetHeight() uint64
- func (this *Peer) GetID() uint64
- func (this *Peer) GetLastSeenBlkNum() uint64
- func (this *Peer) GetRelay() bool
- func (this *Peer) GetServices() uint64
- func (this *Peer) GetSyncPort() uint32
- func (this *Peer) GetSyncState() uint32
- func (this *Peer) GetTimeStamp() int64
- func (this *Peer) GetVersion() uint32
- func (this *Peer) HasConsensusMsg(hash [common.HashSize]byte) bool
- func (this *Peer) HasTrx(hash []byte) bool
- func (this *Peer) IPv4() string
- func (this *Peer) LockBusy() bool
- func (this *Peer) LockBusyFetchingCP() bool
- func (this *Peer) Port() uint16
- func (this *Peer) RecordConsensusMsg(hash [common.HashSize]byte)
- func (this *Peer) RecordTrxCache(hash []byte)
- func (this *Peer) Send(msg types.Message, isConsensus bool, magic uint32) error
- func (this *Peer) SendToCons(msg types.Message, magic uint32) error
- func (this *Peer) SendToSync(msg types.Message, magic uint32) error
- func (this *Peer) SetConsConn(consLink *conn.Link)
- func (this *Peer) SetConsPort(port uint32)
- func (this *Peer) SetConsState(state uint32)
- func (this *Peer) SetHeight(height uint64)
- func (this *Peer) SetLastSeenBlkNum(num uint64)
- func (this *Peer) SetSyncState(state uint32)
- func (this *Peer) UnlockBusy()
- func (this *Peer) UnlockBusyFetchingCP()
- func (this *Peer) UpdateInfo(t time.Time, version uint32, services uint64, syncPort uint32, consPort uint32, ...)
- type PeerCom
- func (this *PeerCom) GetConsPort() uint32
- func (this *PeerCom) GetHeight() uint64
- func (this *PeerCom) GetID() uint64
- func (this *PeerCom) GetRelay() bool
- func (this *PeerCom) GetServices() uint64
- func (this *PeerCom) GetSyncPort() uint32
- func (this *PeerCom) GetVersion() uint32
- func (this *PeerCom) SetConsPort(port uint32)
- func (this *PeerCom) SetHeight(height uint64)
- func (this *PeerCom) SetID(id uint64)
- func (this *PeerCom) SetRelay(relay bool)
- func (this *PeerCom) SetServices(services uint64)
- func (this *PeerCom) SetSyncPort(port uint32)
- func (this *PeerCom) SetVersion(version uint32)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FetchOutOfRangeState ¶ added in v1.0.2
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 TrxCache trxCache OutOfRangeState FetchOutOfRangeState ConsensusCache *common.HashCache // 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) GetLastSeenBlkNum ¶ added in v1.0.2
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) HasConsensusMsg ¶ added in v1.0.2
func (*Peer) LockBusyFetchingCP ¶ added in v1.0.2
func (*Peer) RecordConsensusMsg ¶ added in v1.0.2
func (*Peer) RecordTrxCache ¶ added in v1.0.2
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) SetLastSeenBlkNum ¶ added in v1.0.2
func (*Peer) SetSyncState ¶
SetSyncState set sync state to peer
func (*Peer) UnlockBusy ¶ added in v1.0.2
func (this *Peer) UnlockBusy()
func (*Peer) UnlockBusyFetchingCP ¶ added in v1.0.2
func (this *Peer) UnlockBusyFetchingCP()
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) 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) 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