# vagus

QUIC and WebTransport relay for services behind NAT.

Reaching a private service from a browser through a tailnet DERP relay stacks TLS inside WireGuard inside WebSocket inside TLS inside TCP. vagus replaces that stack with a single QUIC or WebTransport connection through a stateless relay.

- Native QUIC v1/v2, HTTP/3, and WebTransport with low relay overhead (~150 ns/packet on established routes, zero allocations).
- End-to-end TLS between client and service when clients pin the service certificate, so the relay forwards encrypted packets without decrypting application traffic.
- Post-quantum key exchange for relayed connections, WebSocket fallback, and the control tunnel.
- Automatic end-to-end encrypted WebSocket fallback in the Wasm browser client when networks block UDP, plus short-lived encrypted invitations ([native handoff](https://vagus.neuroplast.io/docs/native-handoff)) for native peers that already have their own transport.

<!-- docs:figure -->
![An end-to-end TLS connection runs unbroken from Client (Browser or QUIC) through vagus relay, inside an outbound QUIC tunnel (vagus/1) crossing into the private network behind NAT, through vagus connect, and terminates at Service. The relay never decrypts application traffic.](https://vagus.neuroplast.io/docs/_files/docs/relay.svg)

## Trust

With certificate pinning enabled (the default in vagus clients), application TLS terminates at the service. Comparing what each relay sees and can do:

|  | vagus | DERP |
| --- | --- | --- |
| Application traffic | Not visible (end-to-end TLS when pinned, or end-to-end encrypted fallback) | Not visible (WireGuard inside) |
| Routing identity | Server name (`<route-id>.<domain>`) | Source and destination node public keys |
| Network metadata | Client and connector IP/ports, packet sizes, timing | Peer IP/ports, packet sizes, timing |
| Browser metadata | `Origin` header on WebSocket fallback; client key if passes or clearances are used | WebSocket upgrade headers |
| Impersonate service | No with pinning (yes if pinning is disabled) | No (WireGuard peer keys) |
| Drop or delay traffic | Yes (connectors forward only to `-backend`) | Yes |

See [Security and threat model](https://vagus.neuroplast.io/docs/security) for the full analysis.

## Documentation

- Start: [Local setup](https://vagus.neuroplast.io/docs/local-setup), [Self-hosting](https://vagus.neuroplast.io/docs/self-hosting), [AWS Lightsail](https://vagus.neuroplast.io/docs/aws-lightsail), [Examples](https://github.com/neuroplastio/vagus/tree/main/examples)
- Guides: [Browser client](https://vagus.neuroplast.io/docs/browser), [Browser admission](https://vagus.neuroplast.io/docs/admission), [Go integration](https://vagus.neuroplast.io/docs/go-integration), [Native handoff](https://vagus.neuroplast.io/docs/native-handoff)
- Reference: [Operations](https://vagus.neuroplast.io/docs/operations), [Protocol](https://vagus.neuroplast.io/docs/protocol), [Security](https://vagus.neuroplast.io/docs/security), [Performance](https://vagus.neuroplast.io/docs/performance)

## Status

Pre-1.0. Minor versions may break wire compatibility, so upgrade relays and connectors together. Report vulnerabilities to [security@neuroplast.io](mailto:security@neuroplast.io) ([security policy](https://github.com/neuroplastio/.github/blob/main/SECURITY.md)).

---

[GitHub](https://github.com/neuroplastio/vagus) · [Docs](https://vagus.neuroplast.io/docs) · [pkg.go.dev](https://pkg.go.dev/neuroplast.io/vagus) · Apache-2.0
