utils

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: AGPL-3.0 Imports: 8 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.Identity) (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.Identities 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

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