Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
-
data
DNSActions
resolver exception m =
DNSActions
{
- dnsResolverResource :: ResolvConf -> m ( Resource m ( DNSorIOError exception) resolver)
- dnsAsyncResolverResource :: ResolvConf -> m ( Resource m ( DNSorIOError exception) resolver)
- dnsLookupWithTTL :: ResolvConf -> resolver -> Domain -> m ([ DNSError ], [( IP , TTL )])
- constantResource :: Applicative m => a -> Resource m err a
- ioDNSActions :: LookupReqs -> DNSActions Resolver IOException IO
- data LookupReqs
- localRootPeersProvider :: forall m peerAddr resolver exception. ( MonadAsync m, MonadDelay m, Eq ( Async m Void ), Ord peerAddr) => Tracer m ( TraceLocalRootPeers peerAddr exception) -> ( IP -> PortNumber -> peerAddr) -> ResolvConf -> DNSActions resolver exception m -> STM m [( Int , Map RelayAccessPoint PeerAdvertise )] -> StrictTVar m ( Seq ( Int , Map peerAddr PeerAdvertise )) -> m Void
-
data
DomainAccessPoint
=
DomainAccessPoint
{
- dapDomain :: ! Domain
- dapPortNumber :: ! PortNumber
-
data
RelayAccessPoint
where
- RelayAccessDomain ! Domain ! PortNumber
- RelayAccessAddress ! IP ! PortNumber
- pattern RelayDomainAccessPoint :: DomainAccessPoint -> RelayAccessPoint
- data IP
-
data
TraceLocalRootPeers
peerAddr exception
- = TraceLocalRootDomains [( Int , Map RelayAccessPoint PeerAdvertise )]
- | TraceLocalRootWaiting DomainAccessPoint DiffTime
- | TraceLocalRootResult DomainAccessPoint [( IP , TTL )]
- | TraceLocalRootGroups ( Seq ( Int , Map peerAddr PeerAdvertise ))
- | TraceLocalRootFailure DomainAccessPoint ( DNSorIOError exception)
- | TraceLocalRootError DomainAccessPoint SomeException
- publicRootPeersProvider :: forall peerAddr resolver exception a m. ( MonadThrow m, MonadAsync m, Exception exception, Ord peerAddr) => Tracer m TracePublicRootPeers -> ( IP -> PortNumber -> peerAddr) -> ResolvConf -> STM m [ RelayAccessPoint ] -> DNSActions resolver exception m -> (( Int -> m ( Set peerAddr, DiffTime )) -> m a) -> m a
- data TracePublicRootPeers
- resolveDomainAccessPoint :: forall exception resolver m. ( MonadThrow m, MonadAsync m, Exception exception) => Tracer m TracePublicRootPeers -> ResolvConf -> DNSActions resolver exception m -> [ DomainAccessPoint ] -> m ( Map DomainAccessPoint ( Set SockAddr ))
- data ResolvConf
- type Domain = ByteString
- type TTL = Word32
- data PortNumber
DNS based actions for local and public root providers
data DNSActions resolver exception m Source #
Dictionary of DNS actions vocabulary
DNSActions | |
|
DNS resolver IO auxiliar functions
constantResource :: Applicative m => a -> Resource m err a Source #
DNSActions IO
ioDNSActions :: LookupReqs -> DNSActions Resolver IOException IO Source #
Bundle of DNS Actions that runs in IO 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.
data LookupReqs Source #
Instances
DNS based provider for local root peers
localRootPeersProvider Source #
:: forall m peerAddr resolver exception. ( MonadAsync m, MonadDelay m, Eq ( Async m Void ), Ord peerAddr) | |
=> Tracer m ( TraceLocalRootPeers peerAddr exception) | |
-> ( IP -> PortNumber -> peerAddr) | |
-> ResolvConf | |
-> DNSActions resolver exception m | |
-> STM m [( Int , Map RelayAccessPoint PeerAdvertise )] |
input |
-> StrictTVar m ( Seq ( Int , Map peerAddr PeerAdvertise )) |
output
|
-> m Void |
Resolve
RelayAddress
-es of local root peers using dns if needed. Local
roots are provided wrapped in a
StrictTVar
, which value might change
(re-read form a config file). The resolved dns names are available through
the output
StrictTVar
.
data DomainAccessPoint Source #
A product of a
Domain
and
PortNumber
. After resolving the
domain we will use the
PortNumber
to form
SockAddr
.
DomainAccessPoint | |
|
Instances
data RelayAccessPoint Source #
A relay can have either an IP address and a port number or a domain with a port number
pattern RelayDomainAccessPoint :: DomainAccessPoint -> RelayAccessPoint |
|
Instances
A unified IP data for
IPv4
and
IPv6
.
To create this, use the data constructors. Or use
read
"192.0.2.1"
::
IP
, for example. Also,
"192.0.2.1"
can be used as literal with OverloadedStrings.
>>>
(read "192.0.2.1" :: IP) == IPv4 (read "192.0.2.1" :: IPv4)
True>>>
(read "2001:db8:00:00:00:00:00:01" :: IP) == IPv6 (read "2001:db8:00:00:00:00:00:01" :: IPv6)
True
Instances
Enum IP | |
Defined in Data.IP.Addr |
|
Eq IP |
Equality over IP addresses. Correctly compare IPv4 and IPv4-embedded-in-IPv6 addresses.
|
Data IP | |
Defined in Data.IP.Addr gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> IP -> c IP Source # gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c IP Source # toConstr :: IP -> Constr Source # dataTypeOf :: IP -> DataType Source # dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c IP ) Source # dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c IP ) Source # gmapT :: ( forall b. Data b => b -> b) -> IP -> IP Source # gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> IP -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> IP -> r Source # gmapQ :: ( forall d. Data d => d -> u) -> IP -> [u] Source # gmapQi :: Int -> ( forall d. Data d => d -> u) -> IP -> u Source # gmapM :: Monad m => ( forall d. Data d => d -> m d) -> IP -> m IP Source # gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> IP -> m IP Source # gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> IP -> m IP Source # |
|
Ord IP | |
Read IP | |
Show IP | |
IsString IP | |
Defined in Data.IP.Addr fromString :: String -> IP Source # |
|
Generic IP | |
type Rep IP | |
Defined in Data.IP.Addr
type
Rep
IP
=
D1
('
MetaData
"IP" "Data.IP.Addr" "iproute-1.7.12-7531Frr8UW3EGpk43IP3fV" '
False
) (
C1
('
MetaCons
"IPv4" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"ipv4") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedUnpack
) (
Rec0
IPv4
))
:+:
C1
('
MetaCons
"IPv6" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"ipv6") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedStrict
) (
Rec0
IPv6
)))
|
data TraceLocalRootPeers peerAddr exception Source #
TraceLocalRootDomains [( Int , Map RelayAccessPoint PeerAdvertise )] |
|
TraceLocalRootWaiting DomainAccessPoint DiffTime | |
TraceLocalRootResult DomainAccessPoint [( IP , TTL )] | |
TraceLocalRootGroups ( Seq ( Int , Map peerAddr PeerAdvertise )) |
This traces the results of the local root peer provider |
TraceLocalRootFailure DomainAccessPoint ( DNSorIOError exception) | |
TraceLocalRootError DomainAccessPoint SomeException |
Instances
( Show peerAddr, Show exception) => Show ( TraceLocalRootPeers peerAddr exception) Source # | |
Defined in Ouroboros.Network.PeerSelection.RootPeersDNS |
DNS based provider for public root peers
publicRootPeersProvider :: forall peerAddr resolver exception a m. ( MonadThrow m, MonadAsync m, Exception exception, Ord peerAddr) => Tracer m TracePublicRootPeers -> ( IP -> PortNumber -> peerAddr) -> ResolvConf -> STM m [ RelayAccessPoint ] -> DNSActions resolver exception m -> (( Int -> m ( Set peerAddr, DiffTime )) -> m a) -> m a Source #
TODO track PeerAdvertise
data TracePublicRootPeers Source #
TracePublicRootRelayAccessPoint [ RelayAccessPoint ] | |
TracePublicRootDomains [ DomainAccessPoint ] | |
TracePublicRootResult Domain [( IP , TTL )] | |
TracePublicRootFailure Domain DNSError |
Instances
resolveDomainAccessPoint :: forall exception resolver m. ( MonadThrow m, MonadAsync m, Exception exception) => Tracer m TracePublicRootPeers -> ResolvConf -> DNSActions resolver exception m -> [ DomainAccessPoint ] -> m ( Map DomainAccessPoint ( Set SockAddr )) Source #
Provides DNS resolution functionality.
DNS type re-exports
data ResolvConf Source #
Type for resolver configuration.
Use
defaultResolvConf
to create a new value.
An example to use Google's public DNS cache instead of resolv.conf:
>>>
let conf = defaultResolvConf { resolvInfo = RCHostName "8.8.8.8" }
An example to use multiple Google's public DNS cache concurrently:
>>>
let conf = defaultResolvConf { resolvInfo = RCHostNames ["8.8.8.8","8.8.4.4"], resolvConcurrent = True }
An example to disable EDNS0:
>>>
let conf = defaultResolvConf { resolvEDNS = [] }
An example to enable EDNS0 with a 1,280-bytes buffer:
>>>
let conf = defaultResolvConf { resolvEDNS = [fromEDNS0 defaultEDNS0 { udpSize = 1280 }] }
An example to enable cache:
>>>
let conf = defaultResolvConf { resolvCache = Just defaultCacheConf }
Instances
Show ResolvConf | |
Defined in Network.DNS.Types.Internal |
type Domain = ByteString Source #
Type for domain.
Socket type re-exports
data PortNumber Source #
Port number.
Use the
Num
instance (i.e. use a literal) to create a
PortNumber
value.
>>>
1 :: PortNumber
1>>>
read "1" :: PortNumber
1>>>
show (12345 :: PortNumber)
"12345">>>
50000 < (51000 :: PortNumber)
True>>>
50000 < (52000 :: PortNumber)
True>>>
50000 + (10000 :: PortNumber)
60000