Code Monkey home page Code Monkey logo

mice's Introduction

mice

A simple API Gateway in Golang.

Screen Shot 2021-12-18 at 11 57 43 PM

Installation: Using go install:

  1. First install Go, if not already there
  2. Set GOPATH and GOBIN if not already set as in step #3, if already set skipe to step#8
  3. mkdir $HOME/go
  4. mkdir $HOME/go/bin
  5. export GOPATH=$HOME/go
  6. export GOPATH=$HOME/go/bin
  7. go get github.com/michaelmenon/mice
  8. go install github.com/michaelmenon/mice@latest

Copy the sample TOML config file provided in the github repo to the path from you are going to run the mice gasteway. Open the terminal and go the the path where you have copied thr toml file and run the mice with this command : mice -config=./

If you want Gateway to run over tls,place the tls certificate and key to the same folder where the toml file is and you need to provide the file path for the cert and key in the toml.

It has the following features:

  1. Does reverse proxy to the servers provided in the TOML file: For eg:

[server.1] role="/c1" addr=["http://localhost:8080","http://localhost:8081"]

[server.2] role="/c2" addr=["http://localhost:8083","http://localhost:8084"]

Here we have defined 2 servers to be proxied based on the path mentioned in the "role" Each server has multiple instances as mentioned in the array "addr". Mice will do round robin load balancing to the multiple instances in the array.

  1. Does load balancing to the server if the server has multiple instances provided in the "addr" tag.
  2. Does health check for each server instance and log if any server is down
  3. Does logging
  4. Supports Authentication Bearer Token if the "doauth" flag is set to true. If its set to true then it will check for the JWT secret key in the env variable set with the name in the tag "authenv". If there are any claims Mice will collect that and pass it in the request headers to the corresponding proxies. Only standard claims are supported as give below :

Screen Shot 2021-12-19 at 9 37 12 AM

  1. Does rate limiting if the tag "ratelimit" is set to true. Mention the rate limit count in the tag "ratecount"
  2. Support TLS if you set the flag "tls" to true and set the "cert" key to the certificate file path and "key" tag to the key file path.

Sample TOML file : Screen Shot 2021-12-18 at 11 54 35 PM

mice's People

Contributors

michaelmenon 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.