rp

package
v1.20.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HostID = dflag.DynString(flag.CommandLine, "hostid", "", "host id to show in debug-host output")

	// optional fortio debug virtual host.
	DebugHost = dflag.DynString(flag.CommandLine, "debug-host", "",
		"`hostname` to serve echo debug info on if non-empty (ex: debug.fortio.org)")
)

GzipDebugHandler is a handler wrapping SafeDebugHandler with optional gzip compression.

Functions

func DebugOnHostHandler added in v1.8.0

func DebugOnHostHandler(normalHandler http.HandlerFunc) http.HandlerFunc

func ErrorHandler added in v1.13.0

func ErrorHandler(w http.ResponseWriter, r *http.Request, err error)

ErrorHandler is the error handler for the ReverseProxy. We use a Scheme marker to know that the error is just there was no route and treat that as 404 and everything else remains a 502.

func GetRoutes

func GetRoutes() []config.Route

GetRoutes gets the current routes from the dynamic flag routes.json as object (deserialized).

func PrintRoutes

func PrintRoutes()

PrintRoutes prints the current value of the routes config (dflag).

func ReverseProxy

func ReverseProxy() *httputil.ReverseProxy

ReverseProxy returns a new reverse proxy which will route based on the config/dflags.

func Rewrite added in v1.13.0

func Rewrite(pr *httputil.ProxyRequest)

Rewrite is how incoming request are processed for the ReverseProxy to pick the route/destination.

func SafeDebugHandler added in v1.6.1

func SafeDebugHandler(w http.ResponseWriter, r *http.Request)

DebugHandler is similar to Fortio's DebugHandler, it returns debug/useful info to http client. but doesn't have some of the extra sensitive info like env dump and host name or echo delay or header setting options.

Types

This section is empty.

Jump to

Keyboard shortcuts

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