proxy

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EndpointIDFromRequest added in v0.3.0

func EndpointIDFromRequest(r *http.Request) string

EndpointIDFromRequest returns the endpoint ID from the HTTP request, or an empty string if no endpoint ID is specified.

This will check both the 'x-piko-endpoint' header and 'Host' header, where x-piko-endpoint takes precedence.

Types

type HTTPProxy added in v0.5.0

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

HTTPProxy proxies HTTP traffic to upsteam listeners.

func NewHTTPProxy added in v0.5.0

func NewHTTPProxy(
	upstreams upstream.Manager,
	timeout time.Duration,
	logger log.Logger,
) *HTTPProxy

func (*HTTPProxy) ServeHTTP added in v0.5.0

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

func (*HTTPProxy) ServeHTTPWithUpstream added in v0.5.0

func (p *HTTPProxy) ServeHTTPWithUpstream(
	w http.ResponseWriter,
	r *http.Request,
	endpointID string,
	upstream upstream.Upstream,
)

type Server added in v0.3.0

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

func NewServer added in v0.3.0

func NewServer(
	upstreams upstream.Manager,
	proxyConfig config.ProxyConfig,
	registry *prometheus.Registry,
	verifier auth.Verifier,
	tlsConfig *tls.Config,
	logger log.Logger,
) *Server

func (*Server) Serve added in v0.3.0

func (s *Server) Serve(ln net.Listener) error

func (*Server) Shutdown added in v0.3.0

func (s *Server) Shutdown(ctx context.Context) error

type TCPProxy added in v0.5.0

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

TCPProxy proxies TCP traffic to upstream listeners.

Incoming TCP traffic is sent over WebSockets by a Piko client, then forwarded to an upstream via a multiplexed stream.

func NewTCPProxy added in v0.5.0

func NewTCPProxy(
	upstreams upstream.Manager,
	httpProxy *HTTPProxy,
	logger log.Logger,
) *TCPProxy

func (*TCPProxy) ServeHTTP added in v0.5.0

func (p *TCPProxy) ServeHTTP(w http.ResponseWriter, r *http.Request, endpointID string)

Jump to

Keyboard shortcuts

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