Versions in this module Expand all Collapse all v1 v1.0.2 Jan 27, 2022 Changes in this version type P2PServerV1 + func (p *P2PServerV1) GetPeer(peerInfo pb.PeerInfo, addr string) []*pb.PeerInfo v1.0.1 Dec 1, 2021 Changes in this version + const ServerName + var ErrAccountNotExist = errors.New("account not exist") + var ErrAddressIllegal = errors.New("address illegal") + var ErrEmptyPeer = errors.New("empty peer") + var ErrLoadAccount = errors.New("load account error") + var ErrNoResponse = errors.New("no response") + func NewP2PServerV1() p2p.Server + type Conn struct + func NewConn(ctx *nctx.NetCtx, addr string) (*Conn, error) + func (c *Conn) Close() + func (c *Conn) PeerID() string + func (c *Conn) SendMessage(ctx xctx.XContext, msg *pb.XuperMessage) error + func (c *Conn) SendMessageWithResponse(ctx xctx.XContext, msg *pb.XuperMessage) (*pb.XuperMessage, error) + type ConnPool struct + func NewConnPool(ctx *nctx.NetCtx) (*ConnPool, error) + func (p *ConnPool) Get(addr string) (*Conn, error) + func (p *ConnPool) GetAll() map[string]string + type MultiStrategy struct + func NewMultiStrategy(filters []PeerFilter, peerIDs []string) *MultiStrategy + func (cp *MultiStrategy) Filter() ([]string, error) + type P2PServerV1 struct + func (p *P2PServerV1) Context() *nctx.NetCtx + func (p *P2PServerV1) GetPeerIdByAccount(account string) (string, error) + func (p *P2PServerV1) GetPeerInfo(addresses []string) ([]*pb.PeerInfo, error) + func (p *P2PServerV1) Init(ctx *nctx.NetCtx) error + func (p *P2PServerV1) NewSubscriber(typ pb.XuperMessage_MessageType, v interface{}, opts ...p2p.SubscriberOption) p2p.Subscriber + func (p *P2PServerV1) PeerInfo() pb.PeerInfo + func (p *P2PServerV1) Register(sub p2p.Subscriber) error + func (p *P2PServerV1) SendMessage(ctx xctx.XContext, msg *pb.XuperMessage, optFunc ...p2p.OptionFunc) error + func (p *P2PServerV1) SendMessageWithResponse(ctx xctx.XContext, msg *pb.XuperMessage, optFunc ...p2p.OptionFunc) ([]*pb.XuperMessage, error) + func (p *P2PServerV1) SendP2PMessage(stream pb.P2PService_SendP2PMessageServer) error + func (p *P2PServerV1) Start() + func (p *P2PServerV1) Stop() + func (p *P2PServerV1) UnRegister(sub p2p.Subscriber) error + type PeerFilter interface + Filter func() ([]string, error) + type StaticNodeStrategy struct + func (ss *StaticNodeStrategy) Filter() ([]string, error)