selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

tunwg logo

Self-host tunwg

v25.11.15+bbd247b

WireGuard-based secure tunnel for local servers

ReleaseOpen SourceMIT
Updated5 months ago
LanguageGo
Setup difficultyModerate
Stars
287
Ports
443 (HTTPS traffic), 80 (HTTP redirect and ACME challenges)
Docker
ghcr.io/ntnj/tunwg
Install with Docker

What is tunwg?

Tunwg creates secure WireGuard tunnels to expose local HTTP servers to the internet with automatic HTTPS certificates. It runs as a single binary or Docker container, supports custom domains via CNAME, persistent URLs derived from WireGuard keys, HTTP Basic Auth, PROXY protocol for real client IPs, and can relay traffic over HTTPS when UDP is blocked. The server is stateless and requires no database. Users can self-host both the client and server components, or use the public instance at l.tunwg.com. It also provides a Go library for embedding tunnel functionality directly into Go applications.

Should you self-host tunwg?

tunwg scores 47/100 on selfhost.directory (how scoring works) and ranks #4 of 10 in Network. It has 287 GitHub stars.

It shipped 1 stable release in the past year. The latest, v25.11.15+bbd247b, came out on 15 November 2025.

Setup is moderate: expect some configuration beyond a single command. An official Docker image is available. It is MIT-licensed and written mostly in Go.

Its closest alternative on selfhost.directory is Webhook.site (66/100, 6 786 stars). It scores higher overall, so compare the two before you pick. See tunwg vs Webhook.site side by side.

Features

  • Automatic HTTPS certificates
  • Custom domains
  • Go library
  • HTTP Basic Auth
  • HTTPS relay modePerformance may suffer due to TCP-over-UDP-over-TCP encapsulation
  • Multi-host port forwarding
  • Persistent URLs
  • PROXY Protocol support
  • Stateless Server
  • WireGuard Tunneling

tunwg README

How to install tunwg

Install tunwg with Docker

Environment variables
TUNWG_PATH=/data (set in Dockerfile)

docker run -it --rm --network=host -v tunwg_keys:/data ghcr.io/ntnj/tunwg tunwg --forward=http://localhost:8080

Requires --network=host to access host ports

How to configure tunwg

  • TUNWG_APIDomain name for the tunnel server (all subdomains must resolve to server)

    Domain name for the tunnel server (all subdomains must resolve to server)

  • TUNWG_AUTHShared secret to limit which clients can use the server

    Shared secret to limit which clients can use the server

  • TUNWG_IPIP address of the tunnel server

    IP address of the tunnel server

  • TUNWG_KEYWireGuard key name for local development

    WireGuard key name for local development

  • TUNWG_PATHCustom path for WireGuard key storage (default: ~/.config/tunwg/ or /data in Docker)

    Custom path for WireGuard key storage (default: ~/.config/tunwg/ or /data in Docker)

  • TUNWG_PORT443UDP port for WireGuard connections (default: 443)

    UDP port for WireGuard connections (default: 443)

  • TUNWG_RELAYRelay traffic over HTTPS when UDP is blocked (set to 'true' to enable)

    Relay traffic over HTTPS when UDP is blocked (set to 'true' to enable)

    values: true

  • TUNWG_RUN_SERVERRun in server mode instead of client mode

    Run in server mode instead of client mode

    values: true

  • TUNWG_TEST_LOCALHOSTEnable local development mode

    Enable local development mode

    values: true

tunwg releases & version history

More in Network

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…