Versions in this module Expand all Collapse all v0 v0.1.0 Feb 16, 2019 Changes in this version + const ErrDecode + const ErrHandler + const ErrHandshake + const ErrInvalidMsgCode + const ErrInvalidMsgType + const ErrMsgTooLong + const ErrNoHandler + const ErrWrite + type Error struct + Code int + func (e Error) Error() (message string) + type Peer struct + func NewPeer(p *p2p.Peer, rw p2p.MsgReadWriter, spec *Spec) *Peer + func (p *Peer) Drop(err error) + func (p *Peer) Handshake(ctx context.Context, hs interface{}, verify func(interface{}) error) (rhs interface{}, err error) + func (p *Peer) Run(handler func(ctx context.Context, msg interface{}) error) error + func (p *Peer) Send(ctx context.Context, msg interface{}) error + type Spec struct + MaxMsgSize uint32 + Messages []interface{} + Name string + Version uint + func (s *Spec) GetCode(msg interface{}) (uint64, bool) + func (s *Spec) Length() uint64 + func (s *Spec) NewMsg(code uint64) (interface{}, bool) + type WrappedMsg struct + Context []byte + Payload []byte + Size uint32