| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Network.Ping
Synopsis
- pingClients :: PingOpts -> [Address ('Unresolved 'SRVOrFilePathUnresolved)] -> IO ()
- pingClients' :: Tracer IO (WithHost LogMsg) -> Tracer IO (WithHost LogInfoMsg) -> Tracer IO Header -> Tracer IO PingWarning -> PingOpts -> AcceptFilePath -> [Address ('Unresolved 'SRVOrFilePathUnresolved)] -> IO [PingException]
- pingClient :: Tracer IO (WithHost LogMsg) -> Tracer IO (WithHost LogInfoMsg) -> Tracer IO Header -> Tracer IO PingWarning -> PingOpts -> AddrInfo -> IO (Either PingClientException ())
- data PingOpts = PingOpts {}
- data Stage
- data ResolvedSRVOrFilePath
- data Address (stage :: Stage) where
- mkAddress :: String -> Address ('Unresolved 'SRVOrFilePathUnresolved)
- cmdlineParser :: Parser (PingOpts, [Address ('Unresolved 'SRVOrFilePathUnresolved)])
- data PingMode
- data AcceptFilePath
- data LogFormat
- data ColorMode
- data PingWarning
- = AddressResolutionError AddressResolutionError
- | DNSResolution Domain [IP] Word
- | Error SomeException
- | ConnectError SockAddr SomeException
- data PingException
- = AddressResolutionException AddressResolutionError
- | PingClientException PingClientException
- data WithHost a = WithHost SockAddr a
- data LogMsg
- data StatPoint = StatPoint {}
- mkStdOutTracer :: IO (Tracer IO Text)
- mkStdErrTracer :: IO (Tracer IO Text)
- mkHeaderTracer :: PingOpts -> Tracer IO Text -> IO (Tracer IO Header)
- format :: (ToText a, ToJSON a) => LogFormat -> a -> Text
- class ToText a where
- data PingClientException
- = ProtocolLimitException ProtocolLimitFailure SockAddr
- | Show versionNumber => HandshakeException (HandshakeProtocolError versionNumber) SockAddr
- | IOException IOError SockAddr
- | DecodingException DeserialiseFailure SockAddr
- | MuxException Error SockAddr
- mainnetMagic :: NetworkMagic
- newtype NetworkMagic = NetworkMagic {}
API
pingClients :: PingOpts -> [Address ('Unresolved 'SRVOrFilePathUnresolved)] -> IO () Source #
Arguments
| :: Tracer IO (WithHost LogMsg) | trace log messages |
| -> Tracer IO (WithHost LogInfoMsg) | info messages (e.g. RTTs, negotiated version numbers) |
| -> Tracer IO Header | print header for ping measurements or tip information; it should be enabled if the first tracer is enabled. |
| -> Tracer IO PingWarning | trace warning messages |
| -> PingOpts | options for the ping command |
| -> AcceptFilePath | accept file paths as addresses; if set to |
| -> [Address ('Unresolved 'SRVOrFilePathUnresolved)] | |
| -> IO [PingException] | returns two list:
* list of resolve errors (printed with |
A low level API which returns all address resolution & clients errors.
Arguments
| :: Tracer IO (WithHost LogMsg) | stdout |
| -> Tracer IO (WithHost LogInfoMsg) | info tracer |
| -> Tracer IO Header | |
| -> Tracer IO PingWarning | stderr |
| -> PingOpts | |
| -> AddrInfo | |
| -> IO (Either PingClientException ()) |
Run a single ping client.
Options and arguments
Constructors
| PingOpts | |
Fields
| |
There are three stages for resolving addresses.
- SRV might be a file path or a DNS name or an SRV record
- SRV was resolved as an SRV record, if not
- try to resolve it as a DNS name
- if failed, try to use it as a file path
See resolveAddress
Constructors
| Unresolved ResolvedSRVOrFilePath | |
| Resolved |
data ResolvedSRVOrFilePath Source #
Constructors
| SRVOrFilePathUnresolved | |
| SRVOrFilePathResolved |
data Address (stage :: Stage) where Source #
Instances
| Show (Address resolved) Source # | |
| Eq (Address 'Resolved) Source # | |
| Ord (Address 'Resolved) Source # | |
Defined in Cardano.Network.Ping Methods compare :: Address 'Resolved -> Address 'Resolved -> Ordering # (<) :: Address 'Resolved -> Address 'Resolved -> Bool # (<=) :: Address 'Resolved -> Address 'Resolved -> Bool # (>) :: Address 'Resolved -> Address 'Resolved -> Bool # (>=) :: Address 'Resolved -> Address 'Resolved -> Bool # max :: Address 'Resolved -> Address 'Resolved -> Address 'Resolved # min :: Address 'Resolved -> Address 'Resolved -> Address 'Resolved # | |
mkAddress :: String -> Address ('Unresolved 'SRVOrFilePathUnresolved) Source #
A smart constructor for Address type.
cmdlineParser :: Parser (PingOpts, [Address ('Unresolved 'SRVOrFilePathUnresolved)]) Source #
Instances
data AcceptFilePath Source #
resolveAddress has two modes of operations. It can try to resolve an
Address to a FilePath, or not. In the latter case the errors will be
more precise. It is useful when validating an srv record domain names ip
addresses.
Constructors
| AddressMightBeAFilePath | |
| AddressIsNotAFilePath |
Constructors
| ColorAuto | |
| ColorNever | |
| ColorAlways |
Log messages
data PingWarning Source #
Log messages to stderr.
Constructors
| AddressResolutionError AddressResolutionError | |
| DNSResolution Domain [IP] Word | |
| Error SomeException | |
| ConnectError SockAddr SomeException |
Instances
| ToText PingWarning Source # | |
Defined in Cardano.Network.Ping Methods toText :: PingWarning -> Text Source # | |
data PingException Source #
Constructors
| AddressResolutionException AddressResolutionError | |
| PingClientException PingClientException |
Instances
| Exception PingException Source # | |
Defined in Cardano.Network.Ping Methods toException :: PingException -> SomeException # fromException :: SomeException -> Maybe PingException # displayException :: PingException -> String # backtraceDesired :: PingException -> Bool # | |
| Show PingException Source # | |
Defined in Cardano.Network.Ping Methods showsPrec :: Int -> PingException -> ShowS # show :: PingException -> String # showList :: [PingException] -> ShowS # | |
Log messages to stdout.
Constructors
Formatting log messages
Instances
| ToText NodeToClientVersion Source # | |
Defined in Cardano.Network.Ping Methods toText :: NodeToClientVersion -> Text Source # | |
| ToText NodeToNodeVersion Source # | |
Defined in Cardano.Network.Ping Methods toText :: NodeToNodeVersion -> Text Source # | |
| ToText LogMsg Source # | |
| ToText PingWarning Source # | |
Defined in Cardano.Network.Ping Methods toText :: PingWarning -> Text Source # | |
| ToText Text Source # | |
| ToText String Source # | |
| ToText a => ToText (WithHost a) Source # | |
Exceptions
data PingClientException Source #
Constructors
| ProtocolLimitException ProtocolLimitFailure SockAddr | protocol limit error |
| Show versionNumber => HandshakeException (HandshakeProtocolError versionNumber) SockAddr | handshake protocol error |
| IOException IOError SockAddr | IO errors |
| DecodingException DeserialiseFailure SockAddr | cbor exceptions |
| MuxException Error SockAddr | mux exceptions |
Instances
| Exception PingClientException Source # | |
Defined in Cardano.Network.Ping | |
| Show PingClientException Source # | |
Defined in Cardano.Network.Ping Methods showsPrec :: Int -> PingClientException -> ShowS # show :: PingClientException -> String # showList :: [PingClientException] -> ShowS # | |
Cardano main-net configuration
Re-exports
newtype NetworkMagic #
Constructors
| NetworkMagic | |
Fields | |