Documentation
¶
Index ¶
- Variables
- type Proxy
- func (proxy *Proxy) AddService(service apiv1.Service) error
- func (proxy *Proxy) Map() map[string]apiv1.Service
- func (proxy *Proxy) Pass(w http.ResponseWriter, r *http.Request)
- func (proxy *Proxy) RemoveService(service apiv1.Service) error
- func (proxy *Proxy) Start() chan error
- func (proxy *Proxy) Stop()
- func (proxy *Proxy) UpdateServices(delta k8s.ChangeSet)
- func (proxy *Proxy) Wait()
- type ResponseWriter
- type ReverseProxy
- type Service
Constants ¶
This section is empty.
Variables ¶
var HTTPErrs = map[int]*template.Template{}
HTTPErrs maps HTTP error codes to HTNL error pages.
Functions ¶
This section is empty.
Types ¶
type Proxy ¶
type Proxy struct { K8s *k8s.K8S Port int SSLCert string SSLPort int Timeout int // contains filtered or unexported fields }
Proxy holds configuration data and methods for running the kubernetes proxy service.
func New ¶
New initializes the proxy service and returns a pointer to the service instance. If an error is generated while initializing the kubernetes service scanner an error will be returned.
func (*Proxy) AddService ¶
AddService adds a service to the passthrough map.
func (*Proxy) Pass ¶
func (proxy *Proxy) Pass(w http.ResponseWriter, r *http.Request)
Pass passes HTTP traffic through to the requested service.
func (*Proxy) RemoveService ¶
RemoveService removes a service from the map.
func (*Proxy) Stop ¶
func (proxy *Proxy) Stop()
Stop causes the proxy to shutdown. In a kubernetes cluster this will cause the container to be restarted.
func (*Proxy) UpdateServices ¶
UpdateServices processes changes to the set of available services in the cluster.
type ResponseWriter ¶
type ResponseWriter struct {
// contains filtered or unexported fields
}
ResponseWriter implements http.ResponseWriter and is used to intercept the responses from the proxied services to capture and inspect 502 and 503 errors.
func (*ResponseWriter) Header ¶
func (w *ResponseWriter) Header() http.Header
Header implements http.ResponseWriter and captures response header data.
func (*ResponseWriter) Status ¶
func (w *ResponseWriter) Status() int
Status returns the current response status code.
func (*ResponseWriter) Write ¶
func (w *ResponseWriter) Write(data []byte) (int, error)
Write implements http.ResponseWriter and captures response body data.
func (*ResponseWriter) WriteHeader ¶
func (w *ResponseWriter) WriteHeader(code int)
WriteHeader implements http.ResponseWriter and captures response status codes.
type ReverseProxy ¶
type ReverseProxy struct { Active bool Available time.Time Service string URL *url.URL // contains filtered or unexported fields }
ReverseProxy defines a proxy to a service.
func NewReverseProxy ¶
NewReverseProxy creates a new reverse proxy to forward traffic through.
func (*ReverseProxy) ServeHTTP ¶
func (rp *ReverseProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP starts the HTTP server for this proxy.
func (*ReverseProxy) String ¶
func (rp *ReverseProxy) String() string
String implements stringer. Return the URL for this proxy.