Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Network.PeerSelection.RootPeersDNS.DNSActions
Synopsis
- data DNSActions peerAddr resolver (m :: Type -> Type) = DNSActions {
- dnsResolverResource :: ResolvConf -> m (Resource m (Either DNSorIOError resolver))
- dnsAsyncResolverResource :: ResolvConf -> m (Resource m (Either DNSorIOError resolver))
- dnsLookupWithTTL :: DNSPeersKind -> RelayAccessPoint -> ResolvConf -> resolver -> StdGen -> m (DNSLookupResult peerAddr)
- data PeerActionsDNS peeraddr resolver (m :: Type -> Type) = PeerActionsDNS {
- paToPeerAddr :: IP -> PortNumber -> peeraddr
- paDnsActions :: DNSActions peeraddr resolver m
- type SRVPrefix = Domain
- ioDNSActions :: Tracer IO DNSTrace -> DNSLookupType -> (IP -> PortNumber -> peerAddr) -> DNSActions peerAddr Resolver IO
- data DNSLookupType
- type DNSLookupResult peerAddr = Either [DNSError] [(peerAddr, TTL)]
- newtype Resource (m :: Type -> Type) a = Resource {
- withResource :: m (a, Resource m a)
- retryResource :: forall (m :: Type -> Type) e a. MonadDelay m => Tracer m e -> NonEmpty DiffTime -> Resource m (Either e a) -> Resource m a
- constantResource :: forall (m :: Type -> Type) a. Applicative m => a -> Resource m a
- dispatchLookupWithTTL :: MonadAsync m => DNSLookupType -> (resolver -> resolvConf -> Domain -> TYPE -> m (Maybe (Either DNSError DNSMessage))) -> Tracer m DNSTrace -> (IP -> PortNumber -> peerAddr) -> DNSPeersKind -> RelayAccessPoint -> resolvConf -> resolver -> StdGen -> m (DNSLookupResult peerAddr)
- data DNSorIOError
- data DNSTrace
- data DNSPeersKind
DNS based actions for local and public root providers
data DNSActions peerAddr resolver (m :: Type -> Type) Source #
Dictionary of DNS actions vocabulary
Constructors
DNSActions | |
Fields
|
data PeerActionsDNS peeraddr resolver (m :: Type -> Type) Source #
Record of some parameters that are commonly used together
TODO: rename as PeerDNSActions
; can we bundle paToPeerAddr
with
DNSActions
?
Constructors
PeerActionsDNS | |
Fields
|
DNSActions IO
ioDNSActions :: Tracer IO DNSTrace -> DNSLookupType -> (IP -> PortNumber -> peerAddr) -> DNSActions peerAddr Resolver 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.
data DNSLookupType Source #
Constructors
LookupReqAOnly | |
LookupReqAAAAOnly | |
LookupReqAAndAAAA |
Instances
Show DNSLookupType Source # | |
Defined in Ouroboros.Network.PeerSelection.RootPeersDNS.DNSActions Methods showsPrec :: Int -> DNSLookupType -> ShowS # show :: DNSLookupType -> String # showList :: [DNSLookupType] -> ShowS # |
type DNSLookupResult peerAddr = Either [DNSError] [(peerAddr, TTL)] Source #
Wraps lookup result for client code
Utils
Resource
newtype Resource (m :: Type -> Type) 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
|
retryResource :: forall (m :: Type -> Type) e a. MonadDelay m => Tracer m e -> NonEmpty DiffTime -> Resource m (Either e a) -> Resource m a Source #
constantResource :: forall (m :: Type -> Type) a. Applicative m => a -> Resource m a Source #
Exposed for testing purposes
dispatchLookupWithTTL :: MonadAsync m => DNSLookupType -> (resolver -> resolvConf -> Domain -> TYPE -> m (Maybe (Either DNSError DNSMessage))) -> Tracer m DNSTrace -> (IP -> PortNumber -> peerAddr) -> DNSPeersKind -> RelayAccessPoint -> resolvConf -> resolver -> StdGen -> m (DNSLookupResult peerAddr) Source #
Error type
data DNSorIOError Source #
Instances
Exception DNSorIOError Source # | |
Defined in Ouroboros.Network.PeerSelection.RootPeersDNS.DNSActions Methods toException :: DNSorIOError -> SomeException # fromException :: SomeException -> Maybe DNSorIOError # displayException :: DNSorIOError -> String # backtraceDesired :: DNSorIOError -> Bool # | |
Show DNSorIOError Source # | |
Defined in Ouroboros.Network.PeerSelection.RootPeersDNS.DNSActions Methods showsPrec :: Int -> DNSorIOError -> ShowS # show :: DNSorIOError -> String # showList :: [DNSorIOError] -> ShowS # |
Tracing types
Provides DNS lookup trace information
Constructors
DNSLookupResult | DNS lookup result |
Fields
| |
DNSLookupError DNSPeersKind (Maybe DNSLookupType) Domain DNSError |
|
SRVLookupResult DNSPeersKind Domain [(Domain, Word16, Word16, Word16, TTL)] | |
SRVLookupError |
|
Fields
|
data DNSPeersKind Source #
Bundled with DNS lookup trace for observability
Constructors
DNSLocalPeer | |
DNSPublicPeer | |
DNSLedgerPeer LedgerPeersKind |
Instances
Show DNSPeersKind Source # | |
Defined in Ouroboros.Network.PeerSelection.RootPeersDNS.DNSActions Methods showsPrec :: Int -> DNSPeersKind -> ShowS # show :: DNSPeersKind -> String # showList :: [DNSPeersKind] -> ShowS # |