A simple, easy to use ngrok alternative (self hosted!)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Tyler 56df578d6e Minor change to handler type checking to avoid second cast 1 month ago
client Somewhat big rewrite, adds host registration and other improvements to structure 1 month ago
cmd Somewhat big rewrite, adds host registration and other improvements to structure 1 month ago
common Somewhat big rewrite, adds host registration and other improvements to structure 1 month ago
scripts Fix entrypoint, update license and readme 1 month ago
server Minor change to handler type checking to avoid second cast 1 month ago
.drone.yml Update packaging script/architectures 1 month ago
.gitignore Fix public key authentication/warnings, client loop, clean up log messages 1 month ago
Dockerfile Dockerfile, force go mod update, go mod download before build 1 month ago
LICENSE Fix entrypoint, update license and readme 1 month ago
README.md Somewhat big rewrite, adds host registration and other improvements to structure 1 month ago
go.mod Somewhat big rewrite, adds host registration and other improvements to structure 1 month ago
go.sum Somewhat big rewrite, adds host registration and other improvements to structure 1 month ago
main.go Initial commit 1 month ago

README.md

gogrok

Build Status

A simple, easy to use ngrok alternative (self hosted!)

The server and client can also be easily embedded into your applications, see the 'server' and 'client' directories.

Features

  • HTTP and HTTPS handling
  • Public key authentication
  • Authorized key whitelists
  • Registration of reserved hosts
  • Forwarding system that allows easy additions of other protocols (Coming soon: TCP and TCP+TLS, with host-based TLS support)

Example usage

By default, the first time you run gogrok it'll generate both a server and a client certificate. These will be stored in ~/.gogrok, but can be overridden with the gogrok.storageDir option (or GOGROK_STORAGE_DIR environment variable)

Server:

gogrok serve

Client:

gogrok --server=localhost:2222 http://localhost:3000

Server

$ ./gogrok serve --help
Start the gogrok server

Usage:
  gogrok serve [flags]

Flags:
      --bind string       SSH Server Bind Address (default ":2222")
      --domains strings   Domains to use for
  -h, --help              help for serve
      --http string       HTTP Server Bind Address (default ":8080")
      --keys string       Authorized keys file to control access

Global Flags:
      --config string   config file (default is $HOME/.gogrok.yaml)
      --viper           use Viper for configuration (default true)

Client

$ ./gogrok client --help
Start the gogrok client

Usage:
  gogrok client [flags]

Flags:
  -h, --help                help for client
      --key string          Client key file
      --passphrase string   Client key passphrase
      --server string       Gogrok Server Address (default "localhost:2222")

Global Flags:
      --config string   config file (default is $HOME/.gogrok.yaml)
      --viper           use Viper for configuration (default true)

Docker

Example docker compose file. Caddy is suggested as a frontend using dns via cloudflare and DNS-01 for wildcards.

version: '3.7'

services:
  gogrok:
    image: tystuyfzand/gogrok:latest
    ports:
    - 2222:2222
    - 8080:8080
    volumes:
    - /docker/gogrok/config:/config
    environment:
    - GOGROK_DOMAINS=gogrok.ccatss.dev
    - GOGROK_AUTHORIZED_KEY_FILE=/config/authorized_keys

Host Registration

Gogrok lets you register your own custom hosts that are attached to your public key.

On the server, make sure to run the server with the flag --store=PATH_TO_DB.db

Use gogrok register and gogrok unregister to manage registered hosts to your client key.