pex

package
v1.0.3-hotfix-f53cde9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2018 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

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) OnStart

func (r *PEXReactor) OnStart() error

OnStart implements BaseService

func (*PEXReactor) OnStop

func (r *PEXReactor) OnStop()

OnStop implements BaseService

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.

func (*PEXReactor) SendAddrs

func (r *PEXReactor) SendAddrs(p *p2p.Peer, nodes []*discover.Node) bool

SendAddrs sends addrs to the peer.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL