router

package
v1.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 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(serviceSelector selector.Selector, policySelectorCfg *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(serviceSelector selector.Selector, policySelectorCfg *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 rewrite hook and some information about the route.

func ContextRoutingInfo

func ContextRoutingInfo(ctx context.Context) RoutingInfo

ContextRoutingInfo gets the routing information from the context.

func (RoutingInfo) IsRouteUnprotected

func (r RoutingInfo) IsRouteUnprotected() bool

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

func (RoutingInfo) Rewrite

func (r RoutingInfo) Rewrite() func(*httputil.ProxyRequest)

Rewrite returns the proxy rewrite hook.

Jump to

Keyboard shortcuts

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