wip
| deps | ||
| staziz | ||
| staziz-packer | ||
| tests | ||
| third-party | ||
| .clang-format | ||
| .clangd | ||
| CMakeLists.txt | ||
| EXAMPLE.ini | ||
| readme.md | ||
Staziz - embedded static file server
Overview
Staziz is a high-performance, single-binary static file server with embedded content support. It allows you to package web content (HTML, CSS, JavaScript, images, etc.) directly into the executable, creating a self-contained web server that requires no external files.
Features
- Single Binary Distribution: Entire web application bundled into one executable
- High Performance: Multi-threaded, event-driven architecture using epoll
- Embedded Filesystem: Virtual filesystem (VFS) for storing all web content
- Configuration: INI-based configuration embedded with the binary
- Logging: Async logger with multiple output destinations and log levels
Building
Requirements
- C++20 compatible compiler (GCC 11+, Clang 14+)
- CMake 3.16+
- Linux (uses epoll, /proc filesystem)
Build Steps
# Clone the repository
git clone <repo-url>
cd staziz
# Configure with CMake
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
# Build
cmake --build build --parallel $(nproc)
Build Options
- LOGGER: Enable logging system (enabled by default)
- BUILD_PACKER: Build packer tool (disabled by default)
- ENABLE_TESTS: Build tests (disabled by default)
Usage
Basic Usage
# Create payload and inject it
./staziz-packer -d /path/to/content -c /path/to/config -s /path/to/server
# Run server with embedded content
./staziz
# Or
# Run with external cargo file (for testing)
./staziz --file path/to/binary_with_cargo
# Show help
./staziz --help
# Show version
./staziz --version
API Reference
Cargo Container
- Virtual filesystem (VFS) storage
- Configuration storage
- XOR encryption support
- Serialization/deserialization
Virtual Filesystem (VFS)
- Hierarchical file/directory storage
- Serialization to binary format
- File operations (create, read, write, delete)
- Directory listing and traversal
HTTP Server
- Multi-threaded worker model
- Non-blocking I/O with epoll
- HTTP/1.1 keep-alive support
- Configurable connection limits and timeouts
Logging system
Async logger with features:
- Multiple log levels (debug, info, warning, error, critical)
- Console and file output
- Colored output (auto-detects TTY)
- Configurable queue sizes and overflow policies
- Thread-safe message queuing
Development
TODO
- cros-splatform(switching to libuv???)
- gemini protocol
- tls
- https
- asynchronous sending of large files
wrk bench on localhost
❯ wrk -t8 -c200 -d30s http://127.0.0.1:8080/
Running 30s test @ http://127.0.0.1:8080/
8 threads and 200 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.10ms 1.51ms 24.64ms 87.10%
Req/Sec 36.02k 5.36k 80.13k 70.46%
8608858 requests in 30.10s, 19.64GB read
Requests/sec: 286011.73
Transfer/sec: 668.26MB