Safe Haskell | None |
---|---|
Language | Haskell2010 |
Network.QUIC.Client
Description
This main module provides APIs for QUIC clients.
Synopsis
- run :: ClientConfig -> (Connection -> IO a) -> IO a
- data ClientConfig
- defaultClientConfig :: ClientConfig
- ccServerName :: ClientConfig -> HostName
- ccServerNameOverride :: ClientConfig -> Maybe HostName
- ccPortName :: ClientConfig -> ServiceName
- ccALPN :: ClientConfig -> Version -> IO (Maybe [ByteString])
- ccUse0RTT :: ClientConfig -> Bool
- ccResumption :: ClientConfig -> ResumptionInfo
- ccCiphers :: ClientConfig -> [Cipher]
- ccGroups :: ClientConfig -> [Group]
- ccVersions :: ClientConfig -> [Version]
- ccValidate :: ClientConfig -> Bool
- ccSockConnected :: ClientConfig -> Bool
- ccWatchDog :: ClientConfig -> Bool
- data ResumptionInfo
- getResumptionInfo :: Connection -> IO ResumptionInfo
- isResumptionPossible :: ResumptionInfo -> Bool
- is0RTTPossible :: ResumptionInfo -> Bool
- migrate :: Connection -> IO Bool
Running a QUIC client
run :: ClientConfig -> (Connection -> IO a) -> IO a Source #
Running a QUIC client.
A UDP socket is created according to ccServerName
and ccPortName
.
Configration
data ClientConfig Source #
Client configuration.
defaultClientConfig :: ClientConfig Source #
The default value for client configuration.
ccServerName :: ClientConfig -> HostName Source #
Used to create a socket and SNI for TLS.
ccServerNameOverride :: ClientConfig -> Maybe HostName Source #
Used to specify SNI for TLS intead of ccServerName
.
ccPortName :: ClientConfig -> ServiceName Source #
Used to create a socket.
ccALPN :: ClientConfig -> Version -> IO (Maybe [ByteString]) Source #
An ALPN provider.
ccUse0RTT :: ClientConfig -> Bool Source #
Use 0-RTT on the 2nd connection if possible. client original
Default: False
ccResumption :: ClientConfig -> ResumptionInfo Source #
Use resumption on the 2nd connection if possible.
ccCiphers :: ClientConfig -> [Cipher] Source #
Cipher candidates defined in TLS 1.3.
ccGroups :: ClientConfig -> [Group] Source #
Key exchange group candidates defined in TLS 1.3.
ccVersions :: ClientConfig -> [Version] Source #
Compatible versions with ccVersion
in the preferred order.
Default: [Version2, Version1]
ccValidate :: ClientConfig -> Bool Source #
Authenticating a server based on its certificate.
Default: True
ccSockConnected :: ClientConfig -> Bool Source #
ccWatchDog :: ClientConfig -> Bool Source #
Resumption
data ResumptionInfo Source #
Information about resumption
Instances
getResumptionInfo :: Connection -> IO ResumptionInfo Source #
Getting information about resumption.
isResumptionPossible :: ResumptionInfo -> Bool Source #
Is resumption possible?
is0RTTPossible :: ResumptionInfo -> Bool Source #
Is 0RTT possible?
Migration
If ccSockConnected
is True
, a connected socket is made.
Otherwise, a unconnected socket is made.
For unconnected sockets, a preferred network IF is used according to packet routing. But since the current peer CID is used with the new local address, a bad guy can correlate the old local addresss and the new local address via the current peer CID. In other words, migration is trackable.
For connected sockets, the old local address is kept to be
used even if a preferred network IF gets available. Call the
migrate
API to use the new local address. This ensures that
a new peer CID is used for the new local address. In short,
migration is not trackable.
If ccWatchDog
is True
on Linux and macOS, a watch dog
thread is spawned and it calls migrate
when network-related
events (e.g. a new network IF is attached or the default
route is changed) are observed. This is an experimental
feature.
migrate :: Connection -> IO Bool Source #
Creating a new socket and execute a path validation
with a new connection ID. Typically, this is used
for migration in the case where ccSockConnected
is True
.
But this can also be used even when the value is False
.