Documentation
¶
Overview ¶
Package proxy provides an interface to start reverse proxies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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.
Click to show internal directories.
Click to hide internal directories.