proxy

package module
v0.0.0-...-fdae112 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2019 License: AGPL-3.0 Imports: 8 Imported by: 1

README

http-proxy provides an interface to start reverse proxies.

Documentation

Overview

Package proxy provides an interface to start reverse proxies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Proxy

func Proxy(p *Proxies) <-chan error

Proxy starts a list of reverse proxies. Errors are passed along an error channel. When all proxies die the error channel is closed. This should only be called once or until all previous proxies die.

Types

type Proxies

type Proxies struct {
	Proxies []ReverseProxy `json:"proxies"`
}

Proxies describes a list of reverse proxies.

type ReverseProxy

type ReverseProxy struct {
	// Cert and Key are optional. If specified, the reverse proxy will use
	// HTTPS.
	Cert string `json:"cert"`
	Key  string `json:"key"`

	// Port, in the form ":port" such as ":8080".
	Port string `json:"port"`

	Routes []Route `json:"routes"`

	// TLSConfig is ignored when parsing JSON. Used when Key != "".
	TLSConfig *tls.Config `json:"-"`

	// Stop is ignored with parsing JSON. Sending "true" along the channel
	// will gracefully shutdown the proxy server.
	//
	// The channels should be distinct for each proxy: use fan-out
	// caller-side to stop multiple proxies.
	Stop <-chan bool `json:"-"`

	// StopTimeout is ignored when parsing JSON. If the stop channel is
	// used, StopTimeout determines how long to wait for graceful shutdown
	// before forceful shutdown. -1 indicates to wait forever.
	StopTimeout time.Duration `json:"-"`
}

ReverseProxy describes a reverse proxy server.

type Route

type Route struct {
	// From must be a path or hostname+path, such as "/index", or
	// "abc.example.com/", or "abc.example.com/xyz/".
	From string `json:"from"`

	// To is an HTTP URL including the protocol scheme.
	To string `json:"to"`
}

Route describes the reverse proxy route: redirecting from From to To.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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