gini-network-0.1.0.0

Safe HaskellNone
LanguageHaskell2010

Gini.Network.Util

Description

GINI network utility functions.

Synopsis

Documentation

ipv4FromIpv6 :: HostAddress6 -> Maybe HostAddress #

Extract an embedded IPv4 address from an IPv6 address, or return Nothing if it's a true IPv6 address.

ipv6FromIpv4 :: HostAddress -> HostAddress6 #

Embed an IPv4 address in an IPv6 address

peerFromSockAddr :: MonadThrow m => SockAddr -> m Peer #

Convert a SockAddr to a Peer. Throws an exception if the address isn't IPv4 or IPv6, or is a "null" address (all zeros).

resolveAddrs :: MonadIO m => Family -> SocketType -> HostName -> PortNumber -> m (NonEmpty SockAddr) #

Resolve a hostname to one or more SockAddrs An exception is thrown if the host cannot be resolved.

resolvePeers :: (MonadIO m, MonadThrow m) => Family -> HostName -> PortNumber -> m (NonEmpty Peer) #

Resolve a hostname to one or more Peers An exception is thrown if the host cannot be resolved.

sinkTBQueue :: MonadIO m => TBQueue i -> ConduitT i o m () #

Conduit sink to TBQueue.

sockAddrFromPeer :: MonadThrow m => Family -> Peer -> m SockAddr #

Convert a Peer to a SockAddr. An exception is thrown if the address family is not IPv4 or IPv6.

sourceTBQueue :: MonadIO m => TBQueue o -> ConduitT i o m () #

Conduit source from TBQueue.