Giter Club home page Giter Club logo

monoio-gateway's Introduction

Monoio Gateway

A high performance gateway based on Monoio.

Installation

# clone this repo
git clone https://github.com/monoio-rs/monoio-gateway.git
# change work dir to executable crate
cd monoio-gateway/monoio-gateway
# install gateway to system wide
cargo install --path .

Basic Usage

monoio-gateway --config path/to/config.json

Configuration

The configuration of monoio-gateway is formed by a json file.

Configuration Option

Base

field type description required
server_name String server domain true
listen_port [u16] port to bind, usually [80, 443] true
rules [Rules] proxy pass rules true
tls TlsConfig configuration for tls or acme false

Rules

field type description required
path String request path started with '/' true
proxy_pass String endpoint url true

TlsConfig

field type description required
mail String email used to request SSL certificate(acme) false
chain String pem file chained with root ca and server cert false
private_key String pkcs8 encoded private key(start with -----BEGIN PRIVATE KEY-----) false

Note: If defined TlsConfig, which means the server can also be served as https. Users should ensure one of the following parameters exist in TlsConfig, or monoio-gateway will fail to start:

  • mail
    • if defined mail, the gateway will automatically request acme service (Let's Encrypt) to get a free certificate, download and deploy to runtime if there's no valid certificate. Users should ensure the corresponding dns record is pointed to current server.
  • chain, private_key
    • the gateway will use certificates provided in config file, disable acme service for this server_name. mail will be ignored and nullable.

Example

an example configuration is shown below.

{
  "configs": [
    {
      "server_name": "gateway.monoio.rs",
      "listen_port": [80, 443],
      "rules": [
        {
          "path": "/",
          "proxy_pass": {
            "uri": "https://www.google.com"
          }
        },
        {
          "path": "/apple_captive",
          "proxy_pass": {
            "uri": "http://captive.apple.com"
          }
        }
      ],
      "tls": {
        "mail": "[email protected]"
      }
    }
  ]
}

monoio-gateway's People

Contributors

kingtous avatar

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.