Networking

15 networking components written in pure C — DNS server, FRP tunneling, file beam, MITM proxy, HTTP server, email, WebSocket bridge, and more. Zero external dependencies.

Overview

Scorpiox code ships a complete networking stack compiled into standalone static binaries. Every component uses raw POSIX sockets (or Winsock on Windows) — no libcurl, no OpenSSL, no libuv. TLS is handled by the embedded mbedTLS library where needed.

15 Components

DNS, FRP, beam, proxy, HTTP server, email (SMTP+IMAP), WebSocket bridge, SSH, MCP, session host, and more.

Zero Dependencies

Raw POSIX sockets everywhere. TLS via embedded mbedTLS. No libcurl, no OpenSSL, no libuv, no Go runtime.

Cross-Platform

Linux, macOS, and Windows. Same source, same behavior. Winsock abstraction where needed.

DNS Server

scorpiox-dns

Port 53
DNS UDP TCP
scorpiox/scorpiox-dns.c

Full authoritative DNS server with split-horizon resolution, upstream forwarding, and response caching. Handles A, CNAME, SOA, MX, TXT, AAAA, and NS record types over both UDP and TCP.

  • Split-horizon — different responses for LAN vs WAN clients
  • Upstream forwarding with response caching
  • CLI zone management: add, remove, list, query
  • Configurable TTL and daemonize mode
  • Server stats and PID file tracking

Configuration

DNS_LISTEN DNS_UPSTREAM DNS_ZONE_FILE DNS_DEFAULT_TTL DNS_DOMAIN
scorpiox-env.txt # Run DNS on custom interface DNS_LISTEN=0.0.0.0:53 # Forward unresolved queries to upstream DNS_UPSTREAM=8.8.8.8 # Zone file path DNS_ZONE_FILE=/etc/scorpiox/zones.conf # Default TTL for records (seconds) DNS_DEFAULT_TTL=300 # Primary domain DNS_DOMAIN=scorpiox.net
CLI Usage # Start DNS server in daemon mode scorpiox-dns --daemon # Add an A record scorpiox-dns add myapp.scorpiox.net A 192.168.1.100 # List all zones scorpiox-dns list # Query a record scorpiox-dns query code.scorpiox.net # Remove a record scorpiox-dns remove old.scorpiox.net

FRP Tunneling

scorpiox-frp

Port 7000
FRP TCP HTTP HTTPS STCP TLS
scorpiox/scorpiox-frp.c + scorpiox/libsxnet/sx_frp.c

Pure C implementation of the FRP client wire protocol. Connects to any standard frps v0.52+ server. Features Yamux session multiplexing, AES-128-CFB encryption on the control stream via mbedTLS, and MD5 token authentication.

  • FRP wire protocol — JSON over length-prefixed frames
  • Compatible with standard frps v0.52+ servers
  • MD5 auth with token + timestamp
  • AES-128-CFB crypto on control stream (mbedTLS)
  • Yamux session multiplexing
  • TCP, HTTP, HTTPS, STCP proxy types
  • Custom domain and subdomain support
  • Auto-reconnect with exponential backoff
  • Heartbeat keep-alive
  • Optional TLS transport (frps-secure)
  • Connection pooling
  • Pure C — no Go dependency, no OpenSSL
CLI Usage # Expose local port 8080 via HTTP tunnel scorpiox-frp --server frps.example.com:7000 --token my-secret-token --type http --local-port 8080 --subdomain myapp # TCP tunnel with TLS transport scorpiox-frp --server frps.example.com:7000 --token my-secret-token --type tcp --local-port 22 --remote-port 6022 --tls

Why rewrite FRP in C?

The standard frpc is a 25MB Go binary that pulls in the entire Go runtime. scorpiox-frp is a ~200KB static binary with identical wire compatibility. It starts in milliseconds, uses minimal memory, and ships as part of the scorpiox toolchain — no separate install.

File Beam

scorpiox-beam

Port 9876
TCP
scorpiox/scorpiox-beam.c

Zero-copy file transfer between machines. Uses sendfile() on Linux/macOS and TransmitFile() on Windows for kernel-level data transfer. Files are verified with xxHash64 checksums and confirmed with ACK/NAK.

  • Zero-copy file transfer (sendfile/TransmitFile)
  • Cross-platform — Linux, macOS, Windows
  • Binary header protocol with filename + size
  • xxHash64 checksum verification
  • ACK/NAK confirmation
  • Progress display
  • No config, no dependencies
CLI Usage # Receive mode — listen for incoming files scorpiox-beam receive # Send a file to another machine scorpiox-beam send 192.168.1.50 ./project.tar.gz # Custom port scorpiox-beam receive --port 4444 scorpiox-beam send 192.168.1.50:4444 ./data.bin

Traffic Proxy

scorpiox-traffic

Port 8899
HTTP HTTPS
scorpiox/scorpiox-traffic.c

MITM proxy for capturing HTTP/HTTPS traffic from AI provider API calls. Automatically generates CA certificates, injects them into the child process, and captures all requests/responses in multiple formats.

  • MITM proxy for HTTP/HTTPS traffic capture
  • Embedded Python proxy script
  • Multi-format output — raw, summary.json, conversation.jsonl, HAR
  • Auto-generated CA certificates
  • Custom CA bundle injection
  • Sets HTTP_PROXY/HTTPS_PROXY env vars for child process
  • Curl script generation for replay
  • Thread-safe data collection

Configuration

TRAFFIC_OUTDIR TRAFFIC_PORT
CLI Usage # Capture all API traffic from a scorpiox session scorpiox-traffic -- sx "explain this code" # Custom output directory and port scorpiox-traffic --outdir ./captures --port 9999 -- sx "refactor main.c" # Output files generated: # captures/raw/ — raw request/response pairs # captures/summary.json — structured API call summary # captures/convo.jsonl — conversation format # captures/traffic.har — HAR format for browser tools # captures/replay.sh — curl commands to replay

HTTP Server

scorpiox-server

Port 8080
HTTP
scorpiox/scorpiox-server.c

Lightweight HTTP server that executes Python scripts as request handlers. Powers code.scorpiox.net, get.scorpiox.net, and all other scorpiox web properties. Features JWT authentication, dynamic routing, and git-based auto-deployment.

  • Python script execution as HTTP handlers
  • Cross-platform — Linux, macOS, Windows
  • Dynamic routing with configurable prefix
  • JWT authentication (HMAC-SHA256)
  • TOTP OTP endpoint (/api/otp)
  • Health check endpoint (/api/ping)
  • Fallback script (_fallback.py) catch-all
  • Git repo auto-poll and clone for deployment
  • Configurable max request/response size (200MB default)
  • Multi-directory script lookup

Configuration

SERVER_PORT SERVER_ROUTE_PREFIX SERVER_JWT_SECRET SERVER_JWT_ISSUER SERVER_JWT_AUDIENCE SERVER_JWT_COOKIE SERVER_SCRIPT_DIR SERVER_MAX_REQUEST_MB SERVER_MAX_RESPONSE_MB SERVER_SCRIPT_TIMEOUT SERVER_GIT_CACHE_DIR SERVER_GIT_POLL_INTERVAL SERVER_GIT_PAT
scorpiox-env.txt # Basic server configuration SERVER_PORT=8080 SERVER_SCRIPT_DIR=/var/www/scripts SERVER_ROUTE_PREFIX=/ # JWT authentication SERVER_JWT_SECRET=your-secret-key SERVER_JWT_ISSUER=scorpiox # Git auto-deployment SERVER_GIT_POLL_INTERVAL=60 SERVER_GIT_CACHE_DIR=/var/cache/scorpiox

This page is served by scorpiox-server

The page you're reading right now is a Python script executed by scorpiox-server. The server polls a git repository for updates, routes HTTP requests to .py files, and streams the response back. No nginx, no Apache, no Node.js — just a single C binary.

More Components

The networking stack includes several more specialized components:

scorpiox-host

Session gateway server with REST API for managing AI coding sessions. Event bus for real-time status (thinking, tool-start, tool-done). Port 7432.

scorpiox-sshpass

Zero-friction SSH wrapper with PTY password injection. Interactive SSH, remote command exec, and SCP passthrough. Port 22.

scorpiox-server-email

Full SMTP MTA (port 25/587) + IMAP4rev1 server (port 993). DKIM signing, STARTTLS, mail queue with retry, Maildir storage.

scorpiox-ws2tcp

WebSocket-to-TCP bridge replacing Python websockify. SHA-1 handshake, token routing, epoll event loop. Up to 256 connections. Port 6080.

scorpiox-email

SMTP client via libcurl. Email queue with flush/list/clear. HTML and plaintext body, STARTTLS and SSL modes. Port 587.

scorpiox-mcp

Model Context Protocol client. JSON-RPC 2.0 over stdio to server subprocesses. Tool discovery, allow/deny glob patterns. Up to 512 tools.

scorpiox-emit-session

Session event telemetry via HTTPS POST. Fire-and-forget design. Auto-detects git branch, project name, and machine metadata. Port 443.

scorpiox-spaceship-cli

Spaceship.dev DNS API CLI. List, add, and remove DNS records programmatically. DNS propagation checking. Port 443.

Port Reference

Component Port Protocol Type
scorpiox-dns53DNS (UDP+TCP)Server
scorpiox-frp7000FRP/TCP/TLSTunnel
scorpiox-beam9876TCPTransfer
scorpiox-traffic8899HTTP/HTTPSProxy
scorpiox-sshpass22SSH/SCPClient
scorpiox-host7432HTTPServer
scorpiox-server8080HTTPServer
scorpiox-server-email25/587/993SMTP/IMAPServer
scorpiox-ws2tcp6080WebSocket/TCPProxy
scorpiox-email587SMTP/TLSClient
scorpiox-mcpstdioJSON-RPC 2.0Client
scorpiox-emit-session443HTTPSClient
scorpiox-spaceship-cli443HTTPS/DNSClient