Documentation ¶
Overview ¶
This package provides the DPOS routes(network addresses) protocol, it can collect all DPOS peer addresses from the normal P2P network.
Index ¶
- func DisableLog()
- func UseLogger(logger elalog.Logger)
- type Config
- type Routes
- func (r *Routes) AnnounceAddr()
- func (r *Routes) DonePeer(peer *peer.Peer)
- func (r *Routes) NewPeer(peer *peer.Peer)
- func (r *Routes) OnGetData(p *peer.Peer, m *msg.GetData)
- func (r *Routes) QueueDAddr(p *peer.Peer, m *msg.DAddr)
- func (r *Routes) QueueInv(p *peer.Peer, m *msg.Inv)
- func (r *Routes) Start()
- func (r *Routes) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.
Types ¶
type Config ¶
type Config struct { // The PID of this peer if it is an arbiter. PID []byte // The network address of this arbiter. Addr string // TimeSource is the median time source of the P2P network. TimeSource blockchain.MedianTimeSource // Sign the addr message of this arbiter. Sign func(data []byte) (signature []byte) // IsCurrent returns whether BlockChain synced to best height. IsCurrent func() bool // RelayAddr relays the addresses inventory to the P2P network. RelayAddr func(iv *msg.InvVect, data interface{}) // OnCipherAddr will be invoked when an address cipher received. OnCipherAddr func(pid dp.PID, addr []byte) }
Config defines the parameters to create a Route instance.
type Routes ¶
type Routes struct {
// contains filtered or unexported fields
}
Routes is the DPOS routes implementation.
func (*Routes) AnnounceAddr ¶
func (r *Routes) AnnounceAddr()
AnnounceAddr schedules an local address announce to the P2P network, it used to re-announce the local address when DPoS network go bad.
func (*Routes) QueueDAddr ¶
QueueInv adds the passed DAddr message and peer to the addr handling queue.
Click to show internal directories.
Click to hide internal directories.