cometa-0.1.0.0: Idiomatic Haskell bindings to cardano-c
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cometa.Pool.Relay

Description

Stake-pool relays with validated network-order addresses and DNS text. Ports and addresses may legitimately be absent.

SingleHostAddress Nothing Nothing Nothing represents an unspecified relay.

Synopsis

Documentation

data Ipv4 Source #

IPv4 address in network byte order. Equality and ordering compare bytes.

Instances

Instances details
Show Ipv4 Source # 
Instance details

Defined in Cometa.Internal.Pool

Methods

showsPrec :: Int -> Ipv4 -> ShowS #

show :: Ipv4 -> String #

showList :: [Ipv4] -> ShowS #

Eq Ipv4 Source # 
Instance details

Defined in Cometa.Internal.Pool

Methods

(==) :: Ipv4 -> Ipv4 -> Bool #

(/=) :: Ipv4 -> Ipv4 -> Bool #

Ord Ipv4 Source # 
Instance details

Defined in Cometa.Internal.Pool

Methods

compare :: Ipv4 -> Ipv4 -> Ordering #

(<) :: Ipv4 -> Ipv4 -> Bool #

(<=) :: Ipv4 -> Ipv4 -> Bool #

(>) :: Ipv4 -> Ipv4 -> Bool #

(>=) :: Ipv4 -> Ipv4 -> Bool #

max :: Ipv4 -> Ipv4 -> Ipv4 #

min :: Ipv4 -> Ipv4 -> Ipv4 #

ipv4FromBytes :: ByteString -> Either Error Ipv4 Source #

Validate an exact four-byte network-order IPv4 address. Wrong lengths return InvalidPoolIpLength with expected and actual lengths.

ipv4Bytes :: Ipv4 -> ByteString Source #

Exact four-byte address.

ipv4FromText :: Text -> Either Error Ipv4 Source #

Parse four decimal octets, each 0 through 255, separated by dots. Leading zeros are accepted; signs, whitespace and empty octets are rejected. Malformed input returns InvalidPoolIpText with a diagnostic.

ipv4Text :: Ipv4 -> Text Source #

Canonical dotted decimal, without leading zeros.

data Ipv6 Source #

IPv6 address in network byte order. Equality and ordering compare bytes.

Instances

Instances details
Show Ipv6 Source # 
Instance details

Defined in Cometa.Internal.Pool

Methods

showsPrec :: Int -> Ipv6 -> ShowS #

show :: Ipv6 -> String #

showList :: [Ipv6] -> ShowS #

Eq Ipv6 Source # 
Instance details

Defined in Cometa.Internal.Pool

Methods

(==) :: Ipv6 -> Ipv6 -> Bool #

(/=) :: Ipv6 -> Ipv6 -> Bool #

Ord Ipv6 Source # 
Instance details

Defined in Cometa.Internal.Pool

Methods

compare :: Ipv6 -> Ipv6 -> Ordering #

(<) :: Ipv6 -> Ipv6 -> Bool #

(<=) :: Ipv6 -> Ipv6 -> Bool #

(>) :: Ipv6 -> Ipv6 -> Bool #

(>=) :: Ipv6 -> Ipv6 -> Bool #

max :: Ipv6 -> Ipv6 -> Ipv6 #

min :: Ipv6 -> Ipv6 -> Ipv6 #

ipv6FromBytes :: ByteString -> Either Error Ipv6 Source #

Validate an exact sixteen-byte network-order IPv6 address.

ipv6Bytes :: Ipv6 -> ByteString Source #

Exact sixteen-byte address.

ipv6FromText :: Text -> Either Error Ipv6 Source #

Parse IPv6 hexadecimal groups, accepting a single :: compression and an optional final dotted IPv4 address. Hexadecimal letter case is ignored; signs, whitespace, repeated compression and incorrect group counts return InvalidPoolIpText.

ipv6Text :: Ipv6 -> Text Source #

Lowercase, fully expanded IPv6 text with eight four-digit groups.

data DnsName Source #

Relay DNS label, containing 1 through 64 UTF-8 bytes and no NUL. DNS syntax and reachability are not checked. Comparison uses text.

Instances

Instances details
Show DnsName Source # 
Instance details

Defined in Cometa.Internal.Pool

Eq DnsName Source # 
Instance details

Defined in Cometa.Internal.Pool

Methods

(==) :: DnsName -> DnsName -> Bool #

(/=) :: DnsName -> DnsName -> Bool #

Ord DnsName Source # 
Instance details

Defined in Cometa.Internal.Pool

mkDnsName :: Text -> Either Error DnsName Source #

Validate 1 through 64 UTF-8 bytes and reject NUL, returning InvalidPoolDnsName on either violation. DNS syntax is not checked.

dnsNameText :: DnsName -> Text Source #

Original DNS text.

data Relay Source #

Relay alternatives. Ordering follows CBOR codes, then constructor fields. Ports are unsigned 16-bit port numbers; absent fields encode as null.

Constructors

SingleHostAddress !(Maybe Word16) !(Maybe Ipv4) !(Maybe Ipv6)

IP relay: optional port, IPv4 and IPv6. All may be absent.

SingleHostName !(Maybe Word16) !DnsName

A or AAAA DNS record, with optional port.

MultiHostName !DnsName

SRV DNS record; its port is supplied by DNS.

Instances

Instances details
Show Relay Source # 
Instance details

Defined in Cometa.Internal.Pool

Methods

showsPrec :: Int -> Relay -> ShowS #

show :: Relay -> String #

showList :: [Relay] -> ShowS #

Eq Relay Source # 
Instance details

Defined in Cometa.Internal.Pool

Methods

(==) :: Relay -> Relay -> Bool #

(/=) :: Relay -> Relay -> Bool #

Ord Relay Source # 
Instance details

Defined in Cometa.Internal.Pool

Methods

compare :: Relay -> Relay -> Ordering #

(<) :: Relay -> Relay -> Bool #

(<=) :: Relay -> Relay -> Bool #

(>) :: Relay -> Relay -> Bool #

(>=) :: Relay -> Relay -> Bool #

max :: Relay -> Relay -> Relay #

min :: Relay -> Relay -> Relay #

encodeCbor :: Relay -> ByteString Source #

Fresh definite CBOR with shortest integer encodings. Re-encoding semantic data may change transaction identity.

decodeCbor :: ByteString -> Either Error Relay Source #

Decode the complete value. Definite or indefinite arrays and nonminimal unsigned integers are accepted. All field bounds, arities, UTF-8 and trailing bytes are checked; violations return InvalidPoolCbor. The original encoding is not retained.