ngrok

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutionError

type ExecutionError struct {
	Reason Reason
	Err    error
}

ExecutionError is an error type returned by Execute

func (*ExecutionError) Error

func (r *ExecutionError) Error() string

Error returns the error string

type Reason

type Reason int

Reason is the reason why executing ngrok failed

const (

	// MissingNgrok indicates ngrok executable can't be found
	MissingNgrok Reason = iota
	// UnexecutableNgrok indicates ngrok can't be executed
	UnexecutableNgrok Reason = iota
	// MissingAuthToken indicates ngrok must be authed
	MissingAuthToken Reason = iota
	// Canceled indicates that the user canceled the execution
	Canceled Reason = iota
	// CantReadFromPty indicates that there was a problem reading the stdout from ngrok
	CantReadFromPty Reason = iota
	// PortParsingError indicates that there was a problem parsing the forwarding url's port from ngrok
	PortParsingError Reason = iota
	// URLParsingError indicates that there was a problem parsing the forwarding url from ngrok
	URLParsingError Reason = iota
	// CantSetPtyWindowSize indicates that there was a problem setting the pty's window size
	CantSetPtyWindowSize Reason = iota
)

type Response

type Response struct {
	Err   *ExecutionError
	Value *Value
}

A Response contains either an error from executing ngrok or the Value

func Execute

func Execute(ctx context.Context, port int) Response

Execute executes ngrok forwarding to the given port

func (Response) String

func (rs Response) String() string

String returns a human friendly representation of a Response

type Value

type Value struct {
	Host string
	Port int
}

Value is the Host and Port found by executing ngrok

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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