proxy

package
v0.0.0-...-c25b192 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Port is the port number for the reverse proxy.
	Port int `envconfig:"PORT" default:"8080"`
	// APIHost is the destination host to which requests will be proxied.
	APIHost string `envconfig:"API_HOST" required:"true"`
}

Config is a struct for configuring the proxy server.

func GetConfig

func GetConfig() (Config, error)

GetConfig returns a Config struct populated using env variables.

type Middleware

type Middleware func(http.Handler) http.Handler

Middleware describes the signature of a middleware function that can be applied to the proxy handler.

type Proxy

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

Proxy is a reverse proxy for passing requests through to an external API.

func NewProxy

func NewProxy(ctx context.Context, config Config) Proxy

NewProxy instantiates a new instance of the proxy server.

func (Proxy) ServeHTTP

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

ServeHTTP implements a Go HTTP Handler interface

Jump to

Keyboard shortcuts

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