api

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(jwtSecret string, blocklist BlocklistChecker) gin.HandlerFunc

AuthMiddleware validates JWT tokens on protected routes.

func CORSMiddleware

func CORSMiddleware(allowedOrigins []string) gin.HandlerFunc

CORSMiddleware configures CORS for the Vue frontend.

func SetupRouter

func SetupRouter(cfg RouterConfig) *gin.Engine

SetupRouter creates and configures the Gin router.

Types

type BlocklistChecker

type BlocklistChecker interface {
	IsBlocked(ctx context.Context, jti string) (bool, error)
}

BlocklistChecker checks if a JWT token ID is revoked.

type RouterConfig

type RouterConfig struct {
	Debug     bool
	JWTSecret string
	Settings  *store.SettingsStore
	Secrets   *store.SecretStore
	Upstreams *store.UpstreamStore
	Instances *store.InstanceStore
	Slaves    *store.SlaveStore
	Traffic   *store.TrafficStore
	Blocklist *store.TokenBlocklistStore
	Backups   *store.BackupStore
	Docker    *dockerutil.DockerClient
	// Services
	SecretSvc    *service.SecretService
	UpstreamSvc  *service.UpstreamService
	ContainerSvc *service.ContainerService
	DockerSvc    *service.DockerService
	GeoblockSvc  *service.GeoblockService
	BotDeps      *bot.Dependencies
	HealthSvc    *service.HealthService
	TrafficSvc   *service.TrafficService
	ReplSvc      *service.ReplicationService
	UpdateSvc    *service.UpdateService
	CORSOrigins  []string // defaults to ["*"] if empty
}

RouterConfig holds dependencies for router setup.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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