Versions in this module Expand all Collapse all v1 v1.0.2 Aug 19, 2015 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 Cap struct + Name string + Version uint + func (cap Cap) RlpData() interface{} + func (cap Cap) String() string + 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 + 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 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) LocalAddr() net.Addr + func (p *Peer) Name() string + func (p *Peer) RemoteAddr() net.Addr + func (p *Peer) String() string + type Protocol struct + Length uint64 + Name string + Run func(peer *Peer, rw MsgReadWriter) error + Version uint + type Server struct + BootstrapNodes []*discover.Node + Dialer *net.Dialer + Discovery bool + ListenAddr string + MaxPeers int + MaxPendingPeers int + NAT nat.Interface + Name string + NoDial bool + NodeDatabase string + PrivateKey *ecdsa.PrivateKey + Protocols []Protocol + StaticNodes []*discover.Node + TrustedNodes []*discover.Node + func (srv *Server) AddPeer(node *discover.Node) + func (srv *Server) PeerCount() int + func (srv *Server) Peers() []*Peer + func (srv *Server) Self() *discover.Node + func (srv *Server) Start() (err error) + func (srv *Server) Stop()