About this project
Keel (Kernel Event Engine, Lightweight) is a portable asynchronous networking substrate written in C. Its core idea is a model-neutral transport layer: semantic stream, listener and datagram abstractions driven by either a readiness or a completion execution model, sitting on a socket seam that does not assume an operating system.
Architecture is organized along three orthogonal axes:
- Event axis: readiness backends (epoll, kqueue, WSAPoll, poll) register interest and retry on EAGAIN; completion backends (io_uring, IOCP) submit owned operations and reap completions. Both sit behind one small event-loop interface, and each keeps its native semantics rather than emulating the other.
- Socket axis: a pluggable provider vtable (KlSocketProvider) with POSIX and Winsock built in, plus shipped integrations for lwIP (BSD socket layer and a raw NO_SYS callback stack) and a freestanding UEFI EFI_TCP4/UDP4 provider. Capability flags gate features such as native fd, writev and sendfile.
- Protocol axis: HTTP/1.1, HTTP/2, WebSocket, SSE and an async DNS resolver are consumers of the substrate, not its purpose. Protocol code is meant to go only through the connection/stream and event abstractions, never directly to a platform networking header or event engine; the project describes default-deny structural build gates that fail if this separation is violated.
Protocol and server features include a pluggable HTTP parser (llhttp vendored), pluggable TLS via vtable, pluggable body readers, per-route middleware with short-circuiting, built-in CORS middleware, RFC 2046 multipart form-data, three response modes (buffered writev, sendfile, chunked streaming), route parameter capture without allocation, connection timeouts with automatic 408 responses, access logging, async server handlers that suspend and resume connections, sync and async HTTP clients, a thread pool with pipe wakeup, generic fd watchers, SSE framing, response compression (miniz gzip) and client decompression, a keep-alive connection pool, redirect following, HTTP proxy and CONNECT tunneling, a backpressure write buffer, timer scheduling, and sqlite3-style error codes.
Networking extras include UNIX domain socket servers with peer credentials, peer security labels, mTLS client certificate inspection, PROXY protocol support gated by trusted CIDRs, socket activation via inherited fds (systemd LISTEN_FDS), Windows named pipes over IOCP, a stable fixed-slot UDP datagram API with batching, multicast/broadcast, ECN/TOS marking and offload support, a pluggable async DNS resolver with a built-in dual-family implementation, and Happy Eyeballs client connection racing.
Build options cover epoll, kqueue, io_uring, poll and IOCP backends, Cosmopolitan C, native MSVC, and embedder hooks for optimization flags. The README states 111K req/s on a single thread and testing under ASan/UBSan on both execution models, with one vendored dependency (llhttp).
Comments
0 people shared their preference · Deer Point appears after 10 participants
Sign in to join the discussion.