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

Network.LibP2P.Multiaddr.Protocol

Description

Protocol definitions for multiaddr.

Each protocol has a numeric code and an address format. See: https://github.com/multiformats/multicodec/blob/master/table.csv

Synopsis

Documentation

data Protocol Source #

A single protocol component within a multiaddr.

Constructors

IP4 !Word32

IPv4 address (4 bytes big-endian)

IP6 !ByteString

IPv6 address (16 bytes)

TCP !Word16

TCP port

UDP !Word16

UDP port

P2P !ByteString

Peer ID as multihash bytes

QuicV1

QUIC v1 (no address)

WS

WebSocket (no address)

WSS

WebSocket Secure (no address)

DNS !Text

DNS hostname

DNS4 !Text

DNS4 hostname

DNS6 !Text

DNS6 hostname

DNSAddr !Text

DNSAddr hostname

P2PCircuit

Circuit relay marker (no address)

WebTransport

WebTransport (no address)

NoiseProto

Noise protocol marker (no address)

YamuxProto

Yamux protocol marker (no address)

Instances

Instances details
Show Protocol Source # 
Instance details

Defined in Network.LibP2P.Multiaddr.Protocol

Eq Protocol Source # 
Instance details

Defined in Network.LibP2P.Multiaddr.Protocol

protocolCode :: Protocol -> Word64 Source #

Get the multicodec code for a protocol.

protocolName :: Protocol -> Text Source #

Get the human-readable name for a protocol.

data AddressSize Source #

Address size specification for a protocol.

Constructors

Fixed !Int

Fixed number of bytes

VarIntPrefixed

Varint-length-prefixed bytes

NoAddress

No address bytes

Instances

Instances details
Show AddressSize Source # 
Instance details

Defined in Network.LibP2P.Multiaddr.Protocol

Eq AddressSize Source # 
Instance details

Defined in Network.LibP2P.Multiaddr.Protocol

protocolAddressSize :: Word64 -> Maybe AddressSize Source #

Get the address size specification for a protocol code.

codeToProtocolName :: Word64 -> Maybe Text Source #

Map protocol code to name (for text parsing).