router

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthRouter

func NewAuthRouter(baseCfg *BaseConfig) *router

func NewInternalRouter

func NewInternalRouter(baseCfg *BaseConfig, serviceToken string) *router

NewInternalRouter builds a router that serves the same endpoint groups as the main router but trusts an agent identity via InternalAuthMiddleware instead of validating user credentials. It must only be served on the internal listener.

func NewMainRouter

func NewMainRouter(baseCfg *BaseConfig) *router

func NewRouter

func NewRouter() *router

func NewWebhookRouter

func NewWebhookRouter(baseCfg *BaseConfig) *router

Types

type AuthRouterConfig

type AuthRouterConfig struct {
	BaseConfig
}

type BaseConfig

type BaseConfig struct {
	// PlatformMode (optional; default: "" i.e. unset) is the platform mode propagated to endpoint groups and middleware.
	PlatformMode constants.PlatformMode

	// LogPrefix (optional; default: "") is prepended to every router log line.
	LogPrefix string

	// LogFlags (optional; default: log.LstdFlags) are the standard-library log flags for the router logger. The zero value is treated as unset.
	LogFlags int

	// LogWriter (required) receives router log output.
	LogWriter io.Writer

	// AuthClient (required) is the auth-service gRPC client.
	AuthClient *grpcclient.AuthServiceClient

	// CoreClient (required) is the core-service gRPC client.
	CoreClient *grpcclient.CoreServiceClient

	// BillingClient (required) is the billing-service gRPC client.
	BillingClient *grpcclient.BillingServiceClient

	// PlatformClient (required) is the platform-service gRPC client.
	PlatformClient *grpcclient.PlatformServiceClient

	// AgentClient (required) is the agent-service gRPC client.
	AgentClient *grpcclient.AgentServiceClient

	// NotificationClient (required) is the notification-service gRPC client.
	NotificationClient *grpcclient.NotificationServiceClient

	// RequestLogPublisher (required) publishes request logs to the outbox.
	RequestLogPublisher domain.RequestLogPublisher

	// TrustedProxyHops (optional; default: 0, meaning XFF is not trusted) is the number of reverse-proxy hops in front of this service whose X-Forwarded-For entries can be trusted. See header.GetClientIP for details.
	TrustedProxyHops int
}

func BuildBaseConfig

func BuildBaseConfig(
	platformMode constants.PlatformMode,
	logPrefix string,
	authClient *grpcclient.AuthServiceClient,
	coreClient *grpcclient.CoreServiceClient,
	billingClient *grpcclient.BillingServiceClient,
	platformClient *grpcclient.PlatformServiceClient,
	agentClient *grpcclient.AgentServiceClient,
	notificationClient *grpcclient.NotificationServiceClient,
	reqLogPublisher domain.RequestLogPublisher,
	logWriter io.Writer,
	trustedProxyHops int,
) *BaseConfig

func (*BaseConfig) WithDefaults

func (c *BaseConfig) WithDefaults() *BaseConfig

WithDefaults returns a new BaseConfig with zero-value fields replaced by defaults.

type MainRouterConfig

type MainRouterConfig struct {
	BaseConfig

	// Internal, when true, serves the endpoint groups on the trusted internal listener: AuthMiddleware is replaced with InternalAuthMiddleware so an agent identity supplied by agent-service is honored. This listener must never be exposed behind the public ALB.
	Internal bool

	// InternalServiceToken (required when Internal) is the shared secret gating identity trust on the internal listener.
	InternalServiceToken string
}

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) RegisterEndpoints

func (r *Registry) RegisterEndpoints(router *router)

func (*Registry) RegisterGroup

func (r *Registry) RegisterGroup(group *apiendpoint.APIEndpointGroup)

type Route

type Route struct {
	Method      string
	Path        string
	Handler     http.HandlerFunc
	PathPattern *regexp.Regexp
	PathParams  []string
	IsPublic    bool
}

type WebhookRouterConfig

type WebhookRouterConfig struct {
	BaseConfig
}

Jump to

Keyboard shortcuts

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