controlapi

package
v0.1.0-rc.40 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package controlapi serves the control API and authorizes public URL 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 AdminStore

AdminStore owns administrator operations.

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 CertificateStore

CertificateStore owns publish run certificate issuance state.

type Config

type Config struct {
	Role                        tnldconfig.Role
	StartedAt                   time.Time
	ManagedDeploymentDomain     string
	AuthorityEndpoint           string
	LoginToken                  string
	OIDCIssuer                  string
	OIDCClientID                string
	OIDCLoginFlow               tnldconfig.OIDCLoginFlow
	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
	ControlReadiness            func() error
	IngressReadiness            func() error
	RelayReadiness              func() error
}

Config contains the public API settings derived from tnld configuration.

type DNSAuthorityStore

type DNSAuthorityStore interface {
	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)
}

DNSAuthorityStore owns DNS authority references.

type HostedRevocationStore

type HostedRevocationStore interface {
	ApplyHostedPolicyRevocation(context.Context, string, string, uint64, bool, []string, []string, time.Time) (bool, int, error)
}

HostedRevocationStore applies policy changes from an external authority.

type PublicURLStore

type PublicURLStore interface {
	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.AuthorizedPublicURLUpdateRequest, time.Time) (controlstate.PublicURL, error)
	GetPublicURLForAuthorization(context.Context, string) (controlstate.PublicURL, error)
	GetPublicURLForPublishRunAuthorization(context.Context, string, string) (controlstate.PublicURL, error)
	DeleteAuthorizedPublicURL(context.Context, controlstate.AuthorizedPublicURLDeleteRequest, 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)
	MarkPublishRunReady(context.Context, controlstate.PublishRunAuthentication, time.Time) (controlstate.PublishRunLifecycle, error)
	ClosePublishRun(context.Context, string, credentials.PublishRunToken, time.Time) error
}

PublicURLStore owns saved public URL and publish run state.

type Store

type Store interface {
	PublicURLStore
	CertificateStore
	DNSAuthorityStore
	HostedRevocationStore
	AdminStore
	EnsureExternalAuthorityPrincipal(context.Context, string, time.Time) ([32]byte, error)
}

Store composes the control API's independent state boundaries.

Jump to

Keyboard shortcuts

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