Giter Club home page Giter Club logo

spike-go's Introduction

Spike is a fast reverse proxy written in golang that helps to expose your local services to the internet.

简体中文

Installation

Download the latest programs from Release according to your operating system and architecture.

Schematic diagram

Configure the server

A public machine that can be accessed on the internet is needed. Assuming already. There are two ways to start the server

Based on defaults

Use the following command to start the server

$ spiked -p 6200

The above command can create a basic service. If you want to customize more information, you should start the server based on the configuration file.

Based on the configuration file.

  • Creates a configuration file

Execute the following command to create it.

$ spiked init

Yaml,Xml,Ini and Json(default) files are supported. Use the following command for help.

$ spiked init -h
  • Open the configuration file and modify the parameters.

  • Executes the following command to start the service.

 $ spiked --config=/home/conf/spiked.yaml

Configure the client.

You should first create a configuration file for the client.

  • Execute the following command to create it
$ spike init

Use the following command for help about this command

$ spike init -h
  • Open the configuration file and modify the parameters.

  • Start the client service.

$ spike --config=/home/conf/spike.yaml

Tunnel

Tunnels only need to be defined on the client side, The server does not need to do anything.

Now supports tcp udp and http

Open the configuration file for the client and modify the parameters for "tunnel".

tunnels:
  - protocol: tcp
    local_port: 3306
    server_port: 6201

  - protocol: udp
    local_host: 8.8.8.8
    local_port: 53
    server_port: 6202

  - protocol: http
    local_port: 80
    server_port: 6203
    headers:
      x-spike: yes

Restarts the client service.

  1. Visit http://{SERVER_IP}:6203, the service will be forwarded to the local 127.0.0.1:80.

  2. The services based on the tcp can use the tunnel, such as: mysql, redis, ssh and so on; The following is an example of proxy mysql service

    Execute the following command to visit the local mysql service.

    $ mysql -h {SERVER_IP} -P 6201

Client authentication

The authentication is not enabled on the server based on defaults.You should start the server based on configuration file, if you want to enable this.

  • Enable authentication

Open the configuration file "spiked.yaml" for the server and modify parameters for users and restart the service.

users:
  - username: admin
    password: admin
  • Modify the client identity information
user:
  username: admin
  password: admin

Open the configuration file for the client and modify parameters for "auth". Keep the same parameters as the server.

Configure log

The default to open the console and file two forms of the log; the first will print the logs to the console; the second will write all the logs to the specified file; Default log level is "info"; You can adjust this in the configuration file.

List Commands

$ spike list
 _____   _____   _   _   _    _____
/  ___/ |  _  \ | | | | / /  | ____|
| |___  | |_| | | | | |/ /   | |__
\___  \ |  ___/ | | | |\ \   |  __|
 ___| | | |     | | | | \ \  | |___
/_____/ |_|     |_| |_|  \_\ |_____|

Usage:
  spike [flags]
  spike [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  init        Create a configuration file in the current directory
  version     Print spike version
  view-proxy  Show proxy of the server

Flags:
      --config string     Config file (default is Current dir/spike.yaml) (default "**/spike.yaml")
  -h, --help              help for spike
  -H, --host string       Server host (default "127.0.0.1")
  -p, --password string   Password for the given user (default "admin")
  -P, --port int          Server port (default 6200)
  -u, --username string   User for login (default "admin")

Use "spike [command] --help" for more information about a command.

Changelog

See CHANGELOG.md

License

The MIT license. See MIT

spike-go's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

spike-go's Issues

middleware interception / insertion to do rate limiting etc.

  1. is there a section where i can insert code as middleware for rate limiting / anti ddos protection feature etc?
  2. if not, where do u think i should start for the module development? e.g., which file should i be looking at and which function?

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.