One infrastructure. Multiple network services.
Versatile Service Infrastructure (VSI) is a modular network infrastructure platform written in C11 for Linux. One shared Layer 4 TCP core accepts incoming connections, validates configuration, supervises isolated service processes, and dispatches traffic to pluggable service handlers.
Forward HTTP & HTTPS Traffic
Route outbound HTTP/1.x requests and CONNECT TLS tunnels through a single Linux proxy listener.
Expose Multiple Backends
Map up to 16 local ports to internal HTTP services with automatic Host and Location header rewriting.
Operate Services Together
Run Forward Proxy and Reverse Proxy concurrently from one config.json with isolated supervised processes.
Inspect Live Latency & Traffic
Track active connections, byte throughput, and microsecond proxy overhead in real time.
A common connection engine instead of separate daemons
Instead of duplicating socket creation, signal handling, configuration validation, and telemetry across every tool, VSI separates Layer 4 connection transport from service protocol logic.
Layer 4 TCP Transport
vsi_transport_start() binds configured IPv4 endpoints with SO_REUSEADDR, ignores SIGPIPE, and dispatches accepted descriptors via vsi_connection_cb.
Multi-Service Supervisor
Single-service runs execute directly without fork overhead. When multiple services are enabled, main.c forks isolated child processes and handles SIGINT/SIGTERM shutdown cleanly.
Unified JSON Config & Validation
A single config.json configures backlog, metrics, forward proxy, and up to 16 reverse proxy mappings with pre-startup IPv4 and port-conflict validation.
Implemented services and platform roadmap
Forward Proxy
AvailableIntermediary HTTP/1.x forward proxy and HTTPS CONNECT tunnel built on the shared L4 TCP listener.
- Reads and parses incoming HTTP/1.x headers up to 16 KB (HTTP1_HEADER_BUFFER_SIZE) using http1_read_and_parse_headers().
- For standard HTTP requests, extracts target host and port (defaulting to 80) from absolute-form URIs or the Host header, converts the URI to origin-form, filters Proxy-Connection and Expect headers, and forces Connection: close.
- Streams request bodies of arbitrary size using either Content-Length or Transfer-Encoding: chunked framing, including HTTP/1.1 100 Continue handling when Expect: 100-continue is present.
{ "engine": { "backlog": 128 }, "services": { "forwardProxy": { "enabled": true, "listen_ip": "0.0.0.0", "listen_port": 8085 } }}{ "engine": { "backlog": 128 }, "services": { "reverseProxy": { "enabled": true, "mappings": [ { "listen_ip": "127.0.0.1", "listen_port": 8081, "target": "http://127.0.0.1:3000" }, { "listen_ip": "0.0.0.0", "listen_port": 8083, "target": "http://localhost:8080" } ] } }}Reverse Proxy
AvailableMulti-port HTTP/1.x reverse proxy with in-place request transformation and upstream Host/Location header rewriting.
- Supports up to 16 port-to-backend mappings (VSI_MAX_RP_MAPPINGS); spawns dedicated listener threads when multiple mappings are active.
- Uses reverse_proxy_transform_request_v2() to rewrite the Host header in-place to the backend host[:port] without allocating a duplicate HttpRequest struct, saving the original incoming Host value.
- Forces Connection: close upstream (stripping Proxy-Connection and Expect) and streams request bodies via http1_stream_request_body().
Shared Metrics Endpoint
AvailableLock-free, cross-process atomic telemetry exposed over a lightweight local HTTP GET /metrics JSON endpoint.
- Allocates cache-line-aligned (_Alignas(64)) C11 atomic counters in shared anonymous memory via mmap(MAP_SHARED | MAP_ANONYMOUS) before fork().
- Records inbound/outbound bytes, total requests, active connections, failed requests, and CLOCK_MONOTONIC_RAW nanosecond timings (proxy overhead, upstream wait, and total latency).
- Runs an HTTP server on a detached thread (default 0.0.0.0:9100) serving GET /metrics with serialized cJSON output.
{ "requests": { "total": 42, "active": 1, "failed": 0 }, "traffic_bytes": { "inbound": 18432, "outbound": 1048576 }, "latency_us": { "avg_total": 1420.5, "avg_upstream_wait": 1310.2, "avg_proxy_overhead": 110.3, "max_proxy_overhead": 384.0 }}In Development & Planned Capabilities
Explicitly separated from available features — not yet usable in production runs.
Bounded circular-queue worker manager intended to replace detached per-connection pthread creation.
HTTP/1.1 keep-alive support and reusable upstream connection pooling for the reverse proxy.
Planned client/server encrypted tunneling service built on VSI’s modular service dispatch architecture.
Planned multi-upstream request distribution and backend health checking for the reverse proxy.
From TCP accept() to service dispatch
Every service shares the same Layer 4 listener, HTTP/1.x streaming codec, outbound connector, and shared-memory telemetry store.
Build and run vsi_ngine in under a minute
VSI compiles cleanly with standard Linux CMake (>= 3.28.3) and GCC or Clang with zero external package dependencies.
git clone https://github.com/VIKO-LABS/VNM.gitcd VNMcmake -S . -B buildcmake --build build./build/vsi_ngine -c config.json