quic-0.2.14: QUIC
Safe HaskellNone
LanguageHaskell2010

Network.QUIC.Client

Description

This main module provides APIs for QUIC clients.

Synopsis

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 #

If True, use a connected socket. Otherwise, use a unconnected socket.

Default: False

ccWatchDog :: ClientConfig -> Bool Source #

If True, a watch dog thread is spawned and migrate is called when network events are observed.

Default: False

Resumption

data ResumptionInfo Source #

Information about resumption

Instances

Instances details
Generic ResumptionInfo Source # 
Instance details

Defined in Network.QUIC.Types.Resumption

Associated Types

type Rep ResumptionInfo 
Instance details

Defined in Network.QUIC.Types.Resumption

type Rep ResumptionInfo = D1 ('MetaData "ResumptionInfo" "Network.QUIC.Types.Resumption" "quic-0.2.14-4y5RJLeDlnOKTB2lFP0ffp" 'False) (C1 ('MetaCons "ResumptionInfo" 'PrefixI 'True) (((S1 ('MetaSel ('Just "resumptionVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Version) :*: S1 ('MetaSel ('Just "resumptionSession") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(SessionID, SessionData)])) :*: (S1 ('MetaSel ('Just "resumptionToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Token) :*: (S1 ('MetaSel ('Just "resumptionRetry") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "resumptionActiveConnectionIdLimit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))) :*: ((S1 ('MetaSel ('Just "resumptionInitialMaxData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Just "resumptionInitialMaxStreamDataBidiLocal") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "resumptionInitialMaxStreamDataBidiRemote") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))) :*: (S1 ('MetaSel ('Just "resumptionInitialMaxStreamDataUni") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Just "resumptionInitialMaxStreamsBidi") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "resumptionInitialMaxStreamsUni") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))))))
Show ResumptionInfo Source # 
Instance details

Defined in Network.QUIC.Types.Resumption

Eq ResumptionInfo Source # 
Instance details

Defined in Network.QUIC.Types.Resumption

Serialise ResumptionInfo Source # 
Instance details

Defined in Network.QUIC.Types.Resumption

type Rep ResumptionInfo Source # 
Instance details

Defined in Network.QUIC.Types.Resumption

type Rep ResumptionInfo = D1 ('MetaData "ResumptionInfo" "Network.QUIC.Types.Resumption" "quic-0.2.14-4y5RJLeDlnOKTB2lFP0ffp" 'False) (C1 ('MetaCons "ResumptionInfo" 'PrefixI 'True) (((S1 ('MetaSel ('Just "resumptionVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Version) :*: S1 ('MetaSel ('Just "resumptionSession") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(SessionID, SessionData)])) :*: (S1 ('MetaSel ('Just "resumptionToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Token) :*: (S1 ('MetaSel ('Just "resumptionRetry") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "resumptionActiveConnectionIdLimit") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))) :*: ((S1 ('MetaSel ('Just "resumptionInitialMaxData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Just "resumptionInitialMaxStreamDataBidiLocal") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "resumptionInitialMaxStreamDataBidiRemote") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))) :*: (S1 ('MetaSel ('Just "resumptionInitialMaxStreamDataUni") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: (S1 ('MetaSel ('Just "resumptionInitialMaxStreamsBidi") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "resumptionInitialMaxStreamsUni") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))))))

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.