target

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flags

type Flags uint64
const (
	FlagPre Flags = 1 << iota
	FlagAbs
	FlagCors
	FlagSecureMode
	FlagForwardHost
	FlagForwardAddr
	FlagIgnoreCert
	FlagWebsocket
)

func (Flags) HasFlag

func (f Flags) HasFlag(flag Flags) bool

HasFlag returns true if the bits contain the requested flag

func (Flags) NormaliseRedirectFlags

func (f Flags) NormaliseRedirectFlags() Flags

NormaliseRedirectFlags returns only the bits used for redirects

func (Flags) NormaliseRouteFlags

func (f Flags) NormaliseRouteFlags() Flags

NormaliseRouteFlags returns only the bits used for routes

type Redirect

type Redirect struct {
	Src   string `json:"src"`   // request source
	Dst   string `json:"dst"`   // redirect destination
	Desc  string `json:"desc"`  // description for admin panel use
	Flags Flags  `json:"flags"` // extra flags
	Code  int    `json:"code"`  // status code used to redirect
}

Redirect is a target used by the router to manage redirecting the request using the specified configuration.

func (Redirect) HasFlag added in v0.0.9

func (r Redirect) HasFlag(flag Flags) bool

func (Redirect) OnDomain added in v0.0.12

func (r Redirect) OnDomain(domain string) bool

func (Redirect) ServeHTTP

func (r Redirect) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP responds with the redirect to the response writer provided.

func (Redirect) String

func (r Redirect) String() string

String outputs a debug string for the redirect.

type RedirectWithActive

type RedirectWithActive struct {
	Redirect
	Active bool `json:"active"`
}

type Route

type Route struct {
	Src     string                 `json:"src"`   // request source
	Dst     string                 `json:"dst"`   // proxy destination
	Desc    string                 `json:"desc"`  // description for admin panel use
	Flags   Flags                  `json:"flags"` // extra flags
	Headers http.Header            `json:"-"`     // extra headers
	Proxy   *proxy.HybridTransport `json:"-"`     // reverse proxy handler
}

Route is a target used by the router to manage forwarding traffic to an internal server using the specified configuration.

func (Route) HasFlag

func (r Route) HasFlag(flag Flags) bool

func (Route) OnDomain added in v0.0.12

func (r Route) OnDomain(domain string) bool

func (Route) ServeHTTP

func (r Route) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP responds with the data proxied from the internal server to the response writer provided.

func (Route) String

func (r Route) String() string

String outputs a debug string for the route.

func (Route) UpdateHeaders

func (r Route) UpdateHeaders(header http.Header)

UpdateHeaders takes an existing set of headers and overwrites them with the extra headers.

type RouteWithActive

type RouteWithActive struct {
	Route
	Active bool `json:"active"`
}

Jump to

Keyboard shortcuts

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