MyNixOS website logo
Description

Networking layer for Cloud Haskell based on QUIC.

Networking layer for Cloud Haskell based on QUIC.

The QUIC protocol has several advantages over TCP, including built-in encryption via TLS 1.3, support for connection migration (e.g. when transitioning from WIFI to 5G), and stream multiplexing which eliminates head-of-line blocking.

In dense network topologies, using [Network.Transport.QUIC] may improve performance by a factor of 2 over other transport implementations.

network-transport-quic

This package provides an implementation of the network-transport interface, where networking is done via the QUIC protocol. The primary use-case for this package is as a Cloud Haskell backend.

QUIC has many advantages over TCP, including:

  • No head-of-line blocking. Independent streams mean packet loss on one stream doesn't stall others;
  • Connection migration. Connections survive IP address changes, which is important when a device switches from e.g. WIFI to 5G;
  • Built-in encryption via TLS 1.3;

In benchmarks, network-transport-quic performs better than network-transport-tcp in dense network topologies. For example, if every EndPoint in your network connects to every other EndPoint, you might benefit greatly from switching to network-transport-quic!

Usage example

Provided you have a TLS 1.3 certificate, you can create a Transport like so:

import Data.List.NonEmpty qualified as NonEmpty
import Network.Transport.QUIC (QUICTransportConfig(..), createTransport, credentialLoadX509)

main = do
    let certificate = "path/to/cert.crt"
        key = "path/to/cert.key"

    creds <- credentialLoadX509 certificate key
    case creds of
        Left error_message -> error error_message
        Right credential -> do
            let config = QUICTransportConfig
                            { hostName = "my.hostname.com" -- or some IP address
                            , serviceName = "https" -- alternatively, some port number
                            , credentials = NonEmpty.singleton credential
                            , validateCredentials = True -- should be 'False' for self-signed certificate
                            }
            transport <- createTransport config
            ...

There are tools online to help create self-signed TLS 1.3 certificates.

Metadata

Version

0.1.1

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows