zSockets is a from-scratch zig implementation of the µSockets library. The name is a play on µSockets, where the "µ" represents the metric prefix for micro
(1e−6); here, the z
represents the metric prefix for zepto
(1e-21) and the Zig programming language.
Clone the repository and its submodules:
git clone --recurse-submodules [email protected]:cryptodeal/zSockets.git
Once cloned, recursively init submodules:
git submodule update --init --recursive
To build with boringssl
and quic
:
zig build -DUSE_BORINGSSL -DUSE_QUIC
To test with boringssl
and quic
:
zig build test -DUSE_BORINGSSL -DUSE_QUIC
Ensure that you've cloned the repository and its submodules:
git clone --recurse-submodules [email protected]:cryptodeal/zSockets.git
zig build echo_server
In another terminal:
curl localhost:3000
zig build hammer_test
# args: <connections> <host> <port>
zig build http_load_test -- 10000 127.0.0.1 3000
zig build http_server
In browser navigate to localhost:3000
# args: <connections> <host> <port>
zig build tcp_load_test -- 10000 127.0.0.1 3000
zig build tcp_server
In another terminal:
nc 127.0.0.1 3000
While the library and internal logic was originally based on uSockets
, the user-facing APIs will vary significantly from uSockets
in order to better align with Zig's philosophy. The library is currently in the VERY early stages of development, is un-tested, and should not yet be used in production.
- BoringSSL (default, optionally specified via build flag:
-DUSE_BORINGSSL
)- add/link dependency
- fleshed out API
- OpenSSL (build flag:
-DUSE_OPENSSL
)- add/link dependency
- fleshed out API
- wolfSSL (build flag:
-DUSE_WOLFSSL
)- add/link dependency
- fleshed out API
- io_uring (build flag:
-DUSE_IO_URING
)- fleshed out API
- epoll (build flag:
-DUSE_EPOLL
)- fleshed out API
- kqueue (build flag:
-DUSE_KQUEUE
)- fleshed out API
- asio (build flag:
-DUSE_ASIO
)- add/link dependency
- fleshed out API
- gcd (build flag:
-DUSE_GCD
)- add/link dependency
- fleshed out API
- libuv
- add/link dependency
- fleshed out API
- lsquic (build flag:
-DUSE_QUIC
)- add/link dependency
- fleshed out API
- purge zig's C ABI compatability types where possible