libp2p-hs-0.1.0.0: Haskell implementation of the libp2p networking stack
Safe HaskellNone
LanguageGHC2021

Network.LibP2P.Multiaddr.Multiaddr

Description

A multiaddr is a binary-encoded, composable network address that describes the entire protocol stack needed to reach a peer.

Synopsis

Documentation

newtype Multiaddr Source #

A multiaddr is a list of protocol components.

Constructors

Multiaddr [Protocol] 

Instances

Instances details
Show Multiaddr Source # 
Instance details

Defined in Network.LibP2P.Multiaddr.Multiaddr

Eq Multiaddr Source # 
Instance details

Defined in Network.LibP2P.Multiaddr.Multiaddr

fromText :: Text -> Either String Multiaddr Source #

Parse a multiaddr from its text representation (e.g. "ip4127.0.0.1tcp4001").

toText :: Multiaddr -> Text Source #

Render a multiaddr as text.

fromBytes :: ByteString -> Either String Multiaddr Source #

Parse a multiaddr from binary format.

toBytes :: Multiaddr -> ByteString Source #

Encode a multiaddr to binary format.

encapsulate :: Multiaddr -> Multiaddr -> Multiaddr Source #

Encapsulate: append another multiaddr's protocols.

protocols :: Multiaddr -> [Protocol] Source #

Get the list of protocols in a multiaddr.

splitP2P :: Multiaddr -> Maybe (Multiaddr, PeerId) Source #

Split off the trailing p2ppeerId component from a multiaddr. Returns the transport address and the peer ID, or Nothing if the multiaddr does not end with a p2p component.