Skip to content

cryptodeal/zSockets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zSockets (WIP)

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.

Setup

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

Examples

Ensure that you've cloned the repository and its submodules:

git clone --recurse-submodules [email protected]:cryptodeal/zSockets.git

Echo Server

zig build echo_server

In another terminal:

curl localhost:3000

Hammer Test (WIP: bug in implementation causes it to hang at ~93% completion)

zig build hammer_test

HTTP Load Test

# args: <connections> <host> <port>
zig build http_load_test -- 10000 127.0.0.1 3000

HTTP Server

zig build http_server

In browser navigate to localhost:3000

TCP Load Test

# args: <connections> <host> <port>
zig build tcp_load_test -- 10000 127.0.0.1 3000

TCP Server

zig build tcp_server

In another terminal:

nc 127.0.0.1 3000

Status

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.

Setup Dependencies

SSL/Crypto

  • 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

Event Loop

  • 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

Other

  • lsquic (build flag: -DUSE_QUIC)
    • add/link dependency
    • fleshed out API

Other

  • purge zig's C ABI compatability types where possible

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published