ngao

package module
v0.0.0-...-1f9630f Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2016 License: MIT Imports: 10 Imported by: 0

README

Ngao

Ngao (shield) - A Golang reverse proxy that limits number of client sessions connected to an upstream server.

Set a number of maximum client sessions, and the clear interval (interval in which older sessions are cleared).

Ngao is useful if you have want to rate limit access to your application/backend server, for example the configuration below only allows 20 sessions at a time.

Example

package main

import "github.com/peteretelej/ngao"

func main() {
	c := &ngao.Config{
		ListenAddr:    ":9015",          // your listen address e.g ":9010"
		Host:          "etelej.com", // the backend server to reverseproxy
		Scheme:        "https",          // protocol scheme of backend host e.g. https, http
		TotalAllowed:  20,                // Maximum client sessions allowed
		ClearInterval: 60 * 5,           // Interval to clear older sessions (secs)
	}
	ngao.Run(c)
}

Contributions welcome & greatly appreciated.

Documentation

Overview

Package ngao (shield) is a reverse proxy that limits the maximum number of connections to an upstream host.

Usage:

Get the package

go get github.com/peteretelej/ngao

Import into your application:

import "github.com/peteretelej/ngao"

Set your configuration details, and run ngao:

func main() {
   c := &ngao.Config{
      ListenAddr:    ":9015",          // your listen address e.g ":9010"
	     Host:          "etelej.com", // the backend server to reverseproxy
      Scheme:        "https",          // protocol scheme of backend host e.g. https, http
		 TotalAllowed:  4,                // Maximum client sessions allowed
	     ClearInterval: 60 * 5,           // Interval to clear older sessions (secs)
	  }
   ngao.Run(c)
}
ngao.Run(c)

ngao was written by Peter Etelej <peter@etelej.com>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(c *Config)

Run launches ngao reverse proxy

Types

type Config

type Config struct {
	ListenAddr    string
	Host          string
	Scheme        string
	TotalAllowed  int
	ClearInterval int
}

Config allows configuring of ngao's options

Jump to

Keyboard shortcuts

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