Documentation ¶
Index ¶
- type Messenger
- func (msgr *Messenger) Broadcast(message p2ptypes.Message, skipEdgeNode bool) (successes chan bool)
- func (msgr *Messenger) BroadcastToNeighbors(message p2ptypes.Message, maxNumPeersToBroadcast int, skipEdgeNode bool) (successes chan bool)
- func (msgr *Messenger) ID() string
- func (msgr *Messenger) IsSeedPeer(pid string) bool
- func (msgr *Messenger) PeerExists(peerID string) bool
- func (msgr *Messenger) PeerURLs(skipEdgeNode bool) []string
- func (msgr *Messenger) Peers(skipEdgeNode bool) []string
- func (msgr *Messenger) Publish(message p2ptypes.Message) error
- func (msgr *Messenger) RegisterMessageHandler(msgHandler p2pl.MessageHandler)
- func (msgr *Messenger) Send(peerID string, message p2ptypes.Message) bool
- func (msgr *Messenger) Start(ctx context.Context) error
- func (msgr *Messenger) Stop()
- func (msgr *Messenger) Wait()
- type MessengerConfig
- type PeerNotif
- func (p *PeerNotif) ClosedStream(n network.Network, s network.Stream)
- func (p *PeerNotif) Connected(n network.Network, c network.Conn)
- func (p *PeerNotif) Disconnected(n network.Network, c network.Conn)
- func (p *PeerNotif) Listen(n network.Network, _ ma.Multiaddr)
- func (p *PeerNotif) ListenClose(n network.Network, _ ma.Multiaddr)
- func (p *PeerNotif) OpenedStream(n network.Network, s network.Stream)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Messenger ¶
type Messenger struct {
// contains filtered or unexported fields
}
func CreateMessenger ¶
func CreateMessenger(pubKey *crypto.PublicKey, seedPeerMultiAddresses []string, port int, seedPeerOnly bool, msgrConfig MessengerConfig, needMdns bool, ctx context.Context) (*Messenger, error)
CreateMessenger creates an instance of Messenger
func (*Messenger) BroadcastToNeighbors ¶
func (msgr *Messenger) BroadcastToNeighbors(message p2ptypes.Message, maxNumPeersToBroadcast int, skipEdgeNode bool) (successes chan bool)
BroadcastToNeighbors broadcasts the given message to neighbors
func (*Messenger) IsSeedPeer ¶
func (*Messenger) PeerExists ¶
PeerExists indicates if the given peerID is a neighboring peer
func (*Messenger) RegisterMessageHandler ¶
func (msgr *Messenger) RegisterMessageHandler(msgHandler p2pl.MessageHandler)
RegisterMessageHandler registers the message handler
type MessengerConfig ¶
type MessengerConfig struct {
// contains filtered or unexported fields
}
MessengerConfig specifies the configuration for Messenger
func GetDefaultMessengerConfig ¶
func GetDefaultMessengerConfig() MessengerConfig
GetDefaultMessengerConfig returns the default config for messenger, not necessary
type PeerNotif ¶
type PeerNotif Messenger
func (*PeerNotif) ClosedStream ¶
func (*PeerNotif) Disconnected ¶
Click to show internal directories.
Click to hide internal directories.