General-purpose reliable UDP with C99 hot path and Haskell protocol logic.
A general-purpose reliable UDP networking library. C99 hot path (serialization, send/recv, ack processing, crypto) for maximum performance on any platform. Haskell protocol brain (connection state machines, congestion control, replication) for correct-by-construction logic. Successor to gbnet-hs.
nova-net
General-Purpose Reliable UDP
C99 hot path. Haskell protocol brain. Any platform with a C compiler.
What is nova-net?
A general-purpose reliable UDP networking library. C99 handles the hot path (serialization, send/recv, ack processing, crypto). Haskell handles the protocol logic (connection state machines, congestion control, replication).
- C99 hot path — packet serialization, socket I/O, ACK bitfield processing, CRC32C, ChaCha20-Poly1305. No heap allocation on the hot path.
- Haskell protocol brain — connection state machines, handshake orchestration, congestion control, replication. Pure, testable, correct-by-construction.
- Unsafe FFI boundary — Haskell calls C with zero marshalling overhead. Just a function pointer jump.
- Any platform — C99 core compiles everywhere. Link from Haskell, Swift, Kotlin, Python, Zig, anything.
- Effect abstraction —
MonadNetworktypeclass enables pure deterministic testing with no real sockets.
Architecture
┌─────────────────────────────────────────┐
│ User Application │
├─────────────────────────────────────────┤
│ Haskell Protocol Brain │
│ Connection, Peer, Handshake, │
│ Congestion, Replication │
├─────────────────────────────────────────┤
│ Unsafe FFI Boundary │
│ foreign import ccall unsafe │
├─────────────────────────────────────────┤
│ C99 Hot Path │
│ nn_packet, nn_serialize, nn_socket, │
│ nn_reliability, nn_crypto, nn_channel │
└─────────────────────────────────────────┘
Features
- 68-bit packet headers (4-bit type + 16-bit seq + 16-bit ack + 32-bit ack bitfield)
- 5 delivery modes (Unreliable, UnreliableSequenced, ReliableUnordered, ReliableOrdered, ReliableSequenced)
- Dual-layer congestion control (binary mode + TCP New Reno window)
- ChaCha20-Poly1305 AEAD encryption with anti-replay
- Jacobson/Karels RTT estimation with adaptive retransmit
- Large message fragmentation and reassembly
- Connection migration
- Delta compression, interest filtering, priority accumulation, snapshot interpolation
Build & Test
Requires GHCup with GHC >= 9.8.
cabal build # Build library
cabal test # Run all tests
cabal build --ghc-options="-Werror" # Warnings as errors
cabal bench # Run benchmarks
Contributing
cabal test && cabal build --ghc-options="-Werror"
BSD-3-Clause · Novavero AI.