forward

package module
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2021 License: MIT Imports: 16 Imported by: 0

README

Build Status Go Report Card Latest Version License Repo Size

forward-cli

A command-line tool to reverse proxy any server. eg. Github/Google/Facebook and more.

Usage

forward - A command line tool to quickly setup a reverse proxy server.

USAGE:
  forward [OPTIONS] [host]

OPTIONS:
  --help                              print help information
  --version                           show version information
  --port="<int>"                      specify the port that the proxy server listens on. defaults: 8080
  --req-header="key=value"            specify the request header attached to the request. defaults: ""
  --res-header="key=value"            specify the response headers. defaults: ""
  --cors                              enable cors. defaults: false
  --cors-allow-headers="<string>"     allow send headers from client when cors enabled. defaults: ""
  --cors-expose-headers="<string>"    expose response headers from server when cors enabled. defaults: ""

EXAMPLES:
  forward http://example.com
  forward --port=80 http://example.com
  forward --req-header="foo=bar" http://example.com
  forward --cors --cors-allow-headers="Auth, Token" http://example.com

Install

  1. Shell (Mac/Linux)

    curl -fsSL https://github.com/release-lab/install/raw/v1/install.sh | bash -s -- -r=axetroy/forward-cli -e=forward
    
  2. PowerShell (Windows):

    $r="axetroy/forward-cli";$e="forward";iwr https://github.com/release-lab/install/raw/v1/install.ps1 -useb | iex
    
  3. Github release page (All platforms)

    download the executable file and put the executable file to $PATH

  4. Build and install from source using Golang (All platforms)

    go install github.com/axetroy/forward-cli/cmd/forward@latest
    

License

The MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLocalIP

func GetLocalIP() (net.IP, error)

Types

type ProxyServer

type ProxyServer struct {
	// contains filtered or unexported fields
}

func NewProxyServer

func NewProxyServer(options ProxyServerOptions) *ProxyServer

func (*ProxyServer) Handler

func (p *ProxyServer) Handler() func(http.ResponseWriter, *http.Request)

type ProxyServerOptions

type ProxyServerOptions struct {
	Target            *url.URL
	UseSSL            bool
	ReqHeaders        http.Header
	ResHeaders        http.Header
	Cors              bool
	CorsAllowHeaders  string
	CorsExposeHeaders string
}

Directories

Path Synopsis
cmd
forward command

Jump to

Keyboard shortcuts

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