sozu_lib, a proxy development library
sozu_lib provides tools to write a proxy that can be reconfigured
without any downtime. See examples/http.rs for a small example
of starting a HTTP proxy with one cluster.
A proxy starts as an event loop with which you communicate through
a Channel. You can add or remove clusters by sending messages
through that channel. Each message has an identifier that the event
loop will use in its answer.
The proxy implementations handle differently the frontend and backend configurations. A single cluster could have multiple backend servers, but it can also answer to different hostnames and various TLS certificates. All those settings can be changed independently from the currently active connections. As an example, a backend server could be removed from the configuration while a client is still proxied through to that server. It should be possible later to force that connection to close if too many of those are lingering.
Exploring the source
lib/src/protocol/mux/: the HTTP/1.1 and HTTP/2 datapath (frame parser, HPACK, stream pool, flood detector, RFC 9218 priorities, GOAWAY drain, router, backend connect). The on-branch reference islib/src/protocol/mux/LIFECYCLE.md.lib/src/protocol/kawa_h1/: the H1 vocabulary the mux builds on — default answers and their templates, theHttpContextheader editor, and theMethod/ hostname helpers, all on thekawazero-copy parser. Its ownHttpsession state machine was removed on 2026-09-20 (sozu#1346) once the mux made it unreachable.lib/src/protocol/proxy_protocol/: HAProxy PROXY protocol v2 ingest plus the legacy v1 header model (v1 is not accepted on the wire).lib/src/protocol/{pipe,rustls,tcp}.rs: byte-stream pipe (post-upgrade), TLS handshake / ALPN driver, raw TCP proxy.lib/src/{http,https,tcp}.rs: front-door dispatch for the three transport stacks.lib/src/server.rs: the single-threaded mio event loop shared by every proxy in a worker.lib/src/socket.rs: edge-triggered socket abstractions (FrontRustls,FrontPlain, vectored writes).lib/src/{metrics,pool,tls}.rs: metrics emission, buffer pool, certificate resolver.
See examples/http.rs for a small example of starting an HTTP proxy with one cluster without the supervisor.