Documentation ¶
Index ¶
- Constants
- func FlowDHTProtocolID(sporkId flow.Identifier) protocol.ID
- func FlowGzipProtocolId(sporkId flow.Identifier) protocol.ID
- func FlowProtocolID(sporkId flow.Identifier) protocol.ID
- func FlowPublicDHTProtocolID(sporkId flow.Identifier) protocol.ID
- func IsFlowProtocolStream(s libp2pnet.Stream) bool
- func PingProtocolId(sporkId flow.Identifier) protocol.ID
- type GzipStream
- type Protocol
- type ProtocolFactory
- type ProtocolName
Constants ¶
View Source
const ( // FlowLibP2PProtocolCommonPrefix is the common prefix for all Libp2p protocol IDs used for Flow // ALL Flow libp2p protocols must start with this prefix. FlowLibP2PProtocolCommonPrefix = "/flow" FlowDHTProtocolIDPrefix = FlowLibP2PProtocolCommonPrefix + "/dht/" // FlowLibP2POneToOneProtocolIDPrefix is a unique Libp2p protocol ID prefix for Flow (https://docs.libp2p.io/concepts/protocols/) // All nodes communicate with each other using this protocol id suffixed with the id of the root block FlowLibP2POneToOneProtocolIDPrefix = FlowLibP2PProtocolCommonPrefix + "/push/" // FlowLibP2PPingProtocolPrefix is the Flow Ping protocol prefix FlowLibP2PPingProtocolPrefix = FlowLibP2PProtocolCommonPrefix + "/ping/" // FlowLibP2PProtocolGzipCompressedOneToOne represents the protocol id for compressed streams under gzip compressor. FlowLibP2PProtocolGzipCompressedOneToOne = FlowLibP2POneToOneProtocolIDPrefix + "/gzip/" )
Flow Libp2p protocols
View Source
const GzipCompressionUnicast = ProtocolName("gzip-compression")
Variables ¶
This section is empty.
Functions ¶
func FlowDHTProtocolID ¶
func FlowDHTProtocolID(sporkId flow.Identifier) protocol.ID
func FlowGzipProtocolId ¶
func FlowGzipProtocolId(sporkId flow.Identifier) protocol.ID
func FlowProtocolID ¶
func FlowProtocolID(sporkId flow.Identifier) protocol.ID
func FlowPublicDHTProtocolID ¶
func FlowPublicDHTProtocolID(sporkId flow.Identifier) protocol.ID
func IsFlowProtocolStream ¶
IsFlowProtocolStream returns true if the libp2p stream is for a Flow protocol
func PingProtocolId ¶
func PingProtocolId(sporkId flow.Identifier) protocol.ID
Types ¶
type GzipStream ¶
type GzipStream struct {
// contains filtered or unexported fields
}
GzipStream is a stream compression creates and returns a gzip-compressed stream out of input stream.
func NewGzipCompressedUnicast ¶
func NewGzipCompressedUnicast(logger zerolog.Logger, sporkId flow.Identifier, defaultHandler libp2pnet.StreamHandler) *GzipStream
func (GzipStream) Handler ¶
func (g GzipStream) Handler(s libp2pnet.Stream)
func (GzipStream) ProtocolId ¶
func (g GzipStream) ProtocolId() protocol.ID
func (GzipStream) UpgradeRawStream ¶
UpgradeRawStream wraps gzip compression and decompression around the plain libp2p stream.
type Protocol ¶
type Protocol interface { // UpgradeRawStream wraps a specific unicast protocol implementation around // the plain libp2p stream. UpgradeRawStream(s libp2pnet.Stream) (libp2pnet.Stream, error) // Handler is a libp2p stream handler that implements the logic of handling // an established incoming stream to this node. Handler(stream libp2pnet.Stream) // ProtocolId returns the libp2p protocol id associated to this protocol. In libp2p // streams running with the same protocol are identified with the same protocol id. ProtocolId() protocol.ID }
Protocol represents a unicast protocol.
type ProtocolFactory ¶
type ProtocolFactory func(zerolog.Logger, flow.Identifier, libp2pnet.StreamHandler) Protocol
func ToProtocolFactory ¶
func ToProtocolFactory(name ProtocolName) (ProtocolFactory, error)
type ProtocolName ¶
type ProtocolName string
func ToProtocolNames ¶
func ToProtocolNames(names []string) []ProtocolName
Click to show internal directories.
Click to hide internal directories.