proxy

package
v0.0.0-...-96203a7 Latest Latest
Warning

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

Go to latest
Published: May 20, 2017 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

An HTTP proxy package for intercepting, modifying traffic and forwarding it via a reverse proxy server (like HAproxy).

This package is extended upon github.com/elazarl/goproxy. Full functionality of it can access through GoProxy variable, But ctx.UserData must not be altered. And glog library for logging.

It publishes Request.Host, reverse-proxy-server and retured status-code for bad status on a redis Channel. It uses fluentd for dumping http requests and responses in json or raw wire format. And Exposes rudimentary metrics via Prometheus client library.

Index

Constants

This section is empty.

Variables

View Source
var (
	// New goproxy server. Functionality of goproxy can access throgh this variable but ctx.UserData must not be altered.
	GoProxy = goproxy.NewProxyHttpServer()

	// Instance of Config struct
	Conf = new(Config)
)

Functions

func Proxy

func Proxy(redispool *redis.Pool, fluent *fluent.Fluent)

Impletments proxy functionality. If fluent is nil, then doesn't dump http request and response. If redispool is nil, then doesn't publish on redis Channel for bad status. It adds a uuid to request, to bind it to corresponding response and send it to client as a header on response.

Types

type Config

type Config struct {
	// Redis channel to be published json message containing Request.Host, sender-proxy and retured statuscode for bad status (400 <= StatusCode <= 599).
	RedisControllerChannel string

	// Forward traffic to it (only HTTP Scheme is supported) and must not be empty.
	ReverseProxyServer url.URL

	// Running proxy on this port and must not be empty.
	ProxyPort int

	// Exposing metrics on this port and must not be empty.
	MetricPort int

	// Enabling verbosabilty on underlying goproxy library.
	Verbose bool

	// If true, Dumps http request and response in wire format else in human readable format.
	DumpInWireFormat bool
}

Jump to

Keyboard shortcuts

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