Help us shape the future of Go! Take the 2026 Go Developer Survey

route

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Host string
	Port int
}

type GatewayRegistry

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

GatewayRegistry keeps route-to-backend mapping for the in-process gateway. It is database-backed so mappings survive process restarts.

func NewGatewayRegistry

func NewGatewayRegistry(db *gorm.DB) (*GatewayRegistry, error)

func (*GatewayRegistry) DeleteRoute

func (r *GatewayRegistry) DeleteRoute(ctx context.Context, routeKey string) error

func (*GatewayRegistry) ResolveByPath

func (r *GatewayRegistry) ResolveByPath(path string) (Registration, string, bool)

func (*GatewayRegistry) UpsertRoute

func (r *GatewayRegistry) UpsertRoute(ctx context.Context, route Registration) error

type K8sIngressRegistry

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

func NewK8sIngressRegistry

func NewK8sIngressRegistry(cfg K8sIngressRegistryConfig) (*K8sIngressRegistry, error)

func (*K8sIngressRegistry) DeleteRoute

func (r *K8sIngressRegistry) DeleteRoute(ctx context.Context, routeKey string) error

func (*K8sIngressRegistry) UpsertRoute

func (r *K8sIngressRegistry) UpsertRoute(ctx context.Context, route Registration) error

type K8sIngressRegistryConfig

type K8sIngressRegistryConfig struct {
	Namespace        string
	Kubeconfig       string
	InCluster        bool
	IngressClassName string
	Host             string
	PathType         string
	Annotations      map[string]string
}

type PathRouteResolver

type PathRouteResolver interface {
	ResolveByPath(path string) (route Registration, matchedPrefix string, ok bool)
}

PathRouteResolver resolves an incoming request path to a registered route. matchedPrefix is the path prefix bound to the resolved backend.

type Registration

type Registration struct {
	RouteKey   string
	PathPrefix string
	Backend    Backend
	Metadata   map[string]string
}

Registration describes one app-session route bound to a concrete backend.

type RouteRegistry

type RouteRegistry interface {
	UpsertRoute(ctx context.Context, route Registration) error
	DeleteRoute(ctx context.Context, routeKey string) error
}

RouteRegistry is the abstraction for route management backends such as Traefik API/File, in-process gateway, or a composite implementation.

type RouteRegistryHandler

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

func NewRouteRegistryHandler

func NewRouteRegistryHandler(repo interfaces.ContainerRepository, registry RouteRegistry, cfg *config.Config) *RouteRegistryHandler

func (*RouteRegistryHandler) Handle

func (h *RouteRegistryHandler) Handle(evt event.Event)

type TraefikRegistry

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

func NewTraefikRegistry

func NewTraefikRegistry(cfg TraefikRegistryConfig) (*TraefikRegistry, error)

func (*TraefikRegistry) DeleteRoute

func (r *TraefikRegistry) DeleteRoute(ctx context.Context, routeKey string) error

func (*TraefikRegistry) UpsertRoute

func (r *TraefikRegistry) UpsertRoute(ctx context.Context, route Registration) error

type TraefikRegistryConfig

type TraefikRegistryConfig struct {
	Provider   string
	BaseURL    string
	UpsertPath string
	DeletePath string
	AuthToken  string
	Timeout    time.Duration
	FilePath   string
}

Jump to

Keyboard shortcuts

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