Documentation ¶
Index ¶
- type Option
- func WithAddProtocolFunc(f func(p2p.ProtocolSpec) error) Option
- func WithAddressesFunc(f func() ([]ma.Multiaddr, error)) Option
- func WithBlocklistFunc(f func(boson.Address, time.Duration, string) error) Option
- func WithBlocklistedPeersFunc(f func() ([]p2p.BlockPeers, error)) Option
- func WithConnectFunc(f func(ctx context.Context, addr ma.Multiaddr) (peer *p2p.Peer, err error)) Option
- func WithDisconnectFunc(f func(overlay boson.Address, reason string) error) Option
- func WithGetWelcomeMessageFunc(f func() string) Option
- func WithPeersFunc(f func() []p2p.Peer) Option
- func WithSetWelcomeMessageFunc(f func(string) error) Option
- type Service
- func (s *Service) AddProtocol(spec p2p.ProtocolSpec) error
- func (s *Service) Addresses() ([]ma.Multiaddr, error)
- func (s *Service) Blocklist(overlay boson.Address, duration time.Duration, reason string) error
- func (s *Service) BlocklistRemove(overlay boson.Address) error
- func (s *Service) BlocklistedPeers() ([]p2p.BlockPeers, error)
- func (s *Service) CallHandler(ctx context.Context, last p2p.Peer, stream p2p.Stream) (relayData *pb.RouteRelayReq, w *p2p.WriterChan, r *p2p.ReaderChan, ...)
- func (s *Service) CallHandlerWithConnChain(ctx context.Context, last, src p2p.Peer, stream p2p.Stream, ...) error
- func (s *Service) Connect(ctx context.Context, addr ma.Multiaddr) (peer *p2p.Peer, err error)
- func (s *Service) Disconnect(overlay boson.Address, reason string) error
- func (s *Service) GetWelcomeMessage() string
- func (s *Service) Halt()
- func (s *Service) NATAddresses() ([]net.Addr, error)
- func (s *Service) NetworkStatus() p2p.NetworkStatus
- func (s *Service) PeerID(overlay boson.Address) (id libp2ppeer.ID, found bool)
- func (s *Service) Peers() []p2p.Peer
- func (s *Service) ResourceManager() network.ResourceManager
- func (s *Service) SetConnectFunc(f func(ctx context.Context, addr ma.Multiaddr) (peer *p2p.Peer, err error))
- func (s *Service) SetPickyNotifier(f p2p.PickyNotifier)
- func (s *Service) SetWelcomeMessage(val string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func WithAddProtocolFunc ¶
func WithAddProtocolFunc(f func(p2p.ProtocolSpec) error) Option
WithAddProtocolFunc sets the mock implementation of the AddProtocol function
func WithAddressesFunc ¶
WithAddressesFunc sets the mock implementation of the Adresses function
func WithBlocklistFunc ¶
func WithBlocklistedPeersFunc ¶
func WithBlocklistedPeersFunc(f func() ([]p2p.BlockPeers, error)) Option
WithBlocklistedPeersFunc sets the mock implementation of the BlocklistedPeers function
func WithConnectFunc ¶
func WithConnectFunc(f func(ctx context.Context, addr ma.Multiaddr) (peer *p2p.Peer, err error)) Option
WithConnectFunc sets the mock implementation of the Connect function
func WithDisconnectFunc ¶
WithDisconnectFunc sets the mock implementation of the Disconnect function
func WithGetWelcomeMessageFunc ¶
WithGetWelcomeMessageFunc sets the mock implementation of the GetWelcomeMessage function
func WithPeersFunc ¶
WithPeersFunc sets the mock implementation of the Peers function
func WithSetWelcomeMessageFunc ¶
WithSetWelcomeMessageFunc sets the mock implementation of the SetWelcomeMessage function
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the mock of a P2P Service
func (*Service) AddProtocol ¶
func (s *Service) AddProtocol(spec p2p.ProtocolSpec) error
func (*Service) BlocklistedPeers ¶
func (s *Service) BlocklistedPeers() ([]p2p.BlockPeers, error)
func (*Service) CallHandler ¶
func (s *Service) CallHandler(ctx context.Context, last p2p.Peer, stream p2p.Stream) (relayData *pb.RouteRelayReq, w *p2p.WriterChan, r *p2p.ReaderChan, forward bool, err error)
func (*Service) CallHandlerWithConnChain ¶
func (*Service) Disconnect ¶
func (*Service) GetWelcomeMessage ¶
func (*Service) NetworkStatus ¶
func (s *Service) NetworkStatus() p2p.NetworkStatus
NetworkStatus implements p2p.NetworkStatuser interface. It always returns p2p.NetworkStatusAvailable.
func (*Service) ResourceManager ¶
func (s *Service) ResourceManager() network.ResourceManager
func (*Service) SetConnectFunc ¶
func (*Service) SetPickyNotifier ¶
func (s *Service) SetPickyNotifier(f p2p.PickyNotifier)