Versions in this module Expand all Collapse all v1 v1.1.1 Oct 29, 2019 Changes in this version + var ErrPipeClosed = errors.New("p2p: read or write on closed message pipe") + func ExpectMsg(r MsgReader, code uint64, content ...interface{}) error + func MsgPipe() (*MsgPipeRW, *MsgPipeRW) + func Send(w MsgWriter, msgcode uint64, data ...interface{}) error + func SendItems(w MsgWriter, msgcode uint64, elems ...interface{}) error + type AuthMsgV4 struct + InitiatorPubkey [pubLen]byte + Nonce [shaLen]byte + Rest []byte + Signature [sigLen]byte + Version uint + func (z *AuthMsgV4) DecodeMsg(dc *msgp.Reader) (err error) + func (z *AuthMsgV4) EncodeMsg(en *msgp.Writer) (err error) + func (z *AuthMsgV4) MarshalMsg(b []byte) (o []byte, err error) + func (z *AuthMsgV4) Msgsize() (s int) + func (z *AuthMsgV4) UnmarshalMsg(bts []byte) (o []byte, err error) + type AuthRespV4 struct + Nonce [shaLen]byte + RandomPubkey [pubLen]byte + Rest []byte + Version uint + func (z *AuthRespV4) DecodeMsg(dc *msgp.Reader) (err error) + func (z *AuthRespV4) EncodeMsg(en *msgp.Writer) (err error) + func (z *AuthRespV4) MarshalMsg(b []byte) (o []byte, err error) + func (z *AuthRespV4) Msgsize() (s int) + func (z *AuthRespV4) UnmarshalMsg(bts []byte) (o []byte, err error) + type Cap struct + Name string + Version uint + func (cap Cap) MsgpData() interface{} + func (cap Cap) String() string + func (z *Cap) DecodeMsg(dc *msgp.Reader) (err error) + func (z *Cap) UnmarshalMsg(bts []byte) (o []byte, err error) + func (z Cap) EncodeMsg(en *msgp.Writer) (err error) + func (z Cap) MarshalMsg(b []byte) (o []byte, err error) + func (z Cap) Msgsize() (s int) + type Config struct + BootstrapNodes []*discover.Node + BootstrapNodesV5 []*discv5.Node + Dialer NodeDialer + DiscoveryV5 bool + DiscoveryV5Addr string + EnableMsgEvents bool + ListenAddr string + MaxPeers int + MaxPendingPeers int + NAT nat.Interface + Name string + NetRestrict *netutil.Netlist + NoDial bool + NoDiscovery bool + NodeDatabase string + PrivateKey *ecdsa.PrivateKey + Protocols []Protocol + StaticNodes []*discover.Node + TrustedNodes []*discover.Node + type DiscReason uint + const DiscAlreadyConnected + const DiscIncompatibleVersion + const DiscInvalidIdentity + const DiscNetworkError + const DiscProtocolError + const DiscQuitting + const DiscReadTimeout + const DiscRequested + const DiscSelf + const DiscSubprotocolError + const DiscTooManyPeers + const DiscUnexpectedIdentity + const DiscUselessPeer + func (d DiscReason) Error() string + func (d DiscReason) String() string + func (z *DiscReason) DecodeMsg(dc *msgp.Reader) (err error) + func (z *DiscReason) UnmarshalMsg(bts []byte) (o []byte, err error) + func (z DiscReason) EncodeMsg(en *msgp.Writer) (err error) + func (z DiscReason) MarshalMsg(b []byte) (o []byte, err error) + func (z DiscReason) Msgsize() (s int) + type Msg struct + Code uint64 + Payload io.Reader + ReceivedAt time.Time + Size uint32 + func (msg Msg) Decode(val interface{}) error + func (msg Msg) Discard() error + func (msg Msg) String() string + type MsgPipeRW struct + func (p *MsgPipeRW) Close() error + func (p *MsgPipeRW) ReadMsg() (Msg, error) + func (p *MsgPipeRW) WriteMsg(msg Msg) error + type MsgReadWriter interface + type MsgReader interface + ReadMsg func() (Msg, error) + type MsgWriter interface + WriteMsg func(Msg) error + type NodeDialer interface + Dial func(*discover.Node) (net.Conn, error) + type NodeInfo struct + ID string + IP string + ListenAddr string + Name string + Ports struct{ ... } + Protocols map[string]interface{} + Url string + type Peer struct + func NewPeer(id discover.NodeID, name string, caps []Cap) *Peer + func (p *Peer) Caps() []Cap + func (p *Peer) Disconnect(reason DiscReason) + func (p *Peer) ID() discover.NodeID + func (p *Peer) Inbound() bool + func (p *Peer) Info() *PeerInfo + func (p *Peer) LocalAddr() net.Addr + func (p *Peer) Name() string + func (p *Peer) RemoteAddr() net.Addr + func (p *Peer) String() string + type PeerEvent struct + Error string + MsgCode *uint64 + MsgSize *uint32 + Peer discover.NodeID + Protocol string + Type PeerEventType + type PeerEventType string + const PeerEventTypeAdd + const PeerEventTypeDrop + const PeerEventTypeMsgRecv + const PeerEventTypeMsgSend + type PeerInfo struct + Caps []string + ID string + Name string + Network struct{ ... } + Protocols map[string]interface{} + type ProtoHandshake struct + Caps []Cap + ID discover.NodeID + ListenPort uint64 + Name string + Rest []byte + Version uint64 + func (z *ProtoHandshake) DecodeMsg(dc *msgp.Reader) (err error) + func (z *ProtoHandshake) EncodeMsg(en *msgp.Writer) (err error) + func (z *ProtoHandshake) MarshalMsg(b []byte) (o []byte, err error) + func (z *ProtoHandshake) Msgsize() (s int) + func (z *ProtoHandshake) UnmarshalMsg(bts []byte) (o []byte, err error) + type Protocol struct + Length uint64 + Name string + NodeInfo func() interface{} + PeerInfo func(id discover.NodeID) interface{} + Run func(peer *Peer, rw MsgReadWriter) error + Version uint + func (z *Protocol) DecodeMsg(dc *msgp.Reader) (err error) + func (z *Protocol) UnmarshalMsg(bts []byte) (o []byte, err error) + func (z Protocol) EncodeMsg(en *msgp.Writer) (err error) + func (z Protocol) MarshalMsg(b []byte) (o []byte, err error) + func (z Protocol) Msgsize() (s int) + type Server struct + DiscV5 *discv5.Network + func (srv *Server) AddPeer(node *discover.Node) + func (srv *Server) NodeInfo() *NodeInfo + func (srv *Server) PeerCount() int + func (srv *Server) Peers() []*Peer + func (srv *Server) PeersInfo() []*PeerInfo + func (srv *Server) RemovePeer(node *discover.Node) + func (srv *Server) Self() *discover.Node + func (srv *Server) SetupConn(fd net.Conn, flags connFlag, dialDest *discover.Node) error + func (srv *Server) Start() (err error) + func (srv *Server) Stop() + func (srv *Server) SubscribeEvents(ch chan *PeerEvent) event.Subscription + type TCPDialer struct + func (t TCPDialer) Dial(dest *discover.Node) (net.Conn, error)