ouroboros-network-0.10.1.0: A networking layer for the Ouroboros blockchain protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Ouroboros.Network.PeerSelection.RootPeersDNS.DNSActions

Synopsis

DNS based actions for local and public root providers

data DNSActions resolver exception m Source #

Dictionary of DNS actions vocabulary

Constructors

DNSActions 

Fields

  • dnsResolverResource :: ResolvConf -> m (Resource m (Either (DNSorIOError exception) resolver))

    TODO: it could be useful for publicRootPeersProvider.

  • dnsAsyncResolverResource :: ResolvConf -> m (Resource m (Either (DNSorIOError exception) resolver))

    Resource which passes the Resolver (or abstract resolver type) through a StrictTVar. Better than resolverResource when using in multiple threads.

    On Windows we use a different implementation which always returns a newly initialised Resolver at each step. This is because on Windows we don't have a way to check that the network configuration has changed. The dns library is using 'GetNetworkParams@ win32 api call to get the list of default dns servers.

  • dnsLookupWithTTL :: ResolvConf -> resolver -> Domain -> m ([DNSError], [(IP, TTL)])

    Like lookupA but also return the TTL for the results.

    DNS library timeouts do not work reliably on Windows (#1873), hence the additional timeout.

DNSActions IO

ioDNSActions :: DNSLookupType -> DNSActions Resolver IOException IO Source #

IO DNSActions which resolve domain names with Resolver.

The IPv4 and IPv6 addresses the node will be using should determine the LookupReqs so that we can avoid lookups for address types that wont be used.

It guarantees that returned TTLs are strictly greater than 0.

Utils

Resource

newtype Resource m a Source #

Evolving resource; We use it to reinitialise the DNS library if the `etcresolv.conf` file was modified.

Note: constantResource and retryResource are written using a simplified approach inspired by _"The Different Aspects of Monads and Mixins"_, by Bruno C. d S. Oliveira, see https://www.youtube.com/watch?v=pfwP4hXM5hA.

Constructors

Resource 

Fields

Instances

Instances details
Functor m => Functor (Resource m) Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RootPeersDNS.DNSActions

Methods

fmap :: (a -> b) -> Resource m a -> Resource m b Source #

(<$) :: a -> Resource m b -> Resource m a Source #

retryResource :: forall m e a. MonadDelay m => Tracer m e -> NonEmpty DiffTime -> Resource m (Either e a) -> Resource m a Source #

A Resource which will exhibit the given Resource but retry it with a given delay until a success. On first success it will reset the delays.

constantResource :: forall m a. Applicative m => a -> Resource m a Source #

Error type

data DNSorIOError exception Source #

Constructors

DNSError !DNSError 
IOError !exception 

Instances

Instances details
Exception exception => Exception (DNSorIOError exception) Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RootPeersDNS.DNSActions

Show exception => Show (DNSorIOError exception) Source # 
Instance details

Defined in Ouroboros.Network.PeerSelection.RootPeersDNS.DNSActions

Methods

showsPrec :: Int -> DNSorIOError exception -> ShowS Source #

show :: DNSorIOError exception -> String Source #

showList :: [DNSorIOError exception] -> ShowS Source #