internal

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package internal implements internal functionality for the proxy client.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedProxyType = errors.New("unsupported proxy type")
	ErrWildcardMustBeLast   = errors.New(
		"wildcard '*' must be the last value in a route. trim trailing text or use a '{param}' instead",
	)
	ErrMissingClosingBracket            = errors.New("route param closing delimiter '}' is missing")
	ErrDuplicatedParamKey               = errors.New("routing pattern contains duplicate param key")
	ErrInvalidRegexpPatternParamInRoute = errors.New("invalid regexp pattern in route param")
	ErrReplaceMissingChildNode          = errors.New("replacing missing child node")
)

Functions

func NewProxyHandler

func NewProxyHandler(
	operation *schema.RelyProxyOperation,
	options *schema.NewRelyProxyHandlerOptions,
) (schema.RelyProxyHandler, error)

NewProxyHandler creates a proxy handler by type.

func RegisterProxyHandler

func RegisterProxyHandler(
	proxyType schema.RelyProxyType,
	constructor schema.NewRelyProxyHandlerFunc,
)

RegisterProxyHandler registers the handler to the global registry.

func ValidateOperations

func ValidateOperations(pair *orderedmap.Pair[string, *schema.RelyProxyPathItem]) error

ValidateOperations validate operations of a route.

Types

type InsertRouteOptions

type InsertRouteOptions struct {
	GetEnv goenvconf.GetEnvFunc
}

InsertRouteOptions represents options for inserting routes.

type MetadataValidationError

type MetadataValidationError struct {
	Path    string         `json:"path"`
	Method  string         `json:"method"`
	Message string         `json:"message"`
	Details map[string]any `json:"details,omitempty"`
}

MetadataValidationError represents the error structure of the metadata validation error.

func (MetadataValidationError) Error

func (mve MetadataValidationError) Error() string

Error implements the error interface.

type Node

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

Node presents the route tree to organize the recursive route structure. Inspired by Chi router

func (*Node) FindRoute

func (n *Node) FindRoute(path string, method string) *Route

func (*Node) InsertRoute

func (n *Node) InsertRoute(
	pattern string,
	operations *schema.RelyProxyPathItem,
	options *InsertRouteOptions,
) (*Node, error)

type Route

type Route struct {
	Node        *Node
	Handler     schema.RelyProxyHandler
	ParamValues map[string]string
}

Route holds parameter values from the request path.

Jump to

Keyboard shortcuts

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