p2putils

package
v0.28.8 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowAllPeerFilter

func AllowAllPeerFilter() p2p.PeerFilter

AllowAllPeerFilter returns a peer filter that does not do any filtering.

func ConnectednessToString

func ConnectednessToString(connectedness network.Connectedness) (string, bool)

ConnectednessToString reverse translates libp2p network connectedness to string

func CountStream

func CountStream(host host.Host, targetID peer.ID, protocol core.ProtocolID, dir network.Direction) int

CountStream finds total number of outbound stream to the target id

func DirectionToString

func DirectionToString(direction network.Direction) (string, bool)

DirectionToString reverse translates libp2p network direction to string

func FilterStream

func FilterStream(host host.Host, targetID peer.ID, protocol core.ProtocolID, dir network.Direction, all bool) []network.Stream

FilterStream finds one or all existing outbound streams to the target id if it exists. if parameter all is true - all streams are found else the first stream found is returned

func FindOutboundStream

func FindOutboundStream(host host.Host, targetID peer.ID, protocol core.ProtocolID) (network.Stream, bool)

FindOutboundStream finds an existing outbound stream to the target id if it exists by querying libp2p

func FlowStream

func FlowStream(conn network.Conn) network.Stream

FlowStream returns the Flow protocol Stream in the connection if one exist, else it returns nil

func IPPortFromMultiAddress

func IPPortFromMultiAddress(addrs ...multiaddr.Multiaddr) (string, string, error)

IPPortFromMultiAddress returns the IP/hostname and the port for the given multi-addresses associated with a libp2p host

func NetworkingInfo

func NetworkingInfo(identity flow.Identity) (string, string, crypto.PubKey, error)

NetworkingInfo returns ip, port, libp2p public key of the identity.

func StreamLogger

func StreamLogger(log zerolog.Logger, stream network.Stream) zerolog.Logger

StreamLogger creates a logger for libp2p stream which logs the remote and local peer IDs and addresses

Types

This section is empty.

Jump to

Keyboard shortcuts

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