controlapi

package
v0.1.0-rc.27 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package controlapi serves the control API and authorizes route operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(
	cfg Config,
	store Store,
	builtinAuthorizationStore BuiltinAuthorizationStore,
	readiness func(context.Context) error,
) *http.ServeMux

NewHandler constructs the control API.

Types

type BuiltinAuthorizationStore

type BuiltinAuthorizationStore interface {
	AuthenticateAccessToken(context.Context, credentials.AccessToken, int64, time.Time) (controlstate.ControlPrincipal, error)
	IdentityContext(context.Context, string) (controlstate.IdentityContext, error)
	ListTeamDomains(context.Context, string, string) ([]controlstate.Domain, error)
}

BuiltinAuthorizationStore provides the identity state needed for local route authorization.

type Config

type Config struct {
	Role                    string
	StartedAt               time.Time
	ManagedDeploymentDomain string
	AuthorityEndpoint       string
	LoginToken              string
	OIDCIssuer              string
	OIDCClientID            string
	OIDCLoginFlow           string
	OIDCScopes              []string
	CertificateIssuance     bool
	ACMEDirectoryURL        string
	ServerDomain            string
	HostedSecret            string
	HostedSecretPrevious    string
	HTTPClient              *http.Client
	DNSAutomation           bool
	Metrics                 *observability.Metrics
}

Config contains the public API settings derived from tnld configuration.

type Store

type Store interface {
	EnsureExternalAuthorityPrincipal(context.Context, string, time.Time) ([32]byte, error)
	ListAuthorizedRoutes(context.Context, string, string) (controlstate.RoutePage, error)
	GetAuthorizedRouteByHostname(context.Context, string, string) (controlstate.Route, error)
	CreateRoute(context.Context, controlstate.CreateRouteRequest, time.Time) (controlstate.Route, error)
	UpdateAuthorizedRoute(context.Context, controlstate.AuthorizedRouteUpdateRequest, time.Time) (controlstate.Route, error)
	GetRouteForAuthorization(context.Context, string) (controlstate.Route, error)
	GetRouteForSessionAuthorization(context.Context, string, string) (controlstate.Route, error)
	DeleteAuthorizedRoute(context.Context, controlstate.AuthorizedRouteDeleteRequest, time.Time) error
	CreateRouteSession(context.Context, controlstate.RouteSessionRequest, time.Time, time.Duration, time.Duration) (controlstate.RouteSessionSetup, error)
	RouteSessionAuthentication(context.Context, string, uint64, credentials.RouteSessionToken) (controlstate.RouteSessionAuthentication, error)
	HeartbeatRouteSession(context.Context, controlstate.RouteSessionAuthentication, time.Time, time.Duration, time.Duration) (controlstate.RouteSessionSetup, error)
	MarkRouteCertificateInstalled(context.Context, controlstate.RouteSessionAuthentication, string, time.Time, time.Time) (controlstate.RouteSessionLifecycle, error)
	CreateCertificateIssuance(context.Context, controlstate.CreateCertificateIssuanceRequest, time.Time) (controlstate.CertificateIssuance, error)
	GetCertificateIssuance(context.Context, string, credentials.RouteSessionToken, time.Time) (controlstate.CertificateIssuance, error)
	MarkCertificateChallengeReady(context.Context, string, credentials.RouteSessionToken, time.Time) (controlstate.CertificateIssuance, error)
	MarkCertificateChallengeRemoved(context.Context, string, credentials.RouteSessionToken, time.Time) (controlstate.CertificateIssuance, error)
	MarkRouteSessionReady(context.Context, controlstate.RouteSessionAuthentication, time.Time) (controlstate.RouteSessionLifecycle, error)
	CloseRouteSession(context.Context, string, credentials.RouteSessionToken, time.Time) error
	ApplyHostedPolicyRevocation(context.Context, string, string, uint64, bool, []string, []string, time.Time) (bool, int, error)
	CreateDNSAuthority(context.Context, controlstate.CreateDNSAuthorityRequest, time.Time) (controlstate.DNSAuthority, error)
	GetDNSAuthority(context.Context, string) (controlstate.DNSAuthority, error)
	ReleaseDNSAuthority(context.Context, string, string, time.Time) (controlstate.DNSAuthority, error)
	AdminRuntimeCounts(context.Context, time.Time) (controlstate.AdminRuntimeCounts, error)
	ListAdminRelayLeases(context.Context, string, time.Time) (controlstate.AdminRelayPage, error)
	BeginAdminRelayDrain(context.Context, controlstate.RelayLeaseIdentity, string, string, time.Time, time.Time) (controlstate.RelayLease, error)
	ListMaintenanceControls(context.Context) ([]controlstate.MaintenanceControl, error)
	SetMaintenanceControl(context.Context, controlstate.MaintenanceControlName, bool, string, string, time.Time) (controlstate.MaintenanceControl, error)
}

Store is the stored state used by the control API.

Jump to

Keyboard shortcuts

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