Documentation ¶
Index ¶
- Constants
- type PEXReactor
- func (r *PEXReactor) AddPeer(p *p2p.Peer) error
- func (r *PEXReactor) GetChannels() []*connection.ChannelDescriptor
- func (r *PEXReactor) OnStart() error
- func (r *PEXReactor) OnStop()
- func (r *PEXReactor) Receive(chID byte, p *p2p.Peer, rawMsg []byte)
- func (r *PEXReactor) RemovePeer(p *p2p.Peer, reason interface{})
- func (r *PEXReactor) SendAddrs(p *p2p.Peer, nodes []*discover.Node) bool
- type PexMessage
Constants ¶
View Source
const ( // PexChannel is a channel for PEX messages PexChannel = byte(0x00) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PEXReactor ¶
type PEXReactor struct { p2p.BaseReactor // contains filtered or unexported fields }
PEXReactor handles peer exchange and ensures that an adequate number of peers are connected to the switch.
func NewPEXReactor ¶
func NewPEXReactor(discv *discover.Network) *PEXReactor
NewPEXReactor creates new PEX reactor.
func (*PEXReactor) AddPeer ¶
func (r *PEXReactor) AddPeer(p *p2p.Peer) error
AddPeer adding peer to the address book
func (*PEXReactor) GetChannels ¶
func (r *PEXReactor) GetChannels() []*connection.ChannelDescriptor
GetChannels implements Reactor
func (*PEXReactor) Receive ¶
func (r *PEXReactor) Receive(chID byte, p *p2p.Peer, rawMsg []byte)
Receive implements Reactor by handling incoming PEX messages.
func (*PEXReactor) RemovePeer ¶
func (r *PEXReactor) RemovePeer(p *p2p.Peer, reason interface{})
RemovePeer implements Reactor.
type PexMessage ¶
type PexMessage interface{}
PexMessage is a primary type for PEX messages. Underneath, it could contain either pexRequestMessage, or pexAddrsMessage messages.
func DecodeMessage ¶
func DecodeMessage(bz []byte) (msgType byte, msg PexMessage, err error)
DecodeMessage implements interface registered above.
Click to show internal directories.
Click to hide internal directories.