forward

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: MIT Imports: 20 Imported by: 0

README

中文简体 | English

Build Status Go Report Card Latest Version License Repo Size

forward-cli

一个命令行工具,反向代理任何网站。例如 Github/Google/Facebook 和其他等

img

使用

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
  --address="<int>"                   specify the address that the proxy server listens on. defaults: 0.0.0.0
  --port="<int>"                      specify the port that the proxy server listens on. defaults: 80
  --compress                          whether keep compress from target response, set to true may slowdown response. defaults: false
  --proxy-external                    whether to proxy external host. defaults: false
  --proxy-external-ignore=<host>      specify the external host without using a proxy. defaults: ""
  --req-header="key=value"            specify the request header attached to the request. defaults: ""
  --res-header="key=value"            specify the response headers. defaults: ""
  --cors                              whether enable cors. defaults: false
  --overwrite=<folder>                enable overwrite with folder. defaults: ""
  --no-cache                          disabled cache for response. defaults: true

EXAMPLES:
  forward http://example.com
  forward --port=80 http://example.com
  forward --req-header="foo=bar" http://example.com
  forward --cors --req-header="foo=bar" --req-header="hello=world" http://example.com

安装

  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 (全平台)

    下载可执行文件,然后放到 $PATH 目录下

  4. 使用 Golang 从源码中构建并安装 (全平台)

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

开源许可

The MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProxyServer

type ProxyServer struct {
	*ProxyServerOptions
	// 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    // proxy target
	Compress             bool        // whether keep compress from target response
	UseSSL               bool        // use SSL
	ReqHeaders           http.Header // set request headers
	ResHeaders           http.Header // set response headers
	ProxyExternal        bool        // whether to proxy external host
	ProxyExternalIgnores []string    // the host name that should ignore when enable proxy external
	Cors                 bool        // whether enable cors
	NoCache              bool        // disabled cache for response
	OverwriteFolder      string      // overwrite request with paths
}

Directories

Path Synopsis
cmd
forward command

Jump to

Keyboard shortcuts

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