Versions in this module Expand all Collapse all v1 v1.1.0 Aug 14, 2019 v1.0.0 Jun 25, 2019 Changes in this version + const BOOTNODE + const CONSENSUSNODE + const ConnDefault + const ConnTxMsg + const DT_CN + const DT_EN + const DT_PN + const DT_UNLIMITED + const ENDPOINTNODE + const PROXYNODE + const UNKNOWNNODE + var ErrPipeClosed = errors.New("p2p: read or write on closed message pipe") + func ConvertConnTypeToString(ct ConnType) string + func ConvertNodeType(ct ConnType) discover.NodeType + 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 BaseServer struct + func (srv *BaseServer) AddLastLookup() time.Time + func (srv *BaseServer) AddPeer(node *discover.Node, onParentChain bool) + func (srv *BaseServer) AddProtocols(p []Protocol) + func (srv *BaseServer) CheckNilNetworkTable() bool + func (srv *BaseServer) Dial(dest *discover.Node) (net.Conn, error) + func (srv *BaseServer) DialMulti(dest *discover.Node) ([]net.Conn, error) + func (srv *BaseServer) Disconnect(destID discover.NodeID) + func (srv *BaseServer) GetListenAddress() string + func (srv *BaseServer) GetNodes(nType discover.NodeType, max int) []*discover.Node + func (srv *BaseServer) GetProtocols() []Protocol + func (srv *BaseServer) Lookup(target discover.NodeID, nType discover.NodeType) []*discover.Node + func (srv *BaseServer) MaxPeers() int + func (srv *BaseServer) Name() string + func (srv *BaseServer) NodeInfo() *NodeInfo + func (srv *BaseServer) PeerCount() int + func (srv *BaseServer) PeerCountByType() map[string]uint + func (srv *BaseServer) Peers() []*Peer + func (srv *BaseServer) PeersInfo() []*PeerInfo + func (srv *BaseServer) RemovePeer(node *discover.Node) + func (srv *BaseServer) Resolve(target discover.NodeID, nType discover.NodeType) *discover.Node + func (srv *BaseServer) Self() *discover.Node + func (srv *BaseServer) SetLastLookupToNow() + func (srv *BaseServer) SetupConn(fd net.Conn, flags connFlag, dialDest *discover.Node) error + func (srv *BaseServer) Start() (err error) + func (srv *BaseServer) Stop() + func (srv *BaseServer) SubscribeEvents(ch chan *PeerEvent) event.Subscription + type Cap struct + Name string + Version uint + func (cap Cap) RlpData() interface{} + func (cap Cap) String() string + type Config struct + BootstrapNodes []*discover.Node + ConnectionType ConnType + DialRatio int + Dialer NodeDialer + EnableMsgEvents bool + EnableMultiChannelServer bool + ListenAddr string + Logger log.Logger + MaxPendingPeers int + MaxPhysicalConnections int + NAT nat.Interface + Name string + NetRestrict *netutil.Netlist + NetworkID uint64 + NoDial bool + NoDiscovery bool + NoListen bool + NodeDatabase string + PrivateKey *ecdsa.PrivateKey + Protocols []Protocol + RWTimerConfig RWTimerConfig + StaticNodes []*discover.Node + SubListenAddr []string + TrustedNodes []*discover.Node + type ConnType int + const ConnTypeUndefined + func ConvertConnType(nt discover.NodeType) ConnType + func ConvertStringToConnType(s string) ConnType + func (c ConnType) String() string + func (ct ConnType) Valid() bool + 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 ErrorPeer struct + 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 MultiChannelServer struct + CandidateConns map[discover.NodeID][]*conn + ListenAddrs []string + func (srv *MultiChannelServer) SetupConn(fd net.Conn, flags connFlag, dialDest *discover.Node) error + func (srv *MultiChannelServer) Start() (err error) + type NetworkInfo struct + Inbound bool + LocalAddress string + NodeType string + RemoteAddress string + Static bool + Trusted bool + type NodeDialer interface + Dial func(*discover.Node) (net.Conn, error) + DialMulti func(*discover.Node) ([]net.Conn, error) + type NodeInfo struct + Enode string + ID string + IP string + ListenAddr string + Name string + Ports struct{ ... } + Protocols map[string]interface{} + type Peer struct + func NewPeer(id discover.NodeID, name string, caps []Cap) *Peer + func (p *Peer) Caps() []Cap + func (p *Peer) ConnType() ConnType + func (p *Peer) Disconnect(reason DiscReason) + func (p *Peer) GetNumberInboundAndOutbound() (int, int) + 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) Log() log.Logger + func (p *Peer) Name() string + func (p *Peer) OnParentChain() bool + func (p *Peer) RemoteAddr() net.Addr + func (p *Peer) SetOnParentChain(onParentChain bool) + 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 + Networks []NetworkInfo + Protocols map[string]interface{} + type PeerTypeValidator interface + ValidatePeerType func(addr common.Address) error + type PortOrder int + const PortOrderUndefined + type Protocol struct + Length uint64 + Name string + NodeInfo func() interface{} + PeerInfo func(id discover.NodeID) interface{} + Run func(peer *Peer, rw MsgReadWriter) error + RunWithRWs func(peer *Peer, rws []MsgReadWriter) error + Version uint + type RWTimerConfig struct + Interval uint64 + WaitTime time.Duration + type Server interface + AddLastLookup func() time.Time + AddPeer func(node *discover.Node, onParentChain bool) + AddProtocols func(p []Protocol) + CheckNilNetworkTable func() bool + Disconnect func(destID discover.NodeID) + GetListenAddress func() string + GetNodes func(nType discover.NodeType, max int) []*discover.Node + GetProtocols func() []Protocol + Lookup func(target discover.NodeID, nType discover.NodeType) []*discover.Node + MaxPeers func() int + Name func() string + NodeInfo func() *NodeInfo + PeerCount func() int + PeerCountByType func() map[string]uint + Peers func() []*Peer + PeersInfo func() []*PeerInfo + RemovePeer func(node *discover.Node) + Resolve func(target discover.NodeID, nType discover.NodeType) *discover.Node + SetLastLookupToNow func() + SetupConn func(fd net.Conn, flags connFlag, dialDest *discover.Node) error + Start func() (err error) + Stop func() + SubscribeEvents func(ch chan *PeerEvent) event.Subscription + func NewServer(config Config) Server + type SingleChannelServer struct + type TCPDialer struct + func (t TCPDialer) Dial(dest *discover.Node) (net.Conn, error) + func (t TCPDialer) DialMulti(dest *discover.Node) ([]net.Conn, error)