Skip to content

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tunnel

self-hosted http tunnels for exposing a local web app through your own vps and domain.

localhost:3000 -> https://quiet-forest.tunnel.example.com

local test

TUNNEL_SERVER_TOKEN=secret go run ./cmd/tunneld
./scripts/test_endpoint.sh
TUNNEL_TOKEN=secret go run ./cmd/tunnel http 5050

open the printed url:

http://quiet-forest.localhost:8080

dns

point both records to your vps:

A  tunnel.ankurgajurel.com.np      <VPS_IP>
A  *.tunnel.ankurgajurel.com.np    <VPS_IP>

env

TUNNEL_HTTP_ADDR=:8080
TUNNEL_BASE_DOMAIN=tunnel.ankurgajurel.com.np
TUNNEL_PUBLIC_URL=https://tunnel.ankurgajurel.com.np
TUNNEL_SERVER_TOKEN=change-me

self-host with your own reverse proxy

run only tunneld:

docker run -d \
  --name tunneld \
  --restart unless-stopped \
  -e TUNNEL_HTTP_ADDR=:8080 \
  -e TUNNEL_BASE_DOMAIN=tunnel.ankurgajurel.com.np \
  -e TUNNEL_PUBLIC_URL=https://tunnel.ankurgajurel.com.np \
  -e TUNNEL_SERVER_TOKEN=change-me \
  -p 127.0.0.1:8080:8080 \
  ghcr.io/ankurgajurel/tunneld:latest

caddy example:

tunnel.ankurgajurel.com.np, *.tunnel.ankurgajurel.com.np {
	reverse_proxy 127.0.0.1:8080
}

wildcard https with cloudflare needs caddy dns-01 support.

self-host with docker compose

cp .env.example .env
docker compose -f deploy/docker-compose.yml up -d

logs:

docker compose -f deploy/docker-compose.yml logs -f

connect cli

download the tunnel binary from github releases, or build locally:

curl -fsSL https://raw.githubusercontent.com/ankurgajurel/tunnel/master/scripts/install.sh | sh

uninstall:

curl -fsSL https://raw.githubusercontent.com/ankurgajurel/tunnel/master/scripts/uninstall.sh | sh
go build -o tunnel ./cmd/tunnel

login once:

tunnel login

check what the cli will use:

tunnel config

then expose a local port:

tunnel http 3000

or override config for one run:

tunnel http 3000 --server-url http://localhost:8080 --token secret --workers 2

clear saved cli config:

tunnel logout

or use env vars:

TUNNEL_SERVER_URL=https://tunnel.ankurgajurel.com.np \
TUNNEL_TOKEN=change-me \
go run ./cmd/tunnel http 3000

the cli prints:

https://quiet-forest.tunnel.ankurgajurel.com.np

release binaries

push a tag to build cli binaries:

make release VERSION=v0.1.0

limits

  • http only
  • in-memory tunnel state
  • shared token auth
  • no dashboard
  • no tcp tunnels
  • agent transport uses websocket workers

About

self hostable tunnelling service

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages