Help us shape the future of Go! Take the 2026 Go Developer Survey

share

package
v0.43.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package share provides private branch sharing via a token-gated reverse proxy fronting a cloudflared tunnel, or via Tailscale Serve for tailnet-only access. Tokens are ephemeral — generated per session and invalidated when the tunnel shuts down.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken() string

GenerateToken returns a cryptographically random 32-character hex token.

func NewTokenHandler

func NewTokenHandler(token string, appPort int) http.Handler

NewTokenHandler returns an http.Handler that gates access behind a secret token path. First visit to /s/<token> sets an auth cookie and redirects to /. Subsequent requests are authenticated via the cookie.

func Run

func Run(appPort int, tunnelName, domain string) error

Run starts a private share session: token proxy + cloudflared tunnel. If tunnelName and domain are non-empty, uses a named tunnel with a random subdomain; otherwise falls back to a quick tunnel. Blocks until signal.

func RunTailscale

func RunTailscale(appPort int) error

RunTailscale exposes a local port on the tailnet via tailscale serve. No token proxy needed — Tailscale handles identity-based auth. Only people on the tailnet can reach the URL. Blocks until SIGINT/SIGTERM.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL