Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageHandler ¶
type MessageHandler interface {
// GetChannelIDs returns the list channelIDs that the message handler needs to handle
GetChannelIDs() []common.ChannelIDEnum
// ParseMessage parses the raw message bytes
ParseMessage(peerID string, channelID common.ChannelIDEnum, rawMessageBytes common.Bytes) (types.Message, error)
// EncodeMessage encodes message to bytes
EncodeMessage(message interface{}) (common.Bytes, error)
// HandleMessage processes the received message
HandleMessage(message types.Message) error
}
MessageHandler interface
type Network ¶
type Network interface {
// Start is called when the network starts
Start(ctx context.Context) error
// Wait blocks until all goroutines have stopped
Wait()
// Stop is called when the network stops
Stop()
// Broadcast broadcasts the given message to all the neighboring peers
Broadcast(message types.Message) chan bool
// Send sends the given message to the peer specified by the peerID
Send(peerID string, message types.Message) bool
// RegisterMessageHandler registers message handler
RegisterMessageHandler(messageHandler MessageHandler)
// ID returns the ID of the network peer
ID() string
}
Network is a handle to the P2P network
Directories
¶
| Path | Synopsis |
|---|---|
|
flowrate
Package flowrate provides the tools for monitoring and limiting the flow rate of an arbitrary data stream.
|
Package flowrate provides the tools for monitoring and limiting the flow rate of an arbitrary data stream. |
|
Taken from taipei-torrent Just enough UPnP to be able to forward ports
|
Taken from taipei-torrent Just enough UPnP to be able to forward ports |
Click to show internal directories.
Click to hide internal directories.