ngrok

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2018 License: MIT Imports: 9 Imported by: 1

README

package ngrok

This package provides a wrapper around the ngrok executable so you can programatically start and stop tunnels for a given host/port.

Usage example

ngrok, err := ngrok.StartTunnel("example.dev", 80)
if err != nil {
	log.Fatal("unable to start tunnel", err)
}

fmt.Println(ngrok.URL) // => https://a1b2c3d4.ngrok.io

// use the tunnel until you've finished with it

if err := ngrok.Stop(); err != nil {
	log.Println("error stopping tunnel", err)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tunnel

type Tunnel struct {
	sync.Mutex

	Host     string
	URL      string
	AdminURL string
	Pid      int
	Command  string
	// contains filtered or unexported fields
}

Tunnel represents an ngrok tunnel

func StartTunnel

func StartTunnel(host string, port int) (*Tunnel, error)

StartTunnel starts a new ngrok tunnel for the given host and port

func (*Tunnel) Stop

func (n *Tunnel) Stop() error

Stop stops the ngrok instance

Jump to

Keyboard shortcuts

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