MCPcopy Index your code
hub / github.com/coder/wgtunnel

github.com/coder/wgtunnel @v0.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.2.0 ↗ · + Follow
87 symbols 431 edges 21 files 40 documented · 46% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

wgtunnel

wgtunnel is a simple WireGuard tunnel server. Clients can register themselves to the server with a single API request (done periodically in the background in case the server restarts), and then connect to a WireGuard endpoint on the server over UDP to tunnel.

Generated URLs are unique and are based on the WireGuard public key. Wildcards for each tunnel are also semi-supported, using hyphens instead of periods to allow for TLS.

This is used by Coder to create tunnels for trial/demo deployments with globally accessible URLs.

Deployment

Deploy tunneld onto your server and configure it with environment variables or flags. Point the DNS entries ${base_url} and *.${base_url} to the server. If you want to use HTTPS, setup a proxy such as Caddy in front of the server.

tunneld is available on GitHub releases or can be installed with:

$ go install github.com/coder/wgtunnel/cmd/tunneld

or by running make build/tunneld.

You can also use the Docker image ghcr.io/coder/wgtunnel/tunneld.

Usage

Either use tunnel for easy usage from a terminal, or use the tunnelsdk package to initiate a tunnel against the given API server URL. Remember to store the private key for future tunnel sessions in a safe place, otherwise you will get a new hostname!

tunnel can be installed with:

$ go install github.com/coder/wgtunnel/cmd/tunnel

or by running make build/tunnel.

License

Licensed under the MIT license.

Core symbols most depended-on inside this repo

String
called by 72
tunnelsdk/tunnel.go
Error
called by 34
tunnelsdk/client.go
Close
called by 23
tunneld/tunneld.go
NoisePublicKey
called by 21
tunnelsdk/tunnel.go
Validate
called by 18
tunneld/options.go
Write
called by 12
tunneld/httpapi/httpapi.go
Request
called by 11
tunnelsdk/client.go
WireguardPublicKeyToIPAndURLs
called by 11
tunneld/options.go

Shape

Function 40
Method 29
Struct 17
TypeAlias 1

Languages

Go100%

Modules by API surface

tunnelsdk/tunnel.go20 symbols
tunneld/tunneld_test.go10 symbols
tunneld/api.go9 symbols
tunnelsdk/client.go8 symbols
tunneld/httpmw/limitbody.go8 symbols
tunnelsdk/api.go4 symbols
tunneld/tunneld.go4 symbols
tunneld/options.go4 symbols
buildinfo/buildinfo.go4 symbols
tunneld/httpmw/ratelimit.go3 symbols
tunneld/api_test.go3 symbols
tunneld/httpapi/httpapi.go2 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add wgtunnel \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact