Skip to content
Service Catalogue

VSI Network Services & Capabilities

Every capability below is verified directly against the C11 codebase and classified as Available, In Development, or Planned.

Forward Proxy

AvailableProxy

Intermediary HTTP/1.x forward proxy and HTTPS CONNECT tunnel built on the shared L4 TCP listener.

services/forwardProxy/forwardProxy.c

Purpose

Routes outbound client HTTP requests and opaque TLS/TCP streams through a configurable single-port Linux intermediary.

Implementation Details

  • 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.
  • For HTTPS CONNECT requests, resolves the authority target (defaulting to port 443), establishes an outbound TCP connection, replies with HTTP/1.1 200 Connection Established, and relays bidirectional traffic using select() with a 64 KB buffer (TUNNEL_BUFFER_SIZE).

Scope & Current Limitations

  • —No proxy authentication, caching, ACL filtering, or SOCKS protocol support.
  • —Uses IPv4 DNS resolution (AF_INET) via getaddrinfo() and opens a fresh upstream TCP socket per request.
  • —Returns 400 Bad Request or 431 Request Header Fields Too Large on malformed or oversized headers.
config.json (Forward Proxy)
{
"engine": { "backlog": 128 },
"services": {
"forwardProxy": {
"enabled": true,
"listen_ip": "0.0.0.0",
"listen_port": 8085
}
}
}

Reverse Proxy

AvailableProxy

Multi-port HTTP/1.x reverse proxy with in-place request transformation and upstream Host/Location header rewriting.

services/reverseProxy/reverseProxy.c

Purpose

Exposes up to 16 distinct local listening endpoints and forwards traffic to configured backend HTTP services while preserving client-facing host references in redirects.

Implementation Details

  • 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().
  • Rewrites occurrences of the backend host in upstream Host: and Location: response headers back to the original client-facing Host before streaming response body chunks to the client.
  • Returns HTTP/1.1 502 Bad Gateway if DNS resolution or the upstream TCP connection fails.

Scope & Current Limitations

  • —No upstream HTTP keep-alive or connection pooling yet; each request opens a new backend TCP connection with Connection: close.
  • —HTTP backend targets only (no TLS termination or HTTPS upstream client yet).
  • —Routes strictly by listening IP/port mapping rather than hostname-based virtual hosting on a single port.
config.json (Reverse Proxy)
{
"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"
}
]
}
}
}

Shared Metrics Endpoint

AvailableObservability

Lock-free, cross-process atomic telemetry exposed over a lightweight local HTTP GET /metrics JSON endpoint.

utils/vsi_metrics.c

Purpose

Provides real-time visibility into request counts, active connections, byte throughput, and nanosecond latency breakdowns across forked service processes without lock contention.

Implementation Details

  • 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.

Scope & Current Limitations

  • —Exposes JSON only (not Prometheus text exposition format).
  • —No built-in authentication on the metrics port; bind listen_ip to 127.0.0.1 if local-only access is desired.
GET /metrics Response
{
"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
}
}

Managed Worker Pool

In DevelopmentCore Runtime

Bounded circular-queue worker manager intended to replace detached per-connection pthread creation.

http1_x/WorkerManager.c

Purpose

Reduces thread-creation overhead under concurrent load and bounds active worker concurrency.

Implementation Details

  • A bounded array-based circular queue (WorkerQueue, capacity MAX_WORKERS = 64) with split head_lock and tail_lock mutexes is implemented in http1_x/WorkerManager.c.
  • Currently compiled into vsi_ngine, while vsi_transport.c still spawns a detached pthread per accepted TCP connection.

Scope & Current Limitations

  • —Not yet wired into the L4 accept() loop in CoreEngine/transport/vsi_transport.c.

Persistent Connections & Pooling

PlannedCore Runtime

HTTP/1.1 keep-alive support and reusable upstream connection pooling for the reverse proxy.

Purpose

Eliminates repeated TCP three-way handshakes and DNS lookups for high-frequency backend requests.

Implementation Details

  • Currently both forward and reverse proxies force Connection: close upstream and read response bodies until EOF.
  • Planned work will introduce Content-Length/chunked response framing awareness and reusable backend socket pools.

Scope & Current Limitations

  • —Not yet implemented in the current codebase.

Secure Tunnel Service

PlannedFuture Service

Planned client/server encrypted tunneling service built on VSI’s modular service dispatch architecture.

Purpose

Aims to provide an encrypted transport channel between a local VSI client component and a remote VSI server component.

Implementation Details

  • Intended model: a local client connects over an encrypted channel to a remote VSI server, which processes and forwards traffic to destinations.
  • Currently under design exploration (TLS 1.3, key exchange, symmetric encryption, and session establishment).

Scope & Current Limitations

  • —Planned future direction only — VSI does NOT currently provide TLS tunneling, VPN functionality, encrypted DNS, or ECH.

Load Balancing

PlannedFuture Service

Planned multi-upstream request distribution and backend health checking for the reverse proxy.

Purpose

Allows a single reverse proxy listener to distribute incoming traffic across multiple backend targets.

Implementation Details

  • Currently each reverse proxy mapping binds one listen_ip:listen_port to a single target URL.
  • Future work may add upstream pools, round-robin/weighted scheduling, and passive/active health checks.

Scope & Current Limitations

  • —Planned future direction only.