proxy

package
v0.24.5 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2017 License: Apache-2.0 Imports: 43 Imported by: 12

Documentation

Overview

Package proxy is inspired by https://gist.github.com/cespare/3985516

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNoAuthError added in v0.21.1

func IsNoAuthError(err error) bool

func NewHTTPPipe added in v0.16.6

func NewHTTPPipe(rw http.ResponseWriter, backend backendProxy, hostKey string) (*BackendHTTPReader, *BackendHTTPWriter, error)

func ParsePublicKey

func ParsePublicKey(keyFile string) (interface{}, error)

func ParsePublicKeyFromMemory

func ParsePublicKeyFromMemory(keyFileContents string) (interface{}, error)

Types

type BackendHTTPReader added in v0.16.6

type BackendHTTPReader struct {
	// contains filtered or unexported fields
}

func NewBackendHTTPReader added in v0.16.6

func NewBackendHTTPReader(rw http.ResponseWriter, hostKey, msgKey string, backend backendProxy, messages <-chan common.Message) *BackendHTTPReader

func (*BackendHTTPReader) Close added in v0.16.6

func (b *BackendHTTPReader) Close() error

func (*BackendHTTPReader) Read added in v0.16.6

func (b *BackendHTTPReader) Read(out []byte) (int, error)

type BackendHTTPWriter added in v0.16.6

type BackendHTTPWriter struct {
	// contains filtered or unexported fields
}

func (*BackendHTTPWriter) Close added in v0.16.6

func (b *BackendHTTPWriter) Close() error

func (*BackendHTTPWriter) Write added in v0.16.6

func (b *BackendHTTPWriter) Write(buffer []byte) (int, error)

func (*BackendHTTPWriter) WriteRequest added in v0.16.6

func (b *BackendHTTPWriter) WriteRequest(req *http.Request, hijack bool, address, scheme string) error

type BackendHandler

type BackendHandler struct {
	// contains filtered or unexported fields
}

func (*BackendHandler) ServeHTTP

func (h *BackendHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type Certs added in v0.16.0

type Certs struct {
	CA   []byte
	Cert []byte
	Key  []byte
}

type Config

type Config struct {
	PublicKey                interface{}
	ListenAddr               string
	CattleAddr               string
	ParentPid                int
	ProxyProtoHTTPSPorts     map[int]bool
	CattleAccessKey          string
	CattleSecretKey          string
	TLSListenAddr            string
	MasterFile               string
	APIInterceptorConfigFile string
}

func GetConfig

func GetConfig() (*Config, error)

func (*Config) GetCerts added in v0.16.0

func (config *Config) GetCerts() (*Certs, error)

type FrontendHTTPHandler added in v0.14.0

type FrontendHTTPHandler struct {
	FrontendHandler
	HTTPSPorts  map[int]bool
	TokenLookup *TokenLookup
}

func (*FrontendHTTPHandler) AuthAndLookup added in v0.24.0

func (h *FrontendHTTPHandler) AuthAndLookup(req *http.Request) (*jwt.Token, string, error)

func (*FrontendHTTPHandler) ServeHTTP added in v0.14.0

func (h *FrontendHTTPHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*FrontendHTTPHandler) ServeRemoteHTTP added in v0.24.0

func (h *FrontendHTTPHandler) ServeRemoteHTTP(token *jwt.Token, hostKey string, rw http.ResponseWriter, req *http.Request) error

type FrontendHandler

type FrontendHandler struct {
	// contains filtered or unexported fields
}

func (*FrontendHandler) ServeHTTP

func (h *FrontendHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type ServiceProxyRequest added in v0.14.0

type ServiceProxyRequest struct {
	Service string `json:"service"`
	Port    int    `json:"port"`
	Scheme  string `json:"scheme"`
}

type ServiceProxyResponse added in v0.14.0

type ServiceProxyResponse struct {
	Token string `json:"token"`
}

type Starter added in v0.16.6

type Starter struct {
	BackendPaths       []string
	FrontendPaths      []string
	FrontendHTTPPaths  []string
	StatsPaths         []string
	CattleProxyPaths   []string
	CattleWSProxyPaths []string
	Config             *Config
}

func (*Starter) StartProxy added in v0.16.6

func (s *Starter) StartProxy() error

type StatsHandler added in v0.5.0

type StatsHandler struct {
	// contains filtered or unexported fields
}

func (*StatsHandler) ServeHTTP added in v0.5.0

func (h *StatsHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type Switcher added in v0.18.0

type Switcher struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewSwitcher added in v0.18.0

func NewSwitcher(config *Config) *Switcher

func (*Switcher) Wrap added in v0.18.0

func (s *Switcher) Wrap(local http.Handler) http.Handler

type TokenLookup added in v0.14.0

type TokenLookup struct {
	// contains filtered or unexported fields
}

func NewTokenLookup added in v0.14.0

func NewTokenLookup(cattleAddr string) *TokenLookup

func (*TokenLookup) Lookup added in v0.14.0

func (t *TokenLookup) Lookup(r *http.Request) (string, error)

Directories

Path Synopsis
Package proxyprotocol is adapted from: https://github.com/armon/go-proxyproto The MIT License (MIT) Copyright (c) 2014 Armon Dadgar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Package proxyprotocol is adapted from: https://github.com/armon/go-proxyproto The MIT License (MIT) Copyright (c) 2014 Armon Dadgar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Jump to

Keyboard shortcuts

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