quic

QUIC protocol implementation

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version 0.5.2
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-28 04:35

Tags

Authors

  • Status Research & Development GmbH

Installation

nimble install quic
choosenim install quic
git clone https://github.com/vacp2p/nim-quic

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
quic - - - - - - -

Dependencies

Package Version Optional
nim >= 2.0.0 No
stew >= 0.4.0 No
chronos >= 4.0.4 No
nimcrypto >= 0.6.0 No
ngtcp2 >= 0.39.0 No
unittest2 - No
chronicles >= 0.11.0 No
bearssl >= 0.2.5 No

Source

Repository https://github.com/vacp2p/nim-quic
Homepage https://github.com/vacp2p/nim-quic
Registry Source nimble_official

README

QUIC for Nim

An implementation of the QUIC protocol in Nim.

Building and testing

Install dependencies:

nimble install -d

Run tests:

nimble test

Examples

Import quic and the chronos async library:

import quic
import chronos

Create server:

let tlsConfig = TLSConfig.init(cert, certPrivateKey, @["alpn"], Opt.none(CertificateVerifier))
let server = QuicServer.init(tlsConfig)

Accept incoming connections:

let address = initTAddress("127.0.0.1:12345")
let listener = server.listen(address)
defer:
  await listener.stop()
  listener.destroy()

while true:
  let connection =
    try:
      await listener.accept()
    except CatchableError:
      return # server stopped
  let stream = await connection.incomingStream()

  # read or write data to stream
  let data = await stream.read()

  await stream.close()
  await connection.waitClosed()

Create client:

let tlsConfig = TLSConfig.init(cert, certPrivateKey, @["alpn"], Opt.none(CertificateVerifier))
let client = QuicClient.init(tlsConfig)

Dial server and send message:

let address = initTAddress("127.0.0.1:12345")
let connection = await client.dial(address)
defer:
  await connection.close()

let stream = await connection.openStream()
let message = cast[seq[byte]]("hello form nim quic client")
await stream.write(message)
await stream.close()

Thanks

We would like to thank the authors of the NGTCP2 library, on whose work we're building.