utils

package
v0.37.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowedSubscription

func AllowedSubscription(role flow.Role, topic string) bool

AllowedSubscription returns true if the given role is allowed to subscribe to the topic.

func MessageID added in v0.29.0

func MessageID(data []byte) string

MessageID returns the hash of the given data (used to generate the message ID for pubsub messages).

func MultiAddressStr

func MultiAddressStr(ip, port string) string

MultiAddressStr receives a node ip and port and returns its corresponding Libp2p MultiAddressStr in string format in current implementation IP part of the node address is either an IP or a dns4. https://docs.libp2p.io/concepts/addressing/

func PeerAddressInfo

func PeerAddressInfo(identity flow.IdentitySkeleton) (peer.AddrInfo, error)

PeerAddressInfo generates the libp2p peer.AddrInfo for the given Flow.Identity. A node in flow is defined by a flow.Identity while it is defined by a peer.AddrInfo in libp2p.

flow.Identity        ---> peer.AddrInfo
|-- Address          --->   |-- []multiaddr.Multiaddr
|-- NetworkPublicKey --->   |-- ID

func PeerInfosFromIDs

func PeerInfosFromIDs(ids flow.IdentityList) ([]peer.AddrInfo, map[flow.Identifier]error)

PeerInfosFromIDs converts the given flow.Identity to peer.AddrInfo. For each identity, if the conversion succeeds, the peer.AddrInfo is included in the result else it is included in the error map with the corresponding error

func TopicScoreParamsLogger added in v0.32.0

func TopicScoreParamsLogger(logger zerolog.Logger, topicName string, topicParams *pubsub.TopicScoreParams) zerolog.Logger

TopicScoreParamsLogger is a helper function that returns a logger with the topic score params added as fields. Args: logger: zerolog.Logger - logger to add fields to topicName: string - name of the topic params: pubsub.TopicScoreParams - topic score params

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL