Documentation ¶
Index ¶
- func GenKeyPair() (crypto.PrivKey, crypto.PubKey, peer.ID, error)
- type Service
- func (s *Service) ListenAddrs() ([]multiaddr.Multiaddr, error)
- func (s *Service) NewStream(ctx context.Context, pids ...protocol.ID) (network.Stream, error)
- func (s *Service) PublishOnTopic(topic string) error
- func (s *Service) Run(ctx context.Context) error
- func (s *Service) SetProtocolHandler(pid protocol.ID, handler func(network.Stream))
- func (s *Service) SubscribePeerConnectednessChanged(ctx context.Context) (<-chan event.EvtPeerConnectednessChanged, error)
- func (s *Service) SubscribeToTopic(topic string) (chan []byte, func(), error)
- func (s *Service) WithListener(l junoSync.EventListener)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New(addr, userAgent, peers, privKeyStr string, feederNode bool, bc *blockchain.Blockchain, snNetwork *utils.Network, log utils.SimpleLogger, ) (*Service, error)
func NewWithHost ¶ added in v0.6.0
func NewWithHost(p2phost host.Host, peers string, feederNode bool, bc *blockchain.Blockchain, snNetwork *utils.Network, log utils.SimpleLogger, ) (*Service, error)
func (*Service) ListenAddrs ¶
func (*Service) NewStream ¶ added in v0.6.0
NewStream creates a bidirectional connection to a random peer that implements a set of protocol ids
func (*Service) PublishOnTopic ¶ added in v0.6.0
func (*Service) Run ¶
Run starts the p2p service. Calling any other function before run is undefined behaviour
func (*Service) SetProtocolHandler ¶ added in v0.6.0
func (*Service) SubscribePeerConnectednessChanged ¶
func (*Service) SubscribeToTopic ¶ added in v0.6.0
func (*Service) WithListener ¶ added in v0.10.0
func (s *Service) WithListener(l junoSync.EventListener)
Click to show internal directories.
Click to hide internal directories.