proxy

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 38 Imported by: 32

Documentation

Index

Constants

View Source
const StatusClientClosedRequest = 499

StatusClientClosedRequest non-standard HTTP status code for client disconnection

Variables

This section is empty.

Functions

func Close added in v1.4.1

func Close()

func CloseProxy added in v1.5.15

func CloseProxy(address string) error

func GetGRPCDirector added in v1.5.11

func GetGRPCDirector(tlscfg *tls.Config, cfg *config.Config) func(ctx context.Context, fullMethodName string) (context.Context, *grpc.ClientConn, error)

func ListenAndServeGRPC added in v1.5.11

func ListenAndServeGRPC(l config.Listen, opts []grpc.ServerOption, cfg *tls.Config) error

func ListenAndServeHTTP added in v1.4.1

func ListenAndServeHTTP(l config.Listen, h http.Handler, cfg *tls.Config) error

func ListenAndServeHTTPSTCPSNI added in v1.5.14

func ListenAndServeHTTPSTCPSNI(l config.Listen, h http.Handler, p tcp.Handler, cfg *tls.Config, m tcpproxy.Matcher) error

func ListenAndServePrometheus added in v1.6.0

func ListenAndServePrometheus(l config.Listen, pcfg config.Prometheus, cfg *tls.Config) error

func ListenAndServeTCP added in v1.4.1

func ListenAndServeTCP(l config.Listen, h tcp.Handler, cfg *tls.Config) error

func ListenTCP added in v1.4.1

func ListenTCP(l config.Listen, cfg *tls.Config) (net.Listener, error)

func Shutdown

func Shutdown(timeout time.Duration)

Types

type GrpcProxyInterceptor added in v1.5.11

type GrpcProxyInterceptor struct {
	Config       *config.Config
	StatsHandler *GrpcStatsHandler
	GlobCache    *route.GlobCache
}

func (GrpcProxyInterceptor) Stream added in v1.5.11

func (g GrpcProxyInterceptor) Stream(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

type GrpcStatsHandler added in v1.5.11

type GrpcStatsHandler struct {
	Connect gkm.Counter
	Request gkm.Histogram
	NoRoute gkm.Counter
	Status  gkm.Histogram
}

func (*GrpcStatsHandler) HandleConn added in v1.5.11

func (h *GrpcStatsHandler) HandleConn(ctx context.Context, conn stats.ConnStats)

HandleConn processes the Conn stats.

func (*GrpcStatsHandler) HandleRPC added in v1.5.11

func (h *GrpcStatsHandler) HandleRPC(ctx context.Context, rpc stats.RPCStats)

func (*GrpcStatsHandler) TagConn added in v1.5.11

func (*GrpcStatsHandler) TagRPC added in v1.5.11

type HTTPProxy added in v1.4.1

type HTTPProxy struct {
	// Config is the proxy configuration as provided during startup.
	Config config.Proxy

	// Time returns the current time as the number of seconds since the epoch.
	// If Time is nil, time.Now is used.
	Time func() time.Time

	// Transport is the http connection pool configured with timeouts.
	// The proxy will panic if this value is nil.
	Transport http.RoundTripper

	// InsecureTransport is the http connection pool configured with
	// InsecureSkipVerify set. This is used for https proxies with
	// self-signed certs.
	InsecureTransport http.RoundTripper

	// Lookup returns a target host for the given request.
	// The proxy will panic if this value is nil.
	Lookup func(*http.Request) *route.Target

	// Logger is the access logger for the requests.
	Logger logger.Logger

	// TracerCfg is the Open Tracing configuration as provided during startup
	TracerCfg config.Tracing

	// UUID returns a unique id in uuid format.
	// If UUID is nil, uuid.NewUUID() is used.
	UUID func() string

	// Auth schemes registered with the server
	AuthSchemes map[string]auth.AuthScheme

	// stats contains all of the stats bits
	Stats HttpStatsHandler
}

HTTPProxy is a dynamic reverse proxy for HTTP and HTTPS protocols.

func (*HTTPProxy) ServeHTTP added in v1.4.1

func (p *HTTPProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HttpStatsHandler added in v1.6.0

type HttpStatsHandler struct {
	// Requests is a histogram metric which is updated for every request.
	Requests gkm.Histogram

	// Noroute is a counter metric which is updated for every request
	// where Lookup() returns nil.
	Noroute gkm.Counter

	// WSConn counts the number of open web socket connections.
	WSConn gkm.Gauge

	// StatusTimer is a histogram for given status codes
	StatusTimer gkm.Histogram

	// RedirectCounter - counts redirects
	RedirectCounter gkm.Counter
}

type InetAfTCPProxyServer added in v1.5.14

type InetAfTCPProxyServer struct {
	Proxy *tcpproxy.Proxy
	// contains filtered or unexported fields
}

func (*InetAfTCPProxyServer) Close added in v1.5.14

func (tps *InetAfTCPProxyServer) Close() error

Close - implements Server - is this even called?

func (*InetAfTCPProxyServer) Serve added in v1.5.14

func (tps *InetAfTCPProxyServer) Serve(_ net.Listener) error

Serve - implements server. The listener is ignored, but it calls serve on the children

func (*InetAfTCPProxyServer) ServeLater added in v1.5.14

func (tps *InetAfTCPProxyServer) ServeLater(l net.Listener, s Server)

ServeLater - l is really only for listeners that are tcpproxy.TargetListener or a derivative. Don't call after Serve() is called.

func (*InetAfTCPProxyServer) Shutdown added in v1.5.14

func (tps *InetAfTCPProxyServer) Shutdown(ctx context.Context) error

type Server added in v1.4.1

type Server interface {
	Close() error
	Serve(l net.Listener) error
	Shutdown(ctx context.Context) error
}

Directories

Path Synopsis
Package gzip provides an HTTP handler which compresses responses if the client supports this, the response is compressable and not already compressed.
Package gzip provides an HTTP handler which compresses responses if the client supports this, the response is compressable and not already compressed.
tcp

Jump to

Keyboard shortcuts

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