router

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(policySelector *config.PolicySelector, policies []config.Policy, logger log.Logger) func(http.Handler) http.Handler

Middleware returns a HTTP middleware containing the router.

func SetRoutingInfo

func SetRoutingInfo(parent context.Context, ri RoutingInfo) context.Context

SetRoutingInfo puts the routing info in the context.

Types

type Router

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

Router handles the routing of HTTP requests according to the given policies.

func New

func New(policySelector *config.PolicySelector, policies []config.Policy, logger log.Logger) Router

New creates a new request router. It initializes the routes before returning the router.

func (Router) Route

func (rt Router) Route(r *http.Request) (RoutingInfo, bool)

Route is evaluating the policies on the request and returns the RoutingInfo if successful.

type RoutingInfo

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

RoutingInfo contains the proxy director and some information about the route.

func ContextRoutingInfo

func ContextRoutingInfo(ctx context.Context) RoutingInfo

ContextRoutingInfo gets the routing information from the context.

func (RoutingInfo) Director

func (r RoutingInfo) Director() func(*http.Request)

Director returns the proxy director.

func (RoutingInfo) IsRouteUnprotected

func (r RoutingInfo) IsRouteUnprotected() bool

IsRouteUnprotected returns true if the route doesn't need to be authenticated.

Jump to

Keyboard shortcuts

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