Skip to content

rcliao/shell-tunnel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shell-tunnel

HTTP tunnels via Cloudflare quick tunnels. Expose local ports to the internet.

Part of the Ghost in the Shell ecosystem.

Prerequisites

brew install cloudflared

Install

go install github.com/rcliao/shell-tunnel/cmd/shell-tunnel@latest

Usage

# Expose a local port
shell-tunnel start --port 8080

# Expose with HTTPS protocol
shell-tunnel start --port 3000 --protocol https

# List active tunnels
shell-tunnel list

# Stop a tunnel
shell-tunnel stop --port 8080

Library Usage

import tunnel "github.com/rcliao/shell-tunnel"

mgr := tunnel.NewManager(tunnel.Config{
    Enabled:         true,
    CloudflaredBin:  "cloudflared",
    MaxTunnels:      5,
    DefaultProtocol: "http",
})

// Start a tunnel
result := tunnel.Execute(ctx, mgr, tunnel.Directive{Action: "start", Port: "8080"})

// List active tunnels
result = tunnel.Execute(ctx, mgr, tunnel.Directive{Action: "list"})

// Stop all on shutdown
mgr.StopAll()

Directive Syntax (for shell integration)

[tunnel port="8080"]
[tunnel action="proxy.php?url=https%3A%2F%2Fgithub.com%2Fstop" port="8080"]
[tunnel action="proxy.php?url=https%3A%2F%2Fgithub.com%2Flist"]

Attributes:

  • port — local port to expose (required for start/stop)
  • actionstart (default), stop, or list
  • protocolhttp (default) or https

Build

make build    # Build binary
make test     # Run tests
make vet      # Run go vet

License

MIT

About

HTTP tunnels via Cloudflare quick tunnels — expose local ports to the internet.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors