controlapi

package
v0.1.0-rc.32 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 25 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, error)

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 public URL 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
	Route53CredentialsReadiness func(context.Context) error
}

Config contains the public API settings derived from tnld configuration.

type Store

type Store interface {
	EnsureExternalAuthorityPrincipal(context.Context, string, time.Time) ([32]byte, error)
	ListAuthorizedPublicURLs(context.Context, string, string) (controlstate.PublicURLPage, error)
	GetAuthorizedPublicURLByHostname(context.Context, string, string) (controlstate.PublicURL, error)
	CreatePublicURL(context.Context, controlstate.CreatePublicURLRequest, time.Time) (controlstate.PublicURL, error)
	UpdateAuthorizedPublicURL(context.Context, controlstate.AuthorizedRouteUpdateRequest, time.Time) (controlstate.PublicURL, error)
	GetRouteForAuthorization(context.Context, string) (controlstate.PublicURL, error)
	GetRouteForSessionAuthorization(context.Context, string, string) (controlstate.PublicURL, error)
	DeleteAuthorizedPublicURL(context.Context, controlstate.AuthorizedRouteDeleteRequest, time.Time) error
	CreatePublishRun(context.Context, controlstate.PublishRunRequest, time.Time, time.Duration, time.Duration) (controlstate.PublishRunSetup, error)
	PublishRunAuthentication(context.Context, string, uint64, credentials.PublishRunToken) (controlstate.PublishRunAuthentication, error)
	HeartbeatPublishRun(context.Context, controlstate.PublishRunAuthentication, time.Time, time.Duration, time.Duration) (controlstate.PublishRunSetup, error)
	MarkPublicURLCertificateInstalled(context.Context, controlstate.PublishRunAuthentication, string, time.Time, time.Time) (controlstate.PublishRunLifecycle, error)
	CreateCertificateIssuance(context.Context, controlstate.CreateCertificateIssuanceRequest, time.Time) (controlstate.CertificateIssuance, error)
	GetCertificateIssuance(context.Context, string, credentials.PublishRunToken, time.Time) (controlstate.CertificateIssuance, error)
	MarkCertificateChallengeReady(context.Context, string, credentials.PublishRunToken, time.Time) (controlstate.CertificateIssuance, error)
	MarkCertificateChallengeRemoved(context.Context, string, credentials.PublishRunToken, time.Time) (controlstate.CertificateIssuance, error)
	MarkPublishRunReady(context.Context, controlstate.PublishRunAuthentication, time.Time) (controlstate.PublishRunLifecycle, error)
	ClosePublishRun(context.Context, string, credentials.PublishRunToken, 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