GithubHelp home page GithubHelp logo

axetroy / forward-cli Goto Github PK

View Code? Open in Web Editor NEW
31.0 2.0 3.0 1.51 MB

A command-line tool to reverse proxy any server. 快速反向代理任何网站

Home Page: https://pkg.go.dev/github.com/axetroy/forward-cli

License: MIT License

Makefile 0.52% Go 99.48%
http-proxy golang cli

forward-cli's Introduction

中文简体 | 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="<string>"                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
  --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. Allow multiple flags. defaults: ""
  --res-header="key=value"            specify the response headers. Allow multiple flags. defaults: ""
  --cors                              whether enable cors. defaults: false
  --overwrite=<folder>                enable overwrite with a folder. defaults: ""
  --no-cache                          disabled cache for response. defaults: true
  --tls-cert-file=<filepath>          the cert file path for enabled tls. defaults: ""
  --tls-key-file=<filepath>           the key file path for enabled tls. defaults: ""

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
  forward --tls-cert-file=/path/to/cert/file --tls-key-file=/path/to/key/file http://example.com

安装

  1. Cask

    cask install github.com/axetroy/forward-cli
  2. Shell (Mac/Linux)

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

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

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

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

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

杂项

  1. 如何启用 HTTPS?

要启用 HTTPS,首先先生成 key 和 证书文件

# 生成 key
openssl genrsa -out server.key 2048
# 生成证书
openssl req -new -x509 -sha256 -key server.key -out server.pem -days 3650
# 启动代理服务器
forward --tls-cert-file=server.pem --tls-key-file=server.key http://example.com
  1. 自定义代理请求
# 代理 https://github.com
forward https://github.com
# 发起请求
curl http://0.0.0.0:80/api # 实际请求 https://github.com/api
# 发起自定义代理
curl -H "X-Proxy-Target: https://www.google.com" http://0.0.0.0/api # 实际请求 https://www.google.com/api

开源许可

The MIT License

forward-cli's People

Contributors

axetroy avatar imgbotapp avatar

Stargazers

NanYu avatar  avatar Runze Lee avatar huadada avatar  avatar DC avatar CBYellowstone avatar Ramik0 avatar  avatar kings.chan avatar Owen avatar Oscar Nevarez avatar  avatar  avatar Daniel Albuquerque avatar lu.wang avatar maiff avatar raohongjun avatar  avatar Grigorios Mallios avatar  avatar Cristian Guerra avatar  avatar Feng Kaiyu avatar 木头981 avatar  avatar 大象 avatar 一个不知名の睡觉高手 avatar 祀画 avatar 子文 avatar Eliaz Bobadilla avatar

Watchers

 avatar  avatar

forward-cli's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.