Sign inSign up

daehyeok/http_rate_proxy

By daehyeok

•Updated almost 8 years ago

http_rate_proxy

Image
0

335

daehyeok/http_rate_proxy repository overview

travisci codecov Docker Build Status goreportcard godoc

⁠Quick start with Docker

# Run with docker
$ docker run -d --rm -p 8080:8080 daehyeok/http_rate_proxy

# Send test http request
$ curl -D- -x localhost:8080 http://fairs.com
HTTP/1.1 200 OK
Date: Fri, 16 Nov 2018 01:06:24 GMT
Content-Length: 1557
Content-Type: text/html; charset=utf-8

⁠Requirement

go 1.11.* http_rate_proxy will be work with previous versions of GoLang. but it is only tested with GoLang 1.11.

⁠Install

⁠Install with go get command

$ go get github.com/daehyeok/http_rate_proxy

⁠Download pre-built binary

Downlaod lastes version from Github release page⁠

⁠Usage

Usage of http_rate_proxy
  -A, --addr string       Address for proxy service (default ":8080")
  -B, --burst int         Burst for default rate (default 1)
  -C, --config string     Path for proxy config file
  -L, --limit string      Limit for default rate (default "inf")
      --loglevel string   Logging level [panic|fatal|error|warn|info|debug|trace] (default "info"))

⁠Rate Limitation

http_rate_proxy can controoler with all of traffic, client ip or destination host url. Please see the example configuration file⁠

⁠Algorithms

It use time/rate for rate contiroller with golang.org/x/time/rate⁠ package and Token Bucket⁠ algorithms

⁠Comment

⁠Limitation

This code is not ready for product level. some of impovement ideas are include garage collection for rate struct, secure connection, reverse proxy.

⁠Integratated service/tools

⁠CI/CD

TravisCI⁠ for continue build and test. CodeCov⁠ for check code coverage Goreleaser⁠ for deploying binary to Github release page. Dockerhub⁠ for automatically build to the container GoDoc⁠ for documentation

Tag summary

Content type

Image

Digest

Size

211.7 MB

Last updated

almost 8 years ago

docker pull daehyeok/http_rate_proxy