middleware

package
v1.19.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: BSD-3-Clause Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEnvProxyMiddlewareWithParam

func NewEnvProxyMiddlewareWithParam(localID, paramName string, resolver EnvResolver, authValidator AuthValidator) echo.MiddlewareFunc

NewEnvProxyMiddlewareWithParam creates middleware that proxies requests to remote environments.

func NewEnvProxyMiddlewareWithParamAndRegistry added in v1.16.0

func NewEnvProxyMiddlewareWithParamAndRegistry(
	localID,
	paramName string,
	resolver EnvResolver,
	authValidator AuthValidator,
	registry *edge.TunnelRegistry,
) echo.MiddlewareFunc

NewEnvProxyMiddlewareWithParamAndRegistry creates middleware with an injected tunnel registry.

func PerAgentTokenRateLimit added in v1.19.0

func PerAgentTokenRateLimit(perMinute int, burst int) echo.MiddlewareFunc

PerAgentTokenRateLimit returns an Echo middleware that limits requests per edge agent token to the given rate and burst.

func PerIPRateLimit added in v1.19.0

func PerIPRateLimit(perMinute int, burst int) echo.MiddlewareFunc

PerIPRateLimit returns an Echo middleware that limits requests per client IP to the given rate and burst. It responds with 429 when the limit is exceeded.

func PerIPRateLimitForPaths added in v1.19.1

func PerIPRateLimitForPaths(paths []string, perMinute int, burst int) echo.MiddlewareFunc

PerIPRateLimitForPaths returns an Echo middleware that applies a per-IP rate limit only when c.Path() (the registered route pattern) is in paths. Each path gets its own independent token bucket, so traffic on one path does not deplete the budget for another (e.g. a login burst will not block a concurrent token refresh).

Types

type ApiKeyValidator

type ApiKeyValidator interface {
	ValidateApiKey(ctx context.Context, rawKey string) (*models.User, error)
}

type AuthMiddleware

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

func NewAuthMiddleware

func NewAuthMiddleware(authService *services.AuthService, cfg *config.Config) *AuthMiddleware

func (*AuthMiddleware) Add

func (*AuthMiddleware) WithAdminNotRequired

func (m *AuthMiddleware) WithAdminNotRequired() *AuthMiddleware

func (*AuthMiddleware) WithAdminRequired added in v1.19.2

func (m *AuthMiddleware) WithAdminRequired() *AuthMiddleware

func (*AuthMiddleware) WithApiKeyValidator

func (m *AuthMiddleware) WithApiKeyValidator(validator ApiKeyValidator) *AuthMiddleware

func (*AuthMiddleware) WithEnvironmentAccessTokenResolver added in v1.18.0

func (m *AuthMiddleware) WithEnvironmentAccessTokenResolver(resolver EnvironmentAccessTokenResolver) *AuthMiddleware

type AuthOptions

type AuthOptions struct {
	AdminRequired   bool
	SuccessOptional bool
}

type AuthValidator

type AuthValidator func(ctx context.Context, c echo.Context) bool

AuthValidator validates authentication for a request. Returns true if the request is authenticated, false otherwise.

type CORSMiddleware

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

func NewCORSMiddleware

func NewCORSMiddleware(cfg *config.Config) *CORSMiddleware

func (*CORSMiddleware) Add

type EnvResolver

type EnvResolver func(ctx context.Context, id string) (string, *string, bool, error)

EnvResolver resolves an environment ID to its connection details. Returns: apiURL, accessToken, enabled, error

type EnvironmentAccessTokenResolver added in v1.18.0

type EnvironmentAccessTokenResolver interface {
	ResolveEnvironmentByAccessToken(ctx context.Context, token string) (*models.Environment, error)
}

type EnvironmentMiddleware

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

EnvironmentMiddleware proxies requests for remote environments to their respective agents.

func (*EnvironmentMiddleware) Handle

Handle is the main middleware handler.

Jump to

Keyboard shortcuts

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