RELAYLINK

Project overview

RelayLink icon

Self-hosted reverse TCP, unicast UDP, and HTTP(S) proxy built on .NET 10.
Zero inbound firewall ports on private networks. Centralized channel config. Default end-to-end TLS for peer access.

Website · Quick Start · Architecture · Security & Boundaries · Releases · 简体中文


In multi-branch environments, customer deployments, and hybrid clouds, databases (SQL Server :1433), remote desktops (RDP :3389), and internal web apps sit behind NATs and strict firewalls where opening inbound ports or deploying a full mesh VPN is not an option.

RelayLink is a focused, auditable network pipe—not a mesh VPN and not a black-box SaaS:

  • Outbound-only Agents: Windows, Linux, and macOS Agents dial out to the Server. Private networks need zero inbound ports.
  • Centralized Server Control: Clients, channels, access mappings, source-IP security groups, and traffic/audit logs live on the Server—never scattered in local Agent tunnel configs.
  • Explicit Security Posture: Separate control (7443/tcp, TLS by default) and data (7444/tcp) planes, per-client credentials, and default inner TLS between Agents.

Key Capabilities

  • Two Access Modes
    • Cloud-to-Private: Cloud applications connect to a proxy port on the Server, which opens a dedicated data tunnel through the authenticated Agent to the private target.
    • Authorized Agent-to-Agent: A caller Agent exposes a local 127.0.0.1 loopback endpoint and routes through the Server by default (relayOnly). Both ends enforce access-key validation; inner TLS is enabled by default (and can be explicitly disabled per channel by an admin for raw TCP/UDP compatibility). For authorized raw TCP and unicast UDP channels, admins can opt in to preferDirect (DES-011)—using authenticated encrypted QUIC or plaintext ICE-TCP direct transport with automatic same-mode relay fallback, Server-hosted STUN, strict probe CIDR/rate budgets, and SQLite lease recovery. HTTP(S) and automation loopback targets remain relayOnly.
  • Multi-Protocol Engine (Wire v3–v5)
    • TCP Streams: Raw byte forwarding with half-close semantics, backpressure handling, and keepalive support (compatible back to v3 TCP Agents).
    • Unicast UDP (v4): Source-isolated UDP sessions encapsulated over TCP tunnels with datagram boundary preservation (65507-byte limit) and idle cleanup.
    • HTTP/HTTPS Reverse Proxy (v5): YARP/Kestrel virtual hosting inside the target Agent with Host/Origin policy enforcement, WebSocket & streaming support, public TLS terminated at the target Agent, and mandatory inner TLS for HTTP peer access.
  • Multi-Server Cross-Platform Agent
    • Runs natively as a Windows Service, Linux systemd service, or macOS launchd daemon (Intel & Apple Silicon).
    • Connect one Agent to multiple independent Servers via single-server JSON import on the local Agent UI (http://127.0.0.1:18081/), with per-profile isolation, disable/re-enable toggles, and one-click URL/address copy.
  • Observability, Security Groups & Assisted Updates
    • React + TypeScript Admin Web UI (http://127.0.0.1:18080/) with anonymous read-only status/traffic view and authenticated admin management.
    • SQLite-backed minute-level traffic history and connection/login audit logs, plus application-layer source-IP/CIDR security groups on standard channels.
    • Assisted Updates (v0.1.0-rc.17): Server checks public releases (default LazyWorkshopCreate/RelayLink), caches & verifies SHA256SUMS in protected storage, pushes aligned update metadata to Agents, serves packages over :7444 under 30s atomic leases and rate limits, and generates platform-matched external upgrade commands—deliberately avoiding silent in-process self-updaters.
  • AI-Ready Automation & 6-Language Data-Plane SDKs
    • Optional loopback-HTTPS Automation API (off by default), relaylink CLI, and relaylink-admin Agent Skill (skills/relaylink-admin/SKILL.md) featuring one-time pairing codes (USER_CODE), human approval in the Admin UI, and a 4-tier risk model (Read, Controlled Write, Structural Change Request, and Auth actions blocked from CLI).
    • Zero-dependency Data-Plane SDKs across C#/.NET, Python, TypeScript, Go, Java, and Rust (SDK documentation) sharing a cross-language error & conformance contract (contract/).

How It Works

flowchart LR
    subgraph Cloud["Cloud / Server Side"]
        APP["Cloud App"]
        SRV["RelayLink Server<br/>Control :7443 (TLS) · Data :7444"]
        APP -->|"Proxy Port (TCP / UDP / HTTPS)"| SRV
    end

    subgraph PrivateA["Private Network A (Outbound Only)"]
        AGA["Target Agent<br/>Windows / Linux / macOS"]
        TGT["SQL Server :1433<br/>RDP :3389 · HTTP(S)"]
        AGA -->|"Control + On-Demand Data Tunnels"| SRV
        AGA --> TGT
    end

    subgraph PrivateB["Private Network B (Optional Peer Caller)"]
        CALLER["Caller App / 6-Lang SDK / CLI"]
        AGB["Caller Agent<br/>Loopback 127.0.0.1:&lt;port&gt;"]
        CALLER --> AGB
        AGB -->|"Inner TLS Ciphertext Relay (Default)"| SRV
        AGB <-.->|"Optional P2P Direct (QUIC / ICE-TCP)"| AGA
    end
  1. Outbound Registration: Each Agent connects outbound to Server :7443 using its own client ID, secret, and embedded CA trust.
  2. Central Distribution: After authentication, the Server pushes channel and mapping configuration to the Agent; changes immediately revoke affected sessions.
  3. On-Demand Tunnels: Incoming traffic triggers a dedicated data tunnel over :7444 bound by a one-time 32-byte token, cleanly separating control metadata from raw payload forwarding.

Quick Start

For production hardening, TLS certificate setup, and native service templates, read the Installation & Usage Guide.

  1. Start the Server (fastest path on Linux with Docker Engine, Compose v2, and PowerShell 7):
    pwsh ./scripts/start-server-compose.ps1 -AgentServerHost tunnel.example.com
    
    Replace tunnel.example.com with the DNS name or IP reachable by your Agents. Or grab prebuilt archives for Linux/Windows/macOS from GitHub Releases.
  2. Create a Client: Open the Admin UI (http://127.0.0.1:18080/), sign in, create a dedicated client for each Agent, and download its single-server JSON configuration.
  3. Install & Pair the Agent: Install on Windows (Inno Setup installer or archive), Linux (systemd), or macOS (launchd) using the downloaded config. Local Agent status is at http://127.0.0.1:18081/.
  4. Add Channels & Peer Mappings: Once the client shows online, create a TCP, unicast UDP, or HTTP/HTTPS channel—or add an authorized peer mapping on the caller Agent.

Positioning & Comparison

Approach Primary Role Where It Fits vs. RelayLink
Mesh VPNs Full IP-layer / subnet networking across nodes Ideal when you want virtual NICs and L3 routing. RelayLink avoids virtual adapters and routes only explicitly configured service ports.
Classic Port Tunneling (frp / ssh -R) Flexible CLI / agent-side tunnel forwarding General-purpose tools that can also be extended for larger setups. RelayLink centralizes client/channel config, access mappings, traffic history, and audit logs on the Server.
RelayLink Self-hosted reverse app/port relay Built for centrally managed, auditable TCP/UDP/HTTP(S) access into locked-down private networks with zero inbound ports and optional Agent-to-Agent E2E TLS.

Security Model & Explicit Boundaries

RelayLink is transparent about what it guarantees and what it intentionally leaves out:

  • Control vs. Data Encryption: Control connections use TLS by default (7443/tcp). Standard (cloud-to-private) TCP and UDP data tunnels forward raw bytes without transport-layer encryption—sensitive workloads must enable their own TLS (e.g., SQL Server TLS) or run over a protected network link. Application-layer source-IP security groups do not replace encryption.
  • Peer-to-Peer Inner TLS: Authorized Agent-to-Agent channels establish inner TLS between Agents by default; HTTP(S) peer access always enforces inner TLS. Disabling encryption is only available explicitly per raw TCP/UDP channel, exposing payload to the relay Server unless encrypted by the application.
  • What RelayLink Does NOT Do:
    • No VPN / TUN-TAP / IP-layer routing.
    • No SQL/TDS protocol parsing or credential substitution—target service auth remains untouched.
    • No UDP broadcast/multicast or SQL Browser dynamic port rewriting.
    • No TCP session replay/recovery across disconnects.
    • Peer Routing & P2P Direct Scope: Opt-in per-channel preferDirect (DES-011 / ADR-0043) supports encrypted QUIC and plaintext ICE-TCP direct paths on authorized raw TCP/UDP with automatic same-mode Server relay fallback; channels default to relayOnly, HTTP(S)/automation channels always enforce relayOnly, private IP probing requires explicit peerDirect.allowedCidrs allowlisting, and Linux QUIC direct requires libmsquic. Verified across LAN (Windows ↔ Ubuntu 24.04) and public cloud WAN (Tencent Cloud Tokyo ↔ Silicon Valley direct_quic TCP/UDP hole-punching across stateful firewalls, plus automatic encrypted-relay fallback from restricted/proxied NAT paths); dual symmetric carrier NATs without cone mapping fall back to relay automatically.
    • Windows Agent installers/archives and macOS archives are currently unsigned and unnotarized—always verify SHA256SUMS before installing or upgrading.

Repository Structure

RelayLink/
├── RelayLink.slnx                      # .NET 10 solution
├── website/                            # Static bilingual product & docs site (GitHub Pages)
├── src/
│   ├── RelayLink.Server/               # Server, Admin API & loopback Automation API
│   ├── RelayLink.Agent/                # Windows / Linux / macOS Agent + YARP HTTP host
│   ├── RelayLink.Agent.ConfigMigrator/ # Pre-start config migrator
│   ├── RelayLink.Protocol/             # Wire protocol frames, DTOs, errors & SemVer helpers
│   ├── RelayLink.Transport/            # TCP, TLS, UDP-over-TCP & stream forwarding
│   ├── RelayLink.Logging/              # Shared Serilog structured file logging
│   ├── RelayLink.AutomationClient/     # Shared client library for CLI & .NET automation
│   ├── RelayLink.Cli/                  # Automation CLI (`relaylink`)
│   ├── RelayLink.Sdk/                  # C#/.NET Data-Plane SDK (netstandard2.0/net8.0/net10.0)
│   ├── RelayLink.AdminWeb/             # React + TypeScript Admin Web UI
│   └── RelayLink.AgentWeb/             # React + TypeScript Agent local Web UI
├── sdk/                                # Python, TypeScript, Go, Java, Rust Data-Plane SDKs
├── skills/relaylink-admin/             # AI Agent Skill (`SKILL.md` + CLI wrapper)
├── contract/                           # OpenAPI, error codes & cross-language conformance spec
├── tests/                              # xUnit unit & integration tests (incl. Peer TLS)
├── tools/                              # Simulated targets & callers
├── config/examples/                    # Sanitized configuration examples
├── deploy/                             # Docker, Linux, Windows & macOS deployment templates
├── scripts/                            # Build, local acceptance & verification scripts
└── docs/                               # Requirements, design specs, ADRs & test evidence

Detailed directory ownership is documented in Repository Layout.

Tech Stack & Third-Party Components

Component Usage
.NET 10 / ASP.NET Core, WindowsServices, Systemd, YARP Server & Agent runtime, management APIs, native service hosting, target-Agent HTTP/HTTPS reverse proxy
Microsoft.Data.Sqlite Minute-level traffic history and audit log persistence
Serilog Structured rolling file logs (routine logs rotated; error logs retained)
React, TypeScript, Vite, Radix Dialog, Lucide AdminWeb & AgentWeb frontends (Node.js/pnpm required only at build time)
xUnit.net, Vitest, Testing Library, Prettier .NET and frontend test suites & formatting checks
Inno Setup Windows Agent installer packaging (build-time only)

Documentation

Repository source