state

package
v0.1.0-rc.49 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: BSD-3-Clause Imports: 80 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

package state owns control's durable authorization and state transitions in PostgreSQL, not just database access. operations check current identities, grants, runs, leases, and revisions in the transaction that changes their state.

authentication, teams, and domains establish ownership. public URLs, service runs, publisher connections, placement, and connector peers establish serving authority. previews, shares, and feedback retain their own access boundaries. certificate and DNS operations approve work that separate workers execute. operation-focused filenames group these families without splitting transactions.

HTTP handlers and workers call this package; it never imports their owners. controlstatedb is generated from queries and migrations; edit those sources, not the generated methods, when changing database access or constraints. changes spanning operation families must retain one transaction and the existing lock order. file count alone is not a reason to split an authority boundary.

Index

Constants

View Source
const (
	MaxDatabaseDiagnosticSessions   = 64
	MaxDatabaseDiagnosticBlockers   = 8
	MaxDatabaseDiagnosticOperations = 64
	MaxDatabaseDiagnosticBytes      = 64 << 10
)

private diagnostic limits are shared with collectors. eight blocker PIDs per session keep a maximum-shaped snapshot within 64 KiB, leaving room for eight snapshots alongside the benchmark's periodic and failure metrics windows.

View Source
const (
	GuestReadyAllowance = 20 * time.Minute
	GuestLifetime       = 72 * time.Hour
)
View Source
const CompanyAuthenticationLifetime = time.Hour
View Source
const CompanyEligibilityLifetime = 24 * time.Hour
View Source
const DeploymentCredentialGrant = "deployment_credential"
View Source
const DeploymentPublisherLeaseLifetime = 2 * time.Minute
View Source
const MaxConnectorPeerWatchBatch = 512
View Source
const PrimaryIngressPoolID = string(ingresspool.PrimaryID)
View Source
const PublisherAccessLifetime = 5 * time.Minute
View Source
const PublisherAliasWildcardLifetime = 2 * time.Minute
View Source
const PublisherEnrollmentLifetime = 10 * time.Minute
View Source
const ReviewSchemaVersion = 1

ReviewSchemaVersion identifies the review records and JSON payloads written by this control build. record versions are independent of database migrations.

View Source
const WorkloadHistoryRetention = serviceaudit.Retention

WorkloadHistoryRetention follows service audit's authored history policy. expiry, rather than lease loss or revocation, bounds credential/replay lifetime.

View Source
const WorkloadRenewAfter = 30 * time.Second

Variables

View Source
var (
	ErrAdminInvalid               = errors.New("controlstate: invalid administration request")
	ErrMaintenanceControlNotFound = errors.New("controlstate: maintenance control not found")
	ErrServiceCreationGated       = errors.New("controlstate: service creation is disabled")
	ErrServiceRunCreationGated    = errors.New("controlstate: service run creation is disabled")
)
View Source
var (
	ErrProjectConfigurationInvalid = errors.New("project configuration is invalid")
	ErrProjectConfigurationStale   = errors.New("project configuration revision changed")
	ErrProjectSourceConflict       = errors.New("project key is bound to another source")
)
View Source
var (
	ErrControlAuthentication = errors.New("controlstate: invalid control credential")
	ErrControlIdentity       = errors.New("controlstate: identity is unavailable")
	ErrManagedDomainMismatch = errors.New("controlstate: configured managed domain changed")
	ErrOIDCAssertionReplay   = errors.New("controlstate: OIDC assertion was already exchanged")
)
View Source
var (
	ErrCertificateIssuanceGated       = errors.New("controlstate: certificate issuance is disabled")
	ErrCertificateIssuanceIdempotency = errors.New("controlstate: certificate issuance idempotency conflict")
	ErrCertificateIssuanceInvalid     = errors.New("controlstate: certificate issuance request is invalid")
	ErrCertificateIssuanceNotFound    = errors.New("controlstate: certificate issuance not found")
)
View Source
var (
	ErrDeploymentNotFound = errors.New("deployment not found")
	ErrDeploymentStale    = errors.New("deployment changed")
)
View Source
var (
	ErrDNSAuthorityWorkStale = errors.New("controlstate: DNS authority work lease is stale")
	ErrDNSAuthorityInvalid   = errors.New("controlstate: DNS authority request is invalid")
	ErrDNSAuthorityNotFound  = errors.New("controlstate: DNS authority not found")
)
View Source
var (
	ErrFeedbackInvalid = errors.New("controlstate: feedback request is invalid")
	ErrFeedbackAccess  = errors.New("controlstate: feedback access denied")
)
View Source
var (
	ErrGuestUnknown    = errors.New("controlstate: guest credential is invalid")
	ErrGuestTrialSpent = errors.New("controlstate: guest demo trial is exhausted")
	ErrGuestIssuance   = errors.New("controlstate: guest demo creation is rate limited")
	ErrGuestNamespace  = errors.New("controlstate: guest namespace is reserved")
)
View Source
var (
	ErrIngressAlreadyRunning = errors.New("controlstate: ingress identity already has a live process run")
	ErrIngressLeaseStale     = errors.New("controlstate: ingress lease identity or revision is stale")
)
View Source
var (
	ErrPreviewNotFound = errors.New("controlstate: preview not found")
	ErrPreviewAccess   = errors.New("controlstate: preview access denied")
	ErrPreviewStale    = errors.New("controlstate: preview membership changed")
)
View Source
var (
	ErrRelayCertificateWorkStale   = errors.New("controlstate: relay certificate work lease is stale")
	ErrRelayCertificateWorkInvalid = errors.New("controlstate: relay certificate work is invalid")
)
View Source
var (
	ErrRelayTransportCertificateInvalid    = errors.New("controlstate: relay transport certificate is invalid")
	ErrRelayTransportCertificateNotFound   = errors.New("controlstate: relay transport certificate is not available")
	ErrRelayTransportCertificateLeaseStale = errors.New("controlstate: relay transport certificate lease is stale")
)
View Source
var (
	ErrRelayRegistrationConflict       = errors.New("controlstate: relay identity or service configuration conflicts with live state")
	ErrRelayLeaseStale                 = errors.New("controlstate: relay lease identity or revision is stale")
	ErrRelayDraining                   = errors.New("controlstate: relay is draining")
	ErrRelayConnectionCapacity         = errors.New("controlstate: relay connection capacity is exhausted")
	ErrPublisherConnectionRelayService = errors.New("controlstate: publisher connection is assigned to another relay service")
)
View Source
var (
	ErrServiceManagerRequired       = errors.New("current service manager required")
	ErrServiceSourceSignInRequired  = errors.New("current company source sign-in required")
	ErrServiceVerifiedEmailRequired = errors.New("verified email required")
)
View Source
var (
	ErrServiceEndpointDNSInvalid   = errors.New("controlstate: invalid service endpoint DNS work")
	ErrServiceEndpointDNSWorkStale = errors.New("controlstate: service endpoint DNS work lease is stale")
)
View Source
var (
	ErrShareNotFound    = errors.New("controlstate: share not found")
	ErrShareInvalid     = errors.New("controlstate: share is invalid")
	ErrShareIdempotency = errors.New("controlstate: share idempotency conflict")
	ErrShareStale       = errors.New("controlstate: share service state changed")
	ErrShareLimit       = errors.New("controlstate: service has too many active shares or share cookies")
)
View Source
var (
	ErrAuthorityAccess      = errors.New("controlstate: authority access denied")
	ErrAuthorityConflict    = errors.New("controlstate: authority state conflict")
	ErrAuthorityIdempotency = errors.New("controlstate: authority idempotency conflict")
	ErrAuthorityInvalid     = errors.New("controlstate: authority request is invalid")
	ErrMembershipNotFound   = errors.New("controlstate: membership not found")
	ErrTeamNotFound         = errors.New("controlstate: team not found")
	ErrTeamNameUnavailable  = errors.New("controlstate: team name unavailable")
	ErrMemberSlugRequired   = errors.New("controlstate: member slug required")
)
View Source
var (
	ErrWorkloadDenied   = errors.New("workload is not authorized by the saved workload policy")
	ErrWorkloadConflict = errors.New("workload execution is already bound to another key or scope")
	ErrWorkloadBinding  = errors.New("workload binding requires verified provider metadata")
	ErrWorkloadExpired  = fmt.Errorf("%w: workload session lease, platform proof, or hard deadline has expired", ErrWorkloadDenied)
)
View Source
var ErrACMEWorkStale = errors.New("controlstate: ACME work lease is stale")
View Source
var ErrConnectorPeerBindingStale = errors.New("connector network binding is stale")
View Source
var ErrDNSChallengeNotFound = errors.New("controlstate: DNS challenge not found")
View Source
var ErrDeploymentAccess = errors.New("deployment operation is outside the current credential approval")
View Source
var ErrDeploymentCredentialUnavailable = errors.New("original deployment credential approval is no longer usable")
View Source
var ErrDeploymentPublisher = errors.New("deployment lease or enrollment is unavailable")
View Source
var ErrDeploymentPublisherNotFound = errors.New("deployment publisher not found")
View Source
var ErrDeviceLogin = errors.New("device login is invalid or expired")
View Source
var ErrDiscoveryCursor = errors.New("invalid discovery cursor")
View Source
var ErrDomainNotFound = errors.New("controlstate: domain not found")
View Source
var ErrEmailDeliveryLeaseStale = errors.New("email delivery lease is stale")
View Source
var ErrIngressPoolInvalid = errors.New("controlstate: invalid ingress pool")
View Source
var ErrIngressPoolUnavailable = errors.New("ingress pool port policy has not been initialized")
View Source
var (
	ErrInsufficientRelayServices = errors.New("controlstate: insufficient relay services")
)
View Source
var ErrInvitationNotFound = errors.New("controlstate: invitation not found")
View Source
var ErrProjectManaged = errors.New("resource is managed by project configuration")

normal resource APIs cannot change definitions or grants owned by apply. extra visitor grants and operational publisher identity revocation are separate.

View Source
var ErrPublisherAliasWildcardBinding = errors.New("controlstate: publisher alias wildcard has no compatible DNS authority and ingress pool")
View Source
var ErrPublisherAliasWildcardStale = errors.New("controlstate: publisher alias wildcard work lease is stale")
View Source
var ErrPublisherDeploymentConflict = errors.New("publisher deployment binding conflicts with the recorded replica")
View Source
var ErrPublisherEnrollment = errors.New("publisher enrollment is invalid, expired, or consumed")
View Source
var ErrPublisherIdentity = errors.New("publisher identity or grant is unavailable")
View Source
var ErrPublisherRuntimeStale = errors.New("publisher runtime has been replaced or stopped")
View Source
var ErrPublisherWatchContended = errors.New("publisher watch authorization database contention")
View Source
var ErrServiceAccess = errors.New("service access denied or no current run")
View Source
var ErrServiceAuditAccess = errors.New("service audit access denied")
View Source
var ErrServiceConflict = errors.New("service name or idempotency key conflicts")
View Source
var ErrServiceEndpointDNSPending = errors.New("wait for managed endpoint DNS cleanup before releasing its reservation")
View Source
var ErrServiceEndpointPublic = errors.New("disable public endpoint access before releasing its reservation")
View Source
var ErrServiceMetadata = errors.New("saved service trust is invalid")
View Source
var ErrServicePortInventoryMismatch = errors.New("configured service ports differ from the saved ingress pool; apply the change explicitly with tnld ingress-pool apply")
View Source
var ErrServicePortsExhausted = errors.New("ingress pool has no available service port")
View Source
var ErrServicePortsInUse = errors.New("service port inventory excludes a held or quarantined port")
View Source
var ErrServiceRecoveryEpisodeStale = errors.New("controlstate: service recovery episode is stale")
View Source
var ErrTrafficSelection = errors.New("controlstate: invalid traffic selection")
View Source
var ErrVisitorPermission = errors.New("visitor permission is denied")
View Source
var ErrVisitorPolicy = errors.New("visitor policy is unavailable")
View Source
var ErrVisitorSignIn = errors.New("visitor sign-in required")
View Source
var ErrVisitorSigningKey = errors.New("visitor signing key is unavailable")

Functions

func AuthenticateVisitorSubjectKey

func AuthenticateVisitorSubjectKey(ctx context.Context, tx pgx.Tx, subject VisitorSubject, service string, now time.Time) (ed25519.PublicKey, time.Time, error)

AuthenticateVisitorSubjectKey is the shared private credential seam for the transport adapter. workload sessions never borrow visitor_devices rows.

func CompanyActorNonce

func CompanyActorNonce(method, path string, body []byte) string

CompanyActorNonce binds a verified standard OIDC nonce to one exact HTTP operation. the body digest is of the bytes sent, not reserialized JSON.

func IsUnavailable

func IsUnavailable(err error) bool

IsUnavailable identifies known database transport and temporary admission failures. callers keep unknown faults internal; a joined independent fault does not become unavailable merely because another cause is temporary.

func Migrate

func Migrate(ctx context.Context, directURL string) (retErr error)

Migrate initializes or upgrades the control schema through a direct PostgreSQL URL. a persistent table lock allows only one migration at a time. a newer schema with the supported baseline is left unchanged.

func RecordServiceAudit

func RecordServiceAudit(ctx context.Context, tx pgx.Tx, event serviceaudit.Event, requestID string) error

RecordServiceAudit appends a safe management fact to the caller's transaction. requestID must identify the mutation, not contain configuration or credentials. callers authorize the operation before using this helper; service scope and actor syntax are independently checked here so a malformed scope rolls back.

func ServiceActorNonce

func ServiceActorNonce(method, target string, body []byte) string

ServiceActorNonce binds only the service-access bridge, including the exact escaped request target (and raw query, if present) and the bytes sent.

func SetServiceAuditActor

func SetServiceAuditActor(ctx context.Context, tx pgx.Tx, actor string) error

SetServiceAuditActor binds database-normalized events to an authenticated management actor for this transaction only. never call it with client claims.

func ValidServiceConfigurationDigest

func ValidServiceConfigurationDigest(digest string) bool

func VisitorSubjectAccess

func VisitorSubjectAccess(ctx context.Context, tx pgx.Tx, service string, subject VisitorSubject, now time.Time) (time.Time, int64, error)

VisitorSubjectAccess is shared by human and workload data-plane adapters. call while holding the service/team admission lock; it never grants access from human membership to a workload or expands the issued service snapshot.

func WithCompanyActorProof

func WithCompanyActorProof(ctx context.Context, identity OIDCIdentity, expectedNonce string) context.Context

WithCompanyActorProof accepts only the result of the configured OIDC verifier. mutations consume the assertion and recheck current ownership in their own tx.

func WithControlPrincipal

func WithControlPrincipal(ctx context.Context, principal ControlPrincipal) context.Context

WithControlPrincipal carries only a principal authenticated by control. callers must never build this value from HTTP fields or linked account metadata.

func WithPublisherRequestSource

func WithPublisherRequestSource(ctx context.Context, source netip.Addr) context.Context

WithPublisherRequestSource carries the request peer observed by the control HTTP server. it grants no authority. guest run-token and publisher operations require it even if an earlier token exchange observed the same address. never populate it from a body, forwarded header, visitor source, or relay IP.

func WithServiceActorProof

func WithServiceActorProof(ctx context.Context, identity OIDCIdentity, nonce string) context.Context

WithServiceActorProof accepts only configured-issuer verification at the authority bridge. it grants no control session or public URL authority.

Types

type ACMEAccount

type ACMEAccount struct {
	ID            string
	DirectoryURL  string
	ContactEmail  string
	AccountKeyDER []byte
	AccountURL    string
	AcceptedTerms string
}

type ACMEAuthorizationChallenge

type ACMEAuthorizationChallenge struct {
	Method                                                       certificateidentity.ChallengeMethod
	AuthorizationURL, ChallengeURL, Token, PresentationReference string
	Digest                                                       [32]byte
	ExpiresAt                                                    time.Time
}

type ACMEAuthorizationState

type ACMEAuthorizationState string

ACMEAuthorizationState is the persisted stage for one identifier in an order. cleaning records intent before a DNS provider call; complete records cleanup.

const (
	ACMEAuthorizationPending    ACMEAuthorizationState = "pending"
	ACMEAuthorizationPresenting ACMEAuthorizationState = "presenting"
	ACMEAuthorizationPresented  ACMEAuthorizationState = "presented"
	ACMEAuthorizationValidating ACMEAuthorizationState = "validating"
	ACMEAuthorizationValid      ACMEAuthorizationState = "valid"
	ACMEAuthorizationCleaning   ACMEAuthorizationState = "cleaning"
	ACMEAuthorizationComplete   ACMEAuthorizationState = "complete"
	ACMEAuthorizationFailed     ACMEAuthorizationState = "failed"
	ACMEAuthorizationCanceled   ACMEAuthorizationState = "canceled"
)

type ACMEAuthorizationWork

type ACMEAuthorizationWork struct {
	ID                    string
	Identifier            string
	AuthorizationURL      string
	ChallengeType         certificateidentity.ChallengeMethod
	ChallengeURL          string
	ChallengeToken        string
	ChallengeDigest       [32]byte
	PresentationReference string
	State                 ACMEAuthorizationState
	Revision              uint64
	Attempts              uint64
	AvailableAt           time.Time
	PresentedAt           *time.Time
	ValidatedAt           *time.Time
	CleanupCompletedAt    *time.Time
	ExpiresAt             *time.Time
	LastError             string
	CreatedAt             time.Time
	UpdatedAt             time.Time
}

func (ACMEAuthorizationWork) Challenge

func (authorization ACMEAuthorizationWork) Challenge() (ACMEAuthorizationChallenge, error)

type ACMEFinalization

type ACMEFinalization struct {
	OrderURL, FinalizeURL string
	CSRDER                []byte
}

these are validated payload views of the persisted work DTOs, not new stored models. workers request the payload for an action before making external calls.

type ACMEOrderState

type ACMEOrderState string

ACMEOrderState is the persisted stage of one public URL certificate issuance. certificate availability and publisher installation are separate transitions.

const (
	ACMEOrderPending           ACMEOrderState = "pending"
	ACMEOrderAuthorizing       ACMEOrderState = "authorizing"
	ACMEOrderReadyToFinalize   ACMEOrderState = "ready_to_finalize"
	ACMEOrderFinalizing        ACMEOrderState = "finalizing"
	ACMEOrderWaitingForInstall ACMEOrderState = "waiting_for_install"
	ACMEOrderInstalled         ACMEOrderState = "installed"
	ACMEOrderFailed            ACMEOrderState = "failed"
	ACMEOrderCanceled          ACMEOrderState = "canceled"
)

type ACMEOrderWork

type ACMEOrderWork struct {
	Subject                CertificateSubject `json:"-"`
	ID                     string
	Account                ACMEAccount
	CertificateCacheKey    string
	CertificateScope       string
	CertificateIdentifiers []string
	ChallengeMethod        certificateidentity.ChallengeMethod
	CSRDER                 []byte
	CSRDigest              [32]byte
	State                  ACMEOrderState
	OrderRevision          uint64
	OrderURL               string
	FinalizeURL            string
	FinalizationPossible   bool
	CertificateURL         string
	CertificatePEM         []byte
	NotBefore              *time.Time
	NotAfter               *time.Time
	RenewAt                *time.Time
	Attempts               uint64
	AvailableAt            time.Time
	LastError              string
	CreatedAt              time.Time
	UpdatedAt              time.Time
	WorkerID               string
	WorkEpoch              uint64
	WorkExpiresAt          time.Time
	Authorizations         []ACMEAuthorizationWork
}

func (ACMEOrderWork) Finalization

func (work ACMEOrderWork) Finalization() (ACMEFinalization, error)

func (ACMEOrderWork) IssuedCertificate

func (work ACMEOrderWork) IssuedCertificate() (IssuedCertificate, error)

func (ACMEOrderWork) NeedsFinalizationRecovery

func (work ACMEOrderWork) NeedsFinalizationRecovery() bool

NeedsFinalizationRecovery deliberately does not classify failed/canceled as terminal: the CA may have issued after a lost finalize reply.

func (*ACMEOrderWork) RecordIssuedCertificate

func (work *ACMEOrderWork) RecordIssuedCertificate(pem []byte, now time.Time) (IssuedCertificate, error)

RecordIssuedCertificate retains the actual CA lifetime even when this is recovery of a failed/canceled finalization. installation remains separate.

type AddPreviewServiceRequest

type AddPreviewServiceRequest struct {
	PreviewID, ServiceID, TeamID, IdentityID string
}

type AdminRelayPage

type AdminRelayPage struct {
	Relays     []RelayLease
	NextCursor string
}

AdminRelayPage is one stable relay-ID-ordered page of unexpired leases.

type AdminRuntimeCounts

type AdminRuntimeCounts struct {
	EnabledServices     int64
	SuspendedServices   int64
	StartingServiceRuns int64
	ReadyServiceRuns    int64
	IngressLeases       int64
	RelayLeases         int64
}

AdminRuntimeCounts contains current stored state counts for server status.

type AllocateDeploymentPublicationRequest

type AllocateDeploymentPublicationRequest struct {
	DeploymentScope
	AllocateServiceRequest
	Deployment string
	Now        time.Time
}

type AllocateGuestDemoServiceRequest

type AllocateGuestDemoServiceRequest struct {
	Credential         GuestCredential
	IdempotencyKey     string
	Target             string
	RequirePostQuantum bool
	DNSAutomation      bool
	Now                time.Time
}

type AllocateServiceRequest

type AllocateServiceRequest struct {
	Invocation    string
	Configuration ProjectServiceConfiguration
	ExpiresAt     *time.Time
}

type AppliedDeployment

type AppliedDeployment struct {
	DeploymentNames []string `json:"deployment_names"`
	ID              string   `json:"id"`
	Name            string   `json:"name"`
	Namespace       string   `json:"namespace"`
	DomainID        string   `json:"domain_id"`
	Public          bool     `json:"public"`
}

type AppliedProjectConfiguration

type AppliedProjectConfiguration struct {
	RetiredAt           *time.Time                  `json:"retired_at,omitempty"`
	TeamID              string                      `json:"team_id"`
	ProjectKey          string                      `json:"project_key"`
	SourceFingerprint   string                      `json:"source_fingerprint"`
	Revision            int64                       `json:"revision,string"`
	ConfigurationHash   string                      `json:"configuration_hash"`
	Configuration       ProjectConfiguration        `json:"configuration"`
	Services            []AppliedProjectService     `json:"services"`
	Members             []DeploymentPublisherStatus `json:"members"`
	Deployments         []AppliedDeployment         `json:"deployments"`
	Deployment          string                      `json:"deployment"`
	ServiceDeclarations map[string]string           `json:"service_declarations"`
}

type AppliedProjectService

type AppliedProjectService struct {
	Service         string `json:"service"`
	Deployment      string `json:"deployment"`
	Kind            string `json:"service_kind"`
	ServiceID       string `json:"service_id,omitempty"`
	Hostname        string `json:"hostname,omitempty"`
	DesiredRevision int64  `json:"desired_revision,string"`
	TrustRevision   int64  `json:"trust_revision,string"`
	Port            int    `json:"port,omitempty"`
	Public          bool   `json:"public,omitempty"`
}

type ApplyProjectConfigurationRequest

type ApplyProjectConfigurationRequest struct {
	TeamID, ProjectKey, SourceFingerprint, ActorID string
	Source                                         *naming.GitProjectSource
	Deployment                                     string
	ServiceDeclarations                            map[string]string
	ProjectLabel                                   string
	ExpectedRevision                               int64
	Configuration                                  ProjectConfiguration
	DNSAutomation                                  bool
	TrafficDefaults, TrafficCeiling                trafficlimits.Limits
	Now                                            time.Time
	// contains filtered or unexported fields
}

type BrowserAccessSession

type BrowserAccessSession struct {
	ParentControlSessionID string
	IdentityID             string
	DisplayName            string
	AccessToken            string
	RefreshToken           string
	AccessExpiresAt        time.Time
	ExpiresAt              time.Time
}

type BrowserHandoff

type BrowserHandoff struct {
	Origin     string
	Token      string
	ReturnPath string
}

type BrowserLoginAttempt

type BrowserLoginAttempt struct {
	Subject       visitorscope.Scope
	Hostname      string
	ServiceRunIDs []string
	PreviewID     string
	CompanyIntent *CompanyIntentBinding
	ReturnPath    string
	Nonce         string
	Verifier      string
}

type BrowserSessionTokenSource

type BrowserSessionTokenSource struct{ Secret string }

func (BrowserSessionTokenSource) GoString

func (BrowserSessionTokenSource) GoString() string

func (BrowserSessionTokenSource) String

type BrowserTokenRotation

type BrowserTokenRotation struct {
	IdentityID      string
	AccessToken     string
	RefreshToken    string
	AccessExpiresAt time.Time
}

type BrowserTokenSource

type BrowserTokenSource struct{ PreviewID string }

type CertificateIssuance

type CertificateIssuance struct {
	// new order facts describe a committed insertion, not an idempotent retry.
	NewOrder            bool
	DomainKind          DomainKind
	ID                  string
	ServiceRunID        string
	ServiceID           string
	ServiceRunNumber    uint64
	PublisherIdentityID string
	CertificatePlan     CertificatePlan
	State               ACMEOrderState
	CertificatePEM      string
	RetryAt             *time.Time
	NotBefore           *time.Time
	NotAfter            *time.Time
	CreatedAt           time.Time
	UpdatedAt           time.Time
}

type CertificatePlan

type CertificatePlan struct {
	CacheKey        string                              `json:"cache_key"`
	Scope           string                              `json:"scope"`
	Identifiers     []string                            `json:"identifiers"`
	ChallengeMethod certificateidentity.ChallengeMethod `json:"challenge_method"`
}

type CertificateSubject

type CertificateSubject struct {
	Kind      CertificateSubjectKind
	ID        string
	RunID     string
	RunNumber uint64
}

CertificateSubject binds one certificate order to exactly one service and run. IDs remain opaque; the stored run ID and number bind each order to one service.

func (CertificateSubject) Valid

func (s CertificateSubject) Valid() bool

type CertificateSubjectKind

type CertificateSubjectKind string
const (
	CertificateSubjectService CertificateSubjectKind = "service"
)

type ClaimDomainRequest

type ClaimDomainRequest struct {
	IdentityID       string
	TeamID           string
	IdempotencyKey   string
	RequestDigest    [32]byte
	Domain           string
	MakeDefault      bool
	DelegationSetID  string
	NameserverDomain string
}

type CompanyAdmissionPage

type CompanyAdmissionPage struct {
	Requests   []CompanyAdmissionRequest `json:"requests"`
	NextCursor string                    `json:"next_cursor,omitempty"`
}

type CompanyAdmissionRequest

type CompanyAdmissionRequest struct {
	ID                   string    `json:"request_id"`
	TeamID               string    `json:"team_id"`
	IdentityConnectionID string    `json:"identity_connection_id"`
	ConnectionRevision   int64     `json:"connection_revision,string"`
	IdentityID           string    `json:"identity_id"`
	Subject              string    `json:"subject"`
	MemberSlug           string    `json:"member_slug"`
	State                string    `json:"state"`
	CreatedAt            time.Time `json:"created_at"`
}

type CompanyConnections

type CompanyConnections struct {
	Active *IdentityConnection `json:"active,omitempty"`
	Setup  *IdentityConnection `json:"setup,omitempty"`
}

type CompanyIntentBinding

type CompanyIntentBinding struct {
	ID           string
	BindingToken string
	RedirectURI  string
}

type CompanyLoginIntent

type CompanyLoginIntent struct {
	ID                   string    `json:"intent_id"`
	TeamID               string    `json:"team_id"`
	IdentityConnectionID string    `json:"identity_connection_id"`
	ConnectionRevision   int64     `json:"connection_revision,string"`
	SourceID             string    `json:"source_id"`
	Issuer               string    `json:"issuer"`
	ClientID             string    `json:"client_id"`
	RedirectURI          string    `json:"redirect_uri"`
	Nonce                string    `json:"nonce"`
	BindingToken         string    `json:"binding_token,omitempty"`
	ExpiresAt            time.Time `json:"expires_at"`
}

type CompanyMembershipDecision

type CompanyMembershipDecision struct {
	Suspended                bool
	PersonalAccountException bool
}

suspension and a personal-account exception remain independent: an exception never unsuspends a member, including when both are explicitly set together.

type ConnectorPeerPair

type ConnectorPeerPair struct {
	ID, ServiceID, ServiceRunID, PublisherIdentityID string
	Subject                                          VisitorSubject
	RunNumber, DeliveryGeneration                    int64
	Key                                              string
	DeliveryID                                       [16]byte
	Relays                                           [2]ConnectorPeerPairRelay
	ExpiresAt                                        time.Time
	ObservedAt, PublisherPreparedUntil               time.Time
	RunValidUntil                                    time.Time
	Metadata                                         ServiceMetadata
	VisitorPermission                                IssuedVisitorToken
	SessionKey, OperationID, BindingChallenge        string
	TrustRevision                                    int64
	BindingState                                     string
	SourceIP                                         netip.Addr
	PublisherProvedUntil                             time.Time
}

func (ConnectorPeerPair) GoString

func (ConnectorPeerPair) GoString() string

func (ConnectorPeerPair) String

func (ConnectorPeerPair) String() string

type ConnectorPeerPairCandidate

type ConnectorPeerPairCandidate struct {
	PairID             string
	DeliveryGeneration int64
	OwnerRevision      int64
	Retired            bool
	Retirement         *ConnectorPeerPairRetirementObservation
	OwnerAuthority     *ConnectorPeerPairOwnerAuthority
}

ConnectorPeerPairCandidate identifies background preparation work. it contains neither a key nor authority to deliver packets or admit an application.

type ConnectorPeerPairCandidates

type ConnectorPeerPairCandidates struct {
	Items     []ConnectorPeerPairCandidate
	NextAfter string
}

type ConnectorPeerPairDelivery

type ConnectorPeerPairDelivery struct {
	PairID, ServiceID, ServiceRunID, PublisherIdentityID         string
	RunNumber, DeliveryGeneration, TrustRevision                 int64
	Subject                                                      VisitorSubject
	DeliveryID                                                   [16]byte
	Key, SessionKey, OperationID, BindingChallenge, BindingState string
	SourceIP                                                     netip.Addr
	Relays                                                       [2]ConnectorPeerPairRelay
	ObservedAt, ExpiresAt                                        time.Time
}

func (ConnectorPeerPairDelivery) GoString

func (ConnectorPeerPairDelivery) GoString() string

func (ConnectorPeerPairDelivery) String

type ConnectorPeerPairLegClaim

type ConnectorPeerPairLegClaim struct {
	PairID             string
	DeliveryID         [16]byte
	DeliveryGeneration int64
	ConnectionSlot     int
	Key                string
	SourceIP           netip.Addr
	ObservedAt         time.Time
	ExpiresAt          time.Time
	BindingState       tunnelv1.ConnectorPeerLegBindingState
}

ConnectorPeerPairLegClaim is delivery authority for one relay leg. the key is secret material; the relay must still check its local session and application stream admission before using it.

func (ConnectorPeerPairLegClaim) GoString

func (ConnectorPeerPairLegClaim) GoString() string

func (ConnectorPeerPairLegClaim) String

type ConnectorPeerPairOwnerAuthority

type ConnectorPeerPairOwnerAuthority struct {
	ObservedAt, ExpiresAt time.Time
}

type ConnectorPeerPairPrepared

type ConnectorPeerPairPrepared struct {
	DeliveryID                           [16]byte
	DeliveryGeneration                   int64
	BindingExpiresAt                     time.Time
	Phase, OperationID, BindingChallenge string
	PathProofs                           []tunnelv1.ConnectorPeerPairPathProof
}

type ConnectorPeerPairReady

type ConnectorPeerPairReady struct {
	PublisherIdentityID string
	Relays              [2]ConnectorPeerPairRelay
}

ConnectorPeerPairReady is a credential-free signing hint, never delivery authority.

type ConnectorPeerPairRebindRequest

type ConnectorPeerPairRebindRequest struct {
	Proof     tunnelv1.ConnectorPeerPairRebindProof
	Source    VisitorTokenSource
	Signature []byte
}

type ConnectorPeerPairRebindState

type ConnectorPeerPairRebindState struct {
	Active, Pending              *ConnectorPeerPair
	HighWaterGeneration          int64
	PendingUntil                 time.Time
	ReadyRelays                  []ConnectorPeerPairRelay
	OperationID, OperationStatus string
	OperationGeneration          int64
}

func (ConnectorPeerPairRebindState) GoString

func (ConnectorPeerPairRebindState) String

type ConnectorPeerPairRelay

type ConnectorPeerPairRelay struct {
	PublisherConnectionID string             `json:"publisher_connection_id"`
	AssignmentRevision    int64              `json:"assignment_revision,string"`
	RelayLease            RelayLeaseIdentity `json:"relay_lease"`
	RelayAddress          string             `json:"relay_address"`
	TLSServerName         string             `json:"tls_server_name"`
}

type ConnectorPeerPairRequest

type ConnectorPeerPairRequest struct {
	ServiceID, ServiceRunID, PublisherIdentityID, IdempotencyKey string
	RunNumber                                                    int64
	Subject                                                      VisitorSubject
	Source                                                       VisitorTokenSource
	Signature                                                    []byte
	Action                                                       string
	RequestedAt                                                  time.Time
	PreviousPairID                                               string
	PreviousGeneration                                           int64
	ExpectedRelays                                               [2]ConnectorPeerPairRelay
}

ConnectorPeerPairRequest is an authority request, not a visitor stream opening. source must be a current device control session or workload credential. the signature proves possession of that source's enrolled native key.

type ConnectorPeerPairRetireRequest

type ConnectorPeerPairRetireRequest struct {
	Proof                   tunnelv1.ConnectorPeerPairRetireProof
	SessionProof, Signature []byte
}

func (ConnectorPeerPairRetireRequest) GoString

func (ConnectorPeerPairRetireRequest) String

type ConnectorPeerPairRetirement

type ConnectorPeerPairRetirement struct {
	PairID, ServiceID, ServiceRunID, PublisherIdentityID string
	DeliveryID, IdempotencyKey                           string
	RunNumber, OwnerRevision                             int64
	Retirement                                           ConnectorPeerPairRetirementObservation
}

type ConnectorPeerPairRetirementObservation

type ConnectorPeerPairRetirementObservation struct {
	ObservedAt, RetiredAt, RetainedUntil time.Time
}

type ConnectorPeerWatchVersion

type ConnectorPeerWatchVersion struct {
	RunID          string
	Revision       int64
	PolicyBookmark string
}

ConnectorPeerWatchVersion is a hint for an exact service run. -1 means there is no bookmark (in a request) or no current run (in a response).

type ControlPrincipal

type ControlPrincipal struct {
	SessionID               string
	IdentityID              string
	Administrator           bool
	RetrySecret             [32]byte
	RefreshExpiresAt        time.Time
	OIDCIssuer, OIDCSubject string
}

type ControlSession

type ControlSession struct {
	CompanyAuthenticationExpiresAt *time.Time
	SessionID                      string
	AccessToken                    credentials.AccessToken
	AccessExpiresAt                time.Time
	RefreshToken                   credentials.RefreshToken
	RefreshExpiresAt               time.Time
	Identity                       IdentityContext
}

type CreateDeploymentPublisherEnrollmentRequest

type CreateDeploymentPublisherEnrollmentRequest struct {
	DeploymentScope
	Selector, IdempotencyKey string
	Services                 []string
	MaxMembers               int
	Lifetime                 time.Duration
	Now                      time.Time
}

type CreateDeploymentRequest

type CreateDeploymentRequest struct {
	DeploymentScope
	Name, IdempotencyKey string
	Targets              map[string]DeploymentTarget
	DNSAutomation        bool
	Now                  time.Time
}

type CreateIdentityConnectionRequest

type CreateIdentityConnectionRequest struct {
	TeamID           string
	Issuer           string
	Admission        string
	ReplaceID        string
	ExpectedRevision int64
	SourceID         string
}

type CreateInvitationRequest

type CreateInvitationRequest struct {
	PersonalAccountException bool
	IdentityID               string
	TeamID                   string
	IdempotencyKey           string
	RequestDigest            [32]byte
	MemberSlug               string
	InitialRole              TeamRole
	ExpiresAt                time.Time
	EmailRestriction         string
	RetrySecret              []byte
	SendEmail                bool
}

type CreatePublisherEnrollmentRequest

type CreatePublisherEnrollmentRequest struct {
	Preview                                  bool
	Ownership                                string
	Scope                                    PublisherScope
	Name, Kind, EditorID, EditorMembershipID string
	PolicyRevision                           uint64
	Now                                      time.Time
	Protocols                                []string
}

type CreatePublisherGrantRequest

type CreatePublisherGrantRequest struct {
	PublisherIdentityID          string
	Scope                        PublisherScope
	EditorID, EditorMembershipID string
	PolicyRevision               uint64
	ExpiresAt                    *time.Time
	Now                          time.Time
	Protocols                    []string
}

type CreateShareRequest

type CreateShareRequest struct {
	PreviewID, TeamID, Label, ActingIdentityID, IdempotencyKey string
	SecretFingerprint                                          [32]byte
	ExpiresAt                                                  time.Time
	ServiceIDs                                                 []string
	EntryServiceID                                             string
}

type CreateTeamRequest

type CreateTeamRequest struct {
	IdentityID     string
	IdempotencyKey string
	RequestDigest  [32]byte
	DisplayName    string
	MemberSlug     string
}

type CredentialDeliveryUnavailable

type CredentialDeliveryUnavailable struct {
	ResourceID string
}

an authorized exact creation retry cannot redeliver its original credential. only a digest is retained, so the original credential cannot be delivered again.

func (*CredentialDeliveryUnavailable) Error

type DNSAuthority

type DNSAuthority struct {
	Reference        string
	TeamID           string
	DomainID         string
	CanonicalDomain  string
	State            DNSAuthorityState
	RequiredRecords  []DNSRecord
	LastError        string
	ProviderZoneID   string
	Nameservers      []string
	NameserverDomain string
	DelegationSetID  string
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

type DNSAuthorityState

type DNSAuthorityState string

DNSAuthorityState is the stored state of a custom-domain DNS authority.

const (
	DNSAuthorityPending   DNSAuthorityState = "pending"
	DNSAuthorityReady     DNSAuthorityState = "ready"
	DNSAuthorityReleasing DNSAuthorityState = "releasing"
	DNSAuthorityReleased  DNSAuthorityState = "released"
	DNSAuthorityFailed    DNSAuthorityState = "failed"
)

type DNSAuthorityWork

type DNSAuthorityWork struct {
	DNSAuthority
	Provider             string
	ProviderZoneID       string
	Nameservers          []string
	ClaimProofName       string
	ClaimProofValue      string
	ClaimProofVerifiedAt time.Time
	ClaimExpiresAt       time.Time
	WorkRevision         uint64
	Attempts             uint64
	AvailableAt          time.Time
	WorkerID             string
	WorkEpoch            uint64
	WorkExpiresAt        time.Time
}

type DNSChallengeChange

type DNSChallengeChange struct {
	DesiredDigest [32]byte
	ChangeID      string
}

type DNSChallengeContext

type DNSChallengeContext struct {
	Subject               CertificateSubject `json:"-"`
	ServiceID             string
	TeamID                string
	DomainID              string
	DNSAuthorityReference string
	CanonicalDomain       string
	AuthorizationID       string
	Identifier            string
	PresentationReference string
	State                 ACMEAuthorizationState
	ChallengeDigest       [32]byte
	Presentations         []DNSChallengePresentation
}

type DNSChallengePresentation

type DNSChallengePresentation struct {
	ChallengeDigest [32]byte
	Active          bool
}

type DNSRecord

type DNSRecord struct {
	Name  string
	Type  string
	Value string
}

type Database

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

Database is the PostgreSQL connection pool for control state. its database details remain private to this package.

func Open

func Open(ctx context.Context, pooledURL, currentStorageKey, previousStorageKey string, mode naming.ManagedURLMode) (*Database, error)

Open uses the default serving pool with prepared statements.

func (*Database) AcceptInvitation

func (d *Database) AcceptInvitation(
	ctx context.Context,
	identityID string,
	token credentials.InvitationToken,
	now time.Time,
) (result Membership, retErr error)

func (*Database) AcceptServiceInvitation

func (d *Database) AcceptServiceInvitation(ctx context.Context, identityID, secret string, now time.Time) (result ServiceGrant, retErr error)

func (*Database) AcknowledgeDeploymentPublisherConfiguration

func (d *Database) AcknowledgeDeploymentPublisherConfiguration(ctx context.Context, token string, revision int64, hash string, healthy bool, now time.Time) (retErr error)

func (*Database) AcquireDeploymentPublisherLease

func (d *Database) AcquireDeploymentPublisherLease(ctx context.Context, id, deployment, assertion, audience string, now time.Time) (result DeploymentPublisherLease, retErr error)

func (*Database) ActivateIdentityConnection

func (d *Database) ActivateIdentityConnection(ctx context.Context, p ControlPrincipal, team, id, setupToken string, revision int64, source OIDCIdentity, now time.Time, provisioningToken string) (result IdentityConnectionSecret, retErr error)

func (*Database) AddPreviewService

func (d *Database) AddPreviewService(ctx context.Context, request AddPreviewServiceRequest, now time.Time) (result Preview, retErr error)

func (*Database) AdminRuntimeCounts

func (d *Database) AdminRuntimeCounts(ctx context.Context, now time.Time) (AdminRuntimeCounts, error)

AdminRuntimeCounts returns counts evaluated against one captured timestamp.

func (*Database) AdmitPublicServiceVisitor

func (d *Database) AdmitPublicServiceVisitor(ctx context.Context, lease IngressLeaseIdentity, pool, visitor string, port int, source netip.Addr, now time.Time, continuation ...ServiceRunCursor) (result PublicServiceVisitorAdmission, retErr error)

AdmitPublicServiceVisitor reserves bounded native pre-authentication capacity by trusted destination port, without inspecting protocol negotiation.

func (*Database) AllocateDeploymentPublication

func (d *Database) AllocateDeploymentPublication(ctx context.Context, r AllocateDeploymentPublicationRequest) (result ServiceRecord, retErr error)

temporary approval selects the same service allocator as namespace grants. named publication, management and connector approval grant no allocation right.

func (*Database) AllocateGuestDemoService

func (d *Database) AllocateGuestDemoService(ctx context.Context, request AllocateGuestDemoServiceRequest) (result ServiceRecord, retErr error)

func (*Database) AllocatePublisherService

func (d *Database) AllocatePublisherService(ctx context.Context, p PublisherIdentity, r AllocateServiceRequest, now time.Time) (result ServiceRecord, retErr error)

func (*Database) ApplyProjectConfiguration

func (d *Database) ApplyProjectConfiguration(ctx context.Context, r ApplyProjectConfigurationRequest) (result AppliedProjectConfiguration, retErr error)

func (*Database) ApproveDeviceLogin

func (d *Database) ApproveDeviceLogin(ctx context.Context, code string, binding []byte, managedDomain string, access, refresh time.Duration, now time.Time) error

func (*Database) AttachWorkloadAssertion

func (d *Database) AttachWorkloadAssertion(ctx context.Context, id, credential string, c oidc.WorkloadExecution, signature []byte, now time.Time) (result WorkloadSession, retErr error)

func (*Database) AuthenticateAccessToken

func (d *Database) AuthenticateAccessToken(
	ctx context.Context,
	token credentials.AccessToken,
	now time.Time,
) (ControlPrincipal, error)

func (*Database) AuthenticatePublisherAccess

func (d *Database) AuthenticatePublisherAccess(ctx context.Context, token, sourceIP string, now time.Time) (result PublisherIdentity, retErr error)

func (*Database) AuthorizeConnectorPeerWatch

func (d *Database) AuthorizeConnectorPeerWatch(ctx context.Context, serviceID, runID string, number int64, token string, now time.Time) (retErr error)

AuthorizeConnectorPeerWatch verifies subscription authority. the version reader does not confer it, and using a hint always requires another checked operation. the caller owns the lifetime and rechecks of open subscriptions.

func (*Database) AuthorizeImplementerFeedback

func (d *Database) AuthorizeImplementerFeedback(ctx context.Context, identity, service, preview, operation string, now time.Time) (result controlv1.FeedbackAuthorization, retErr error)

func (*Database) AuthorizePublisherManagement

func (d *Database) AuthorizePublisherManagement(ctx context.Context, team, publisher, editor string) error

management requires current team authority. a member can manage only the identity they enrolled; team admins can revoke a durable grant after its issuing member leaves. this check does not affect grant use.

func (*Database) AuthorizeReviewerFeedback

func (d *Database) AuthorizeReviewerFeedback(ctx context.Context, auth ServiceHTTPRun, preview, operation string, actor FeedbackActor, now time.Time) (result controlv1.FeedbackAuthorization, retErr error)

func (*Database) AuthorizeServiceClientCertificate

func (d *Database) AuthorizeServiceClientCertificate(ctx context.Context, service, runID, token, visitor string, number int64, source netip.Addr, port int, der []byte, now time.Time) (result ServiceVisitorValidity, retErr error)

func (*Database) AuthorizeTeamSession

func (d *Database) AuthorizeTeamSession(ctx context.Context, p ControlPrincipal, team string, now time.Time) error

func (*Database) BeginAdminRelayDrain

func (d *Database) BeginAdminRelayDrain(
	ctx context.Context,
	identity RelayLeaseIdentity,
	actorIdentityID, requestID string,
	now, deadline time.Time,
) (result RelayLease, retErr error)

BeginAdminRelayDrain drains one matching lease and records the administrator action in the same transaction.

func (*Database) BeginDeviceBrowser

func (d *Database) BeginDeviceBrowser(ctx context.Context, code, state, nonce, verifier string, binding []byte, team string, intent *CompanyLoginIntent, now time.Time) error

func (*Database) BeginIdentityConnectionSetup

func (d *Database) BeginIdentityConnectionSetup(ctx context.Context, p ControlPrincipal, r CreateIdentityConnectionRequest, now time.Time) (result IdentityConnectionSetup, retErr error)

BeginIdentityConnectionSetup leaves current access untouched until verified tenant consent activates this exact pending connection.

func (*Database) BeginIngressDrain

func (d *Database) BeginIngressDrain(
	ctx context.Context,
	identity IngressLeaseIdentity,
	now time.Time,
	deadline time.Time,
) (result IngressLease, retErr error)

BeginIngressDrain removes one exact ingress process from readiness and keeps its lease current through the drain deadline.

func (*Database) BeginRelayDrain

func (d *Database) BeginRelayDrain(
	ctx context.Context,
	identity RelayLeaseIdentity,
	now time.Time,
	deadline time.Time,
) (RelayLease, error)

BeginRelayDrain removes one exact relay process from placement and keeps its lease current through the deadline while established streams drain.

func (*Database) BeginServiceBrowserLogin

func (d *Database) BeginServiceBrowserLogin(ctx context.Context, subject visitorscope.Scope, preview, path, nonce, verifier string, binding []byte, intent *CompanyLoginIntent, now time.Time, hostnames ...string) (string, error)

func (*Database) CancelDeviceLogin

func (d *Database) CancelDeviceLogin(ctx context.Context, credential string, now time.Time) error

func (*Database) CheckWorkloadService

func (d *Database) CheckWorkloadService(ctx context.Context, credential, service string, now time.Time) (r WorkloadServiceAuthorization, retErr error)

func (*Database) ClaimACMEOrderWork

func (d *Database) ClaimACMEOrderWork(
	ctx context.Context,
	workerID string,
	now time.Time,
	leaseDuration time.Duration,
) (work ACMEOrderWork, found bool, retErr error)

func (*Database) ClaimConnectorPeerPairLeg

func (d *Database) ClaimConnectorPeerPairLeg(ctx context.Context, lease RelayLeaseIdentity, observedSource netip.Addr, proof tunnelv1.ConnectorPairLegProof, relaySignature []byte, now time.Time) (result ConnectorPeerPairLegClaim, retErr error)

ClaimConnectorPeerPairLeg verifies a signature from the exact current relay process. the split private relay HTTP API also authenticates the cluster secret; standalone calls in-process. observedSource comes from the relay socket, never from a connector frame, STUN, ICE, or an HTTP forwarding header.

func (*Database) ClaimDNSAuthorityWork

func (d *Database) ClaimDNSAuthorityWork(
	ctx context.Context,
	workerID string,
	now time.Time,
	leaseDuration time.Duration,
) (DNSAuthorityWork, bool, error)

func (*Database) ClaimInvitationEmail

func (d *Database) ClaimInvitationEmail(ctx context.Context, owner string, now time.Time) (EmailDelivery, error)

func (*Database) ClaimPublisherAliasWildcard

func (d *Database) ClaimPublisherAliasWildcard(ctx context.Context, worker string, now time.Time, lease time.Duration) (work PublisherAliasWildcardWork, found bool, err error)

func (*Database) ClaimRelayCertificateOrderWork

func (d *Database) ClaimRelayCertificateOrderWork(
	ctx context.Context,
	workerID string,
	now time.Time,
	leaseDuration time.Duration,
) (work RelayCertificateOrderWork, found bool, retErr error)

func (*Database) ClaimServiceEndpointDNSWork

func (d *Database) ClaimServiceEndpointDNSWork(ctx context.Context, worker string, now time.Time, duration time.Duration) (ServiceEndpointDNSWork, bool, error)

func (*Database) ClaimServicePublisherConnection

func (d *Database) ClaimServicePublisherConnection(ctx context.Context, connectionID, serviceID, runID string, runNumber, revision int64, credential string, observedSourceIP netip.Addr, lease RelayLeaseIdentity, now time.Time) (result ServicePublisherConnection, retErr error)

observedSourceIP is the original publisher transport peer reported by the authenticated relay. every claim requires a real bare address, even for a team service; a relay's control peer is not the publisher's source.

func (*Database) ClaimTeamDomain

func (d *Database) ClaimTeamDomain(
	ctx context.Context,
	request ClaimDomainRequest,
	now time.Time,
) (result Domain, retErr error)

func (*Database) CleanupExpiredConnectorPeerPairs

func (d *Database) CleanupExpiredConnectorPeerPairs(ctx context.Context, now time.Time, limit int) (count int64, retErr error)

CleanupExpiredConnectorPeerPairs removes expired delivery material after its signed request can no longer be replayed. callers may repeat bounded batches.

func (*Database) CleanupRelayRunSigningKeys

func (d *Database) CleanupRelayRunSigningKeys(ctx context.Context, now time.Time, limit int) (int64, error)

CleanupRelayRunSigningKeys removes only superseded bindings past the safety horizon. registration and cleanup lock leases before key rows so a returning run cannot change its key while cleanup races its registration.

func (*Database) CleanupServiceAudit

func (d *Database) CleanupServiceAudit(ctx context.Context, now time.Time, limit int) (removed int64, retErr error)

CleanupServiceAudit removes at most limit expired rows per worker call.

func (*Database) CleanupWorkloads

func (d *Database) CleanupWorkloads(ctx context.Context, now time.Time, limit int) (int64, error)

CleanupWorkloads prunes at most limit rows from each of six relations, in dependency order. each statement commits separately: later phases see removed children, and a timeout does not discard progress. blocked parents are filtered before selection so retained/live references cannot starve unrelated history.

func (*Database) Close

func (d *Database) Close()

Close closes all runtime database connections. it is safe to call more than once.

func (*Database) ClosePublicServiceVisitor

func (d *Database) ClosePublicServiceVisitor(ctx context.Context, lease IngressLeaseIdentity, visitor string, now time.Time) error

func (*Database) CloseServiceRun

func (d *Database) CloseServiceRun(ctx context.Context, serviceID, runID, token string, now time.Time) (retErr error)

func (*Database) ClosedServiceRuns

func (d *Database) ClosedServiceRuns(ctx context.Context, lease IngressLeaseIdentity, runs []ServiceRunReference, now time.Time) (closed []ServiceRunReference, retErr error)

ClosedServiceRuns proves only terminal state for exact requested tuples. a missing row, expired lease, or newer sibling is not closure evidence.

func (*Database) CompareConnectorPeerWatchVersions

func (d *Database) CompareConnectorPeerWatchVersions(ctx context.Context, watched []ConnectorPeerWatchVersion) (_ []ConnectorPeerWatchVersion, retErr error)

CompareConnectorPeerWatchVersions batches already authorized subscriptions. it does not read permissions, extend deadlines, or hold a connection after the comparison returns. only the operation that applies a snapshot can advance a publisher's bookmark.

func (*Database) CompleteStorageKeyRotation

func (d *Database) CompleteStorageKeyRotation(ctx context.Context) (retErr error)

CompleteStorageKeyRotation re-encrypts all currently claimable secrets. new writes always use the current key, so a successful pass cannot create more work for the configured previous key.

func (*Database) ConfigureControlOutageTolerance

func (d *Database) ConfigureControlOutageTolerance(tolerance time.Duration) error

ConfigureControlOutageTolerance changes future confirmations, never an already-issued deadline. daemon composition configures this before serving.

func (*Database) ConfigureIngressServicePorts

func (d *Database) ConfigureIngressServicePorts(ctx context.Context, pool string, ranges []tcpport.Range) (retErr error)

ConfigureIngressServicePorts serializes with allocation. removing an active or quarantined port cannot silently strand a private or public client profile.

func (*Database) ConfigureOIDCAdmissions

func (d *Database) ConfigureOIDCAdmissions(ctx context.Context, issuer string, rules []oidc.AdmissionRule, now time.Time) (retErr error)

ConfigureOIDCAdmissions runs once before serving. an existing/retired source is never replaced by configuration reconciliation; replacement is an explicit owner operation, and the new source's eligibility stays independently scoped.

func (*Database) ConfigureProjectPublisherLimits

func (d *Database) ConfigureProjectPublisherLimits(limits map[string]int)

ConfigureProjectPublisherLimits is called before control starts serving. all control processes must use the same overrides.

func (*Database) ConfigureService

func (d *Database) ConfigureService(ctx context.Context, serviceID, actorID string, metadata ServiceMetadata, configuration *ProjectServiceConfiguration, conditions ServiceUpdateConditions, now time.Time) (result ServiceRecord, retErr error)

metadata approval serializes with admission and publication. changing trust closes every old run so a visitor cannot receive bytes using old trust.

func (*Database) ConfigureServiceRunLease

func (d *Database) ConfigureServiceRunLease(duration time.Duration) error

func (*Database) ConfirmConnectorPeerPairPrepared

func (d *Database) ConfirmConnectorPeerPairPrepared(ctx context.Context, serviceID, runID, pairID, token string, prepared ConnectorPeerPairPrepared, now time.Time) error

func (*Database) ConsumeBrowserLogin

func (d *Database) ConsumeBrowserLogin(ctx context.Context, state string, binding []byte, now time.Time) (BrowserLoginAttempt, error)

func (*Database) ConsumeDeviceBrowser

func (d *Database) ConsumeDeviceBrowser(ctx context.Context, state string, binding []byte, now time.Time) (DeviceLogin, error)

consume before redeeming the one-use upstream code; an uncertain exchange requires a fresh browser attempt, never blind redemption of the same code.

func (*Database) CreateCompanyLoginIntent

func (d *Database) CreateCompanyLoginIntent(ctx context.Context, team, issuer, client, redirect string, now time.Time) (result CompanyLoginIntent, retErr error)

func (*Database) CreateDeployment

func (d *Database) CreateDeployment(ctx context.Context, r CreateDeploymentRequest) (result Deployment, retErr error)

func (*Database) CreateDeploymentPublisherEnrollment

func (d *Database) CreateDeploymentPublisherEnrollment(ctx context.Context, r CreateDeploymentPublisherEnrollmentRequest) (result DeploymentPublisherEnrollment, retErr error)

enrollment captures exact saved bindings, not a rule that admits future names. recovery returns the original secret and deadline only while that approval is still usable. it never creates a replacement installation credential.

func (*Database) CreateDeviceLogin

func (d *Database) CreateDeviceLogin(ctx context.Context, options DeviceLoginOptions, now time.Time) (result DeviceLogin, credential string, retErr error)

func (*Database) CreateGuestShare

func (d *Database) CreateGuestShare(ctx context.Context, credential GuestCredential, serviceID, key, label string, fingerprint [32]byte, expiresAt, now time.Time) (result Share, retErr error)

func (*Database) CreateGuestTrial

func (d *Database) CreateGuestTrial(ctx context.Context, guest NewGuestTrial, managedDomain string, now time.Time) (result GuestTrial, retErr error)

CreateGuestTrial provisions the managed domain and reserves the label. the reservation and trial commit together before a signed-in user can claim it.

func (*Database) CreateOIDCControlSession

func (d *Database) CreateOIDCControlSession(
	ctx context.Context,
	managedDomain string,
	identity OIDCIdentity,
	accessLifetime time.Duration,
	refreshLifetime time.Duration,
	now time.Time,
) (result ControlSession, retErr error)

CreateOIDCControlSession consumes one verified assertion and creates or updates its named local identity before issuing a local control session.

func (*Database) CreatePreview

func (d *Database) CreatePreview(ctx context.Context, teamID, identityID, key string, now time.Time) (result Preview, retErr error)

func (*Database) CreatePublisherGrant

func (d *Database) CreatePublisherGrant(ctx context.Context, r CreatePublisherGrantRequest) (result string, retErr error)

func (*Database) CreateServiceAt

func (d *Database) CreateServiceAt(ctx context.Context, teamID, actorID, name, key string, placement ServicePlacement, now time.Time, metadata ServiceMetadata, configuration *ProjectServiceConfiguration) (result ServiceRecord, retErr error)

func (*Database) CreateServiceCertificateIssuance

func (d *Database) CreateServiceCertificateIssuance(ctx context.Context, service, runID, token, directory, key string, number int64, der []byte, now time.Time) (result CertificateIssuance, retErr error)

func (*Database) CreateServiceGrant

func (d *Database) CreateServiceGrant(ctx context.Context, serviceID, actorID, key, kind, identityID string, expires *time.Time, now time.Time) (result ServiceGrant, retErr error)

func (*Database) CreateServiceHTTPGrant

func (d *Database) CreateServiceHTTPGrant(ctx context.Context, service, actor string, input controlv1.CreateVisitorCredentialRequest, now time.Time) (result controlv1.VisitorCredential, retErr error)

func (*Database) CreateServiceRunPreview

func (d *Database) CreateServiceRunPreview(ctx context.Context, auth ServiceHTTPRun, now time.Time) (result Preview, retErr error)

func (*Database) CreateShare

func (d *Database) CreateShare(ctx context.Context, request CreateShareRequest, now time.Time) (result Share, retErr error)

func (*Database) CreateTeam

func (d *Database) CreateTeam(ctx context.Context, request CreateTeamRequest, now time.Time) (result Team, retErr error)

func (*Database) CreateTeamInvitation

func (d *Database) CreateTeamInvitation(
	ctx context.Context,
	request CreateInvitationRequest,
	now time.Time,
) (result InvitationSecret, retErr error)

func (*Database) DNSAuthorityReleaseReady

func (d *Database) DNSAuthorityReleaseReady(ctx context.Context, domainID string, now time.Time) (bool, error)

func (*Database) DecideCompanyAdmission

func (d *Database) DecideCompanyAdmission(ctx context.Context, p ControlPrincipal, team, request string, revision int64, decision string, now time.Time) (retErr error)

func (*Database) DeleteDeployment

func (d *Database) DeleteDeployment(ctx context.Context, scope DeploymentScope, selector string, expected int64, now time.Time) (retErr error)

func (*Database) DeleteGuestService

func (d *Database) DeleteGuestService(ctx context.Context, serviceID string, credential GuestCredential, now time.Time) error

guest cleanup uses exact credential/source authority independently of ordinary management conditions, including terminal retries after READY exhaustion.

func (*Database) DeletePublisherService

func (d *Database) DeletePublisherService(ctx context.Context, p PublisherIdentity, id string, now time.Time) (retErr error)

publisher deletion uses allocation ownership and current publication permission, never human management authority or a hostname/deployment-name lookup.

func (*Database) DeleteService

func (d *Database) DeleteService(ctx context.Context, serviceID, actorID string, conditions ServiceDeleteConditions, now time.Time) error

func (*Database) DeliverConnectorPeerPair

func (d *Database) DeliverConnectorPeerPair(ctx context.Context, serviceID, runID, pairID string, generation int64, token string, now time.Time) (ConnectorPeerPairDelivery, error)

func (*Database) DenyDeviceBrowser

func (d *Database) DenyDeviceBrowser(ctx context.Context, code string, binding []byte, now time.Time) error

func (*Database) Diagnostics

func (d *Database) Diagnostics(parent context.Context) (result DatabaseDiagnostics, retErr error)

Diagnostics uses a separate connection through the configured pooled URL. It cannot be starved by the local pgx pool; pooler/database unavailability is still bounded by the timeout. it never returns query text or connection data.

func (*Database) DisconnectIdentityConnection

func (d *Database) DisconnectIdentityConnection(ctx context.Context, p ControlPrincipal, team, id string, revision int64, now time.Time) (retErr error)

func (*Database) DisconnectServicePublisherConnection

func (d *Database) DisconnectServicePublisherConnection(ctx context.Context, connectionID, runID string, runNumber, revision int64, lease RelayLeaseIdentity, now time.Time, unexpected bool) (result ServicePublisherConnection, retErr error)

func (*Database) EnrollGuestPublisher

func (d *Database) EnrollGuestPublisher(ctx context.Context, credential GuestCredential, serviceID string, public ed25519.PublicKey, now time.Time) (result PublisherIdentity, retErr error)

enroll a guest only after its demo service exists. the trial credential is a bootstrap credential, never a publisher namespace or run credential.

func (*Database) EnrollVisitorDevice

func (d *Database) EnrollVisitorDevice(ctx context.Context, identityID string, key ed25519.PublicKey, now time.Time) (result VisitorDevice, err error)

enrolling an existing key is retry-stable. revocation is permanent: signing in again cannot resurrect a stolen device key.

func (*Database) EnsureACMEAccount

func (d *Database) EnsureACMEAccount(
	ctx context.Context,
	directoryURL string,
	contactEmail string,
	now time.Time,
) (ACMEAccount, error)

func (*Database) EnsureIngressServicePorts

func (d *Database) EnsureIngressServicePorts(ctx context.Context, pool string, ranges []tcpport.Range) error

EnsureIngressServicePorts initializes a pool once. another control process cannot silently replace shared policy with a different startup configuration.

func (*Database) EnsurePrimaryIngressPool

func (d *Database) EnsurePrimaryIngressPool(ctx context.Context, ipv4, ipv6 string, now time.Time) (retErr error)

EnsurePrimaryIngressPool pins the public HTTP ingress address.

func (*Database) EnsureServiceIdentity

func (d *Database) EnsureServiceIdentity(ctx context.Context, managedDomain string, identity OIDCIdentity, now time.Time) (result IdentityContext, retErr error)

EnsureServiceIdentity resolves identity facts supplied by the configured OIDC provider's website. it never issues a control session or changes team roles.

func (*Database) ExchangePublisherAssertion

func (d *Database) ExchangePublisherAssertion(ctx context.Context, id, grant, audience, assertion, sourceIP string, now time.Time) (result PublisherAccess, retErr error)

func (*Database) ExchangeWorkload

func (d *Database) ExchangeWorkload(ctx context.Context, r ExchangeWorkloadRequest, now time.Time) (result WorkloadSession, retErr error)

exchange is called only after provider signature/issuer/audience verification. jobs cannot establish repository metadata or alter applied policy here.

func (*Database) ExpireDeviceLogins

func (d *Database) ExpireDeviceLogins(ctx context.Context, now time.Time) error

func (*Database) ExpireServiceRuns

func (d *Database) ExpireServiceRuns(ctx context.Context, now time.Time) (count int, retErr error)

every protocol uses the same expiration worker and relay reservation counters. a departed publisher must not hold placement indefinitely.

func (*Database) FinishInvitationEmail

func (d *Database) FinishInvitationEmail(ctx context.Context, delivery EmailDelivery, outcome EmailDeliveryOutcome, now time.Time) error

func (*Database) ForgetGuestPrivateState

func (d *Database) ForgetGuestPrivateState(ctx context.Context, now time.Time) (int, error)

ForgetGuestPrivateState removes rate-limit digests after one hour and guest credentials after the trial ends and all of its services are deleted.

func (*Database) GetDNSAuthority

func (d *Database) GetDNSAuthority(ctx context.Context, reference string) (DNSAuthority, error)

func (*Database) GetDNSChallengeChange

func (d *Database) GetDNSChallengeChange(ctx context.Context, zoneID, recordName string) (DNSChallengeChange, bool, error)

func (*Database) GetDNSChallengeContextForSubject

func (d *Database) GetDNSChallengeContextForSubject(ctx context.Context, subject CertificateSubject, authorizationID string) (DNSChallengeContext, error)

func (*Database) GetDeployment

func (d *Database) GetDeployment(ctx context.Context, scope DeploymentScope, selector string) (result Deployment, retErr error)

func (*Database) GetDeploymentPublication

func (d *Database) GetDeploymentPublication(ctx context.Context, scope DeploymentScope, selector, service string, now time.Time) (result ServiceRecord, retErr error)

func (*Database) GetDeploymentPublisher

func (d *Database) GetDeploymentPublisher(ctx context.Context, scope DeploymentScope, selector, publisher string) (result DeploymentPublisher, retErr error)

func (*Database) GetDeploymentPublisherAppAssignments

func (d *Database) GetDeploymentPublisherAppAssignments(ctx context.Context, token string, now time.Time) (DeploymentPublisherAssignments, error)

func (*Database) GetDeploymentPublisherAssignments

func (d *Database) GetDeploymentPublisherAssignments(ctx context.Context, token string, now time.Time) (DeploymentPublisherAssignments, error)

func (*Database) GetIngressPool

func (d *Database) GetIngressPool(ctx context.Context, id string) (IngressPool, error)

func (*Database) GetLocalProjectService

func (d *Database) GetLocalProjectService(ctx context.Context, r GetLocalProjectServiceRequest) (result LocalProjectService, retErr error)

visitor lookup reads the recorded ID, never saved names or declarations. the read-only snapshot keeps provenance, live access and safe metadata consistent.

func (*Database) GetPreview

func (d *Database) GetPreview(ctx context.Context, id string) (Preview, error)

func (*Database) GetProjectConfiguration

func (d *Database) GetProjectConfiguration(ctx context.Context, team, key, actor, deployment string) (result AppliedProjectConfiguration, retErr error)

func (*Database) GetProjectPublicMetadata

func (d *Database) GetProjectPublicMetadata(ctx context.Context, team, project, actor string, now time.Time) (result ProjectPublicMetadata, retErr error)

browser preparation receives only immutable public service IDs and hostnames. visitor permission never authorizes reading targets, trust, grants or config.

func (*Database) GetProjectService

func (d *Database) GetProjectService(ctx context.Context, r GetProjectServiceRequest) (result ServiceRecord, retErr error)

visitor lookup follows the applied resource binding, never a friendly name. reading the encrypted project document or its targets requires manager access.

func (*Database) GetProjectStatus

func (d *Database) GetProjectStatus(ctx context.Context, team, project, actor, cursor string, now time.Time) (result ProjectStatus, retErr error)

func (*Database) GetRelayDNSChallengeContext

func (d *Database) GetRelayDNSChallengeContext(ctx context.Context, orderID string) (RelayDNSChallengeContext, error)

func (*Database) GetRelayTransportCertificate

func (d *Database) GetRelayTransportCertificate(
	ctx context.Context,
	identity RelayLeaseIdentity,
	now time.Time,
) (RelayTransportCertificate, error)

GetRelayTransportCertificate returns decrypted material only while the exact requesting relay process lease is current.

func (*Database) GetService

func (d *Database) GetService(ctx context.Context, serviceID, actorID string) (result ServiceRecord, retErr error)

func (*Database) GetServiceByHostname

func (d *Database) GetServiceByHostname(ctx context.Context, team, hostname, actor string) (result ServiceRecord, retErr error)

func (*Database) GetServiceCertificateIssuance

func (d *Database) GetServiceCertificateIssuance(ctx context.Context, service, runID, token, issuance string, now time.Time) (result CertificateIssuance, retErr error)

func (*Database) GetServiceConfiguration

func (d *Database) GetServiceConfiguration(ctx context.Context, serviceID, actorID string) (_ *ProjectServiceConfiguration, _ string, retErr error)

func (*Database) GetServiceForPublisher

func (d *Database) GetServiceForPublisher(ctx context.Context, id string, publisher PublisherIdentity, now time.Time) (result ServiceRecord, retErr error)

func (*Database) GetShare

func (d *Database) GetShare(ctx context.Context, id string) (Share, error)

func (*Database) GetShareForManagement

func (d *Database) GetShareForManagement(ctx context.Context, id, identity string, now time.Time) (result Share, retErr error)

func (*Database) GetTeam

func (d *Database) GetTeam(ctx context.Context, identityID, teamID string) (Team, error)

func (*Database) GetTeamDomain

func (d *Database) GetTeamDomain(ctx context.Context, identityID, teamID, domainID string, now time.Time) (Domain, error)

GetTeamDomain includes final release history without making it selectable. membership, domain ownership, and all release facts share one query snapshot.

func (*Database) GetTeamFeedbackPolicy

func (d *Database) GetTeamFeedbackPolicy(ctx context.Context, identityID, teamID string) (TeamFeedbackPolicy, error)

func (*Database) GuestIssuanceAllowed

func (d *Database) GuestIssuanceAllowed(ctx context.Context, sourceIP netip.Addr, now time.Time) error

func (*Database) GuestSourceMatches

func (d *Database) GuestSourceMatches(guest GuestTrial, prefix string) (bool, error)

func (*Database) GuestTrialByAccessToken

func (d *Database) GuestTrialByAccessToken(ctx context.Context, token credentials.AccessToken) (GuestTrial, error)

func (*Database) Health

func (d *Database) Health(ctx context.Context) error

Health verifies that the database can serve a query through the runtime pool.

func (*Database) HeartbeatServiceRun

func (d *Database) HeartbeatServiceRun(ctx context.Context, serviceID, runID, token string, now time.Time, report ServiceRunHealth) (result ServiceRunState, retErr error)

func (*Database) IdentifyWorkload

func (d *Database) IdentifyWorkload(ctx context.Context, team, project, name, source string, c oidc.WorkloadExecution, now time.Time) (string, error)

IdentifyWorkload rechecks saved policy after provider verification. this is a cache-selection hint, never a visitor credential or permission to reuse a key.

func (*Database) IdentityContext

func (d *Database) IdentityContext(ctx context.Context, identityID string) (IdentityContext, error)

func (*Database) IngestIngressServiceObservations

func (d *Database) IngestIngressServiceObservations(ctx context.Context, lease IngressLeaseIdentity, batch serviceaudit.Batch, now time.Time) (result ServiceObservationResult, retErr error)

func (*Database) IngestServiceRunObservations

func (d *Database) IngestServiceRunObservations(ctx context.Context, serviceID, runID, token string, number int64, batch serviceaudit.Batch, now time.Time) (result ServiceObservationResult, retErr error)

IngestServiceRunObservations accepts facts from the owning publisher, not a connector or relay. connector identity and source come from control's installed pair; HTTP observations carry no actor identity. reports never renew authority.

func (*Database) Instrument

func (d *Database) Instrument(metrics *observability.Metrics)

Instrument sends completed state operations and request-pool queries to one process registry. configure it after Open and before serving requests.

func (*Database) InviteServiceVisitor

func (d *Database) InviteServiceVisitor(ctx context.Context, serviceID, actorID, key, email string, expires, now time.Time) (result ServiceInvitation, retErr error)

func (*Database) IssueBrowserHandoff

func (d *Database) IssueBrowserHandoff(ctx context.Context, attempt BrowserLoginAttempt, session BrowserAccessSession, now time.Time) (result BrowserHandoff, retErr error)

func (*Database) IssueControlBrowserHandoff

func (d *Database) IssueControlBrowserHandoff(ctx context.Context, access credentials.AccessToken, refresh credentials.RefreshToken, serviceID string, accessLifetime, refreshLifetime time.Duration, now time.Time) (handoff BrowserHandoff, retErr error)

func (*Database) IssuePublisherEnrollment

func (d *Database) IssuePublisherEnrollment(ctx context.Context, r CreatePublisherEnrollmentRequest) (result PublisherEnrollment, retErr error)

func (*Database) IssueServiceClientCertificate

func (d *Database) IssueServiceClientCertificate(ctx context.Context, service, identity, device string, csr []byte, now time.Time) (result ServiceClientCertificate, retErr error)

func (*Database) IssueVisitorClientCertificate

func (d *Database) IssueVisitorClientCertificate(ctx context.Context, issuerURL string, scope visitorscope.Scope, source VisitorTokenSource, csrDER []byte, now time.Time) (result ServiceClientCertificate, retErr error)

IssueVisitorClientCertificate checks the same current source as token preparation. devices carry fixed signed permission; workloads carry distinct fixed key identity and require current run-owned policy for every short permission. stored certificate rows support issuance and revocation, never stream admission.

func (*Database) IssueVisitorToken

func (d *Database) IssueVisitorToken(ctx context.Context, issuer string, scope visitorscope.Scope, source VisitorTokenSource, now time.Time, hostnames ...string) (result IssuedVisitorToken, retErr error)

IssueVisitorToken is the authority-facing preparation boundary. it reads one scoped permission model and current authentication facts, then records signing key retention in the same transaction. serving processes never call this while admitting a prepared visitor connection or request.

func (*Database) IssueWorkloadServiceClientCertificate

func (d *Database) IssueWorkloadServiceClientCertificate(ctx context.Context, credential, service string, csrDER []byte, now time.Time) (result ServiceClientCertificate, retErr error)

func (*Database) ListAdminRelayLeases

func (d *Database) ListAdminRelayLeases(ctx context.Context, cursor string, now time.Time) (AdminRelayPage, error)

ListAdminRelayLeases returns one page of current relay process leases.

func (*Database) ListAvailableServices

func (d *Database) ListAvailableServices(ctx context.Context, identityID, cursor string, path controlv1.ServiceAccessPath, now time.Time) (_ []ServiceInventory, _ string, retErr error)

func (*Database) ListCompanyAdmissions

func (d *Database) ListCompanyAdmissions(ctx context.Context, p ControlPrincipal, team, after string, now time.Time) (result CompanyAdmissionPage, retErr error)

func (*Database) ListConnectorPeerPairs

func (d *Database) ListConnectorPeerPairs(ctx context.Context, serviceID, runID, after, token string, now time.Time) (result ConnectorPeerPairCandidates, retErr error)

ListConnectorPeerPairs authenticates the exact run token and bounds each read. an installed owner's optional authority observation rechecks its original subject and parent independently of delivery. listing renews nothing and never discloses a subject, key, or application permission.

func (*Database) ListDeploymentPublishers

func (d *Database) ListDeploymentPublishers(ctx context.Context, scope DeploymentScope, selector, after string, limit int) (result []DeploymentPublisher, retErr error)

func (*Database) ListDeployments

func (d *Database) ListDeployments(ctx context.Context, scope DeploymentScope, after string, limit int) (result []Deployment, retErr error)

func (*Database) ListMaintenanceControls

func (d *Database) ListMaintenanceControls(ctx context.Context) ([]MaintenanceControl, error)

ListMaintenanceControls returns all maintenance controls in name order.

func (*Database) ListPreviews

func (d *Database) ListPreviews(ctx context.Context, team, actor, cursor string) (result PreviewPage, retErr error)

func (*Database) ListProjects

func (d *Database) ListProjects(ctx context.Context, team, actor, cursor string) (result ProjectPage, retErr error)

func (*Database) ListPublisherIdentities

func (d *Database) ListPublisherIdentities(ctx context.Context, team, after string) (PublisherIdentityPage, error)

func (*Database) ListServiceAudit

func (d *Database) ListServiceAudit(ctx context.Context, team, actor string, f ServiceAuditFilter, now time.Time) (page ServiceAuditPage, retErr error)

func (*Database) ListServiceGrants

func (d *Database) ListServiceGrants(ctx context.Context, serviceID, actorID, after string) (result []ServiceGrant, next string, retErr error)

func (*Database) ListServiceHTTPGrants

func (d *Database) ListServiceHTTPGrants(ctx context.Context, service, actor string, now time.Time) (result []controlv1.ServiceHTTPGrantSummary, retErr error)

func (*Database) ListServiceInvitations

func (d *Database) ListServiceInvitations(ctx context.Context, serviceID, actorID, after string) (result []ServiceInvitation, next string, retErr error)

func (*Database) ListServices

func (d *Database) ListServices(ctx context.Context, teamID, actorID, after string) (_ []ServiceRecord, _ string, retErr error)

func (*Database) ListShares

func (d *Database) ListShares(ctx context.Context, preview, cursor string) (SharePage, error)

func (*Database) ListTeamDomains

func (d *Database) ListTeamDomains(ctx context.Context, identityID, teamID string) ([]Domain, error)

func (*Database) ListTeamInvitations

func (d *Database) ListTeamInvitations(
	ctx context.Context,
	identityID, teamID string,
	now time.Time,
) (result []Invitation, retErr error)

func (*Database) ListTeamMemberships

func (d *Database) ListTeamMemberships(ctx context.Context, identityID, teamID string) ([]Membership, error)

func (*Database) ListTeamShares

func (d *Database) ListTeamShares(ctx context.Context, team, identity, cursor string) (result SharePage, retErr error)

func (*Database) ListTeams

func (d *Database) ListTeams(ctx context.Context, identityID string) ([]Team, error)

func (*Database) ListWorkloadServices

func (d *Database) ListWorkloadServices(ctx context.Context, credential string, now time.Time) (result []WorkloadService, retErr error)

func (*Database) MarkServiceCertificateInstalled

func (d *Database) MarkServiceCertificateInstalled(ctx context.Context, service, runID, token, issuance string, number int64, notAfter, now time.Time) (retErr error)

func (*Database) MarkSuppliedServiceCertificateInstalled

func (d *Database) MarkSuppliedServiceCertificateInstalled(ctx context.Context, service, runID, token string, number int64, chain, previous string, now time.Time) (controlv1.SuppliedServiceCertificateInstallation, error)

func (*Database) Metrics

func (d *Database) Metrics(now time.Time) DatabaseMetrics

Metrics returns one process-local database metrics snapshot.

func (*Database) ObserveServiceRecovery

func (d *Database) ObserveServiceRecovery(ctx context.Context, lease IngressLeaseIdentity, ref ServiceRunReference, visitor string, episodeID uint64, observedAt time.Time, sourceEvidence []byte, now time.Time) (result ServiceRecoveryObservation, retErr error)

ingress reports only a successful write to its visitor. native admission or original signed source evidence binds the reporter, run and visitor. check the lease at delivery time, never at the sender's earlier timestamp.

func (*Database) PinPublisherAliasWildcardZone

func (d *Database) PinPublisherAliasWildcardZone(ctx context.Context, work PublisherAliasWildcardWork, zone string, now time.Time) error

pin provider identity before any external write. never use a later process's configured zone as proof of the original zone's retirement.

func (*Database) PollDeviceLogin

func (d *Database) PollDeviceLogin(ctx context.Context, credential string, now time.Time) (DeviceLogin, error)

func (*Database) PoolStats

func (d *Database) PoolStats() *pgxpool.Stat

PoolStats returns an in-memory snapshot without acquiring a connection.

func (*Database) PrepareCompanyBrowser

func (d *Database) PrepareCompanyBrowser(ctx context.Context, team, issuer, client, redirect string, now time.Time) (*CompanyLoginIntent, error)

func (*Database) PrepareConnectorPeerPair

func (d *Database) PrepareConnectorPeerPair(ctx context.Context, r ConnectorPeerPairRequest, now time.Time) (result ConnectorPeerPair, retErr error)

PrepareConnectorPeerPair creates or retrieves one connector owner's delivery. its initial signed create key identifies the owner, independently of the enrolled subject. a signed replacement retains that owner's replay fence.

func (*Database) PrepareRelayCertificateOrder

func (d *Database) PrepareRelayCertificateOrder(
	ctx context.Context,
	accountID string,
	now time.Time,
	failedRetryInterval time.Duration,
) (created bool, retErr error)

PrepareRelayCertificateOrder schedules managed material at its persisted RenewAt.

func (*Database) PrepareServiceRun

func (d *Database) PrepareServiceRun(ctx context.Context, serviceID string, p PublisherIdentity, key string, now time.Time, request ServiceRunRequest) (result ServiceRunPreparation, retErr error)

func (*Database) PrepareVisitorSigningKeys

func (d *Database) PrepareVisitorSigningKeys(ctx context.Context, issuer string, now time.Time) (retErr error)

PrepareVisitorSigningKeys runs during control startup, before serving owners prepare policy views. anonymous traffic must not wait for a first token issue.

func (*Database) PreviewInvitation

func (d *Database) PreviewInvitation(ctx context.Context, identityID string, secret string, now time.Time) (InvitationPreview, error)

func (*Database) PreviewServiceInvitation

func (d *Database) PreviewServiceInvitation(ctx context.Context, actor, secret string, now time.Time) (result ServiceInvitationPreview, retErr error)

func (*Database) PrometheusMetrics

func (d *Database) PrometheusMetrics(now time.Time) observability.DatabaseSnapshot

PrometheusMetrics supplies the same passive database snapshot to runtime scrapes and local load tests. it never acquires a database connection.

func (*Database) PromotePublicServiceVisitor

func (d *Database) PromotePublicServiceVisitor(ctx context.Context, lease IngressLeaseIdentity, visitor string, now time.Time) error

func (*Database) ProvisionCompanyEligibility

func (d *Database) ProvisionCompanyEligibility(ctx context.Context, token string, r ProvisionCompanyEligibilityRequest, now time.Time) (retErr error)

ProvisionCompanyEligibility is a narrow delta, never an authoritative list. a source cannot assign roles, edit manual decisions, or revive a tombstone.

func (*Database) PublicServiceVisitorStatus

func (d *Database) PublicServiceVisitorStatus(ctx context.Context, lease IngressLeaseIdentity, visitor string, source netip.Addr, now time.Time) (result PublicServiceVisitorStatus, retErr error)

func (*Database) PublisherIdentityRecord

func (d *Database) PublisherIdentityRecord(ctx context.Context, team, id string) (PublisherRecord, error)

func (*Database) PublisherRuntime

func (d *Database) PublisherRuntime(ctx context.Context, r PublisherRuntimeRequest) (result PublisherRuntimeResponse, retErr error)

PublisherRuntime is the sole observation writer. enrollment, key verification, token exchange and preflight deployment leases never call it.

func (*Database) ReadCompanyConnections

func (d *Database) ReadCompanyConnections(ctx context.Context, p ControlPrincipal, team string, now time.Time) (result CompanyConnections, retErr error)

func (*Database) ReadDeviceBrowser

func (d *Database) ReadDeviceBrowser(ctx context.Context, code string, now time.Time) (DeviceLogin, error)

func (*Database) ReadIngressServicePorts

func (d *Database) ReadIngressServicePorts(ctx context.Context, pool string) (result []tcpport.Range, retErr error)

ReadIngressServicePorts returns durable allocation policy, not live capacity.

func (*Database) ReadIngressServices

func (d *Database) ReadIngressServices(ctx context.Context, identity IngressLeaseIdentity, now time.Time) (result IngressServices, retErr error)

ReadIngressServices reads current serving facts without locking publication rows or writing visitor records. ingress replaces its local view as one unit.

func (*Database) ReadPublisherVisitorPolicy

func (d *Database) ReadPublisherVisitorPolicy(ctx context.Context, scope visitorscope.Scope, run string, number int64, token string, after int64, now time.Time, hostnames ...string) (controlv1.VisitorPolicyUpdate, error)

func (*Database) Readiness

func (d *Database) Readiness(ctx context.Context) error

Readiness verifies runtime connectivity and schema compatibility. unlike Open, it is safe to call repeatedly from a readiness probe.

func (*Database) ReadyServicePublisherConnection

func (d *Database) ReadyServicePublisherConnection(ctx context.Context, connectionID, runID string, runNumber, revision int64, lease RelayLeaseIdentity, now time.Time) (result ServicePublisherConnection, retErr error)

func (*Database) RealizeLocalProjectService

func (d *Database) RealizeLocalProjectService(ctx context.Context, r RealizeLocalProjectServiceRequest) (result LocalProjectService, retErr error)

realization owns only this worktree's service. it neither evaluates nor applies remote declarations. service IDs are allocated here, never supplied or adopted.

func (*Database) RebindConnectorPeerPair

func (d *Database) RebindConnectorPeerPair(ctx context.Context, serviceID, pairID string, r ConnectorPeerPairRebindRequest, now time.Time) (result ConnectorPeerPairRebindState, retErr error)

func (*Database) RecentGuestTrialStats

func (d *Database) RecentGuestTrialStats(ctx context.Context, now time.Time) (GuestTrialStats, error)

RecentGuestTrialStats returns service-wide counts from committed trial rows.

func (*Database) RecoverCompanyOwner

func (d *Database) RecoverCompanyOwner(ctx context.Context, p ControlPrincipal, team, member string, now time.Time) (retErr error)

recovery grants a personal-account exception only to an existing owner. it never fabricates source eligibility or bypasses a removed membership.

func (*Database) RedeemDeploymentPublisherEnrollment

func (d *Database) RedeemDeploymentPublisherEnrollment(ctx context.Context, secret string, public ed25519.PublicKey, now time.Time) (DeploymentPublisherIdentity, error)

func (*Database) RedeemPublisherEnrollment

func (d *Database) RedeemPublisherEnrollment(ctx context.Context, secret string, public ed25519.PublicKey, now time.Time) (result PublisherIdentity, retErr error)

func (*Database) RedeemScopedDeploymentPublisherEnrollment

func (d *Database) RedeemScopedDeploymentPublisherEnrollment(ctx context.Context, secret string, public ed25519.PublicKey, deploymentID, projectKey string, now time.Time) (result DeploymentPublisherIdentity, retErr error)

func (*Database) RedeemServiceBrowserHandoff

func (d *Database) RedeemServiceBrowserHandoff(ctx context.Context, auth ServiceHTTPRun, ticket string, now time.Time) (result controlv1.BrowserHandoffResponse, retErr error)

func (*Database) RedeemShare

func (d *Database) RedeemShare(ctx context.Context, auth ServiceHTTPRun, shareID string, secret, handoff []byte, now time.Time) (result ShareRedemption, retErr error)

func (*Database) ReencryptStorageSecrets

func (d *Database) ReencryptStorageSecrets(ctx context.Context, limit int) (rotated int, retErr error)

ReencryptStorageSecrets claims and re-encrypts up to limit rows written with the previous storage key. row locks last through commit, so concurrent control processes skip work already claimed by another process.

func (*Database) RefreshControlSession

func (d *Database) RefreshControlSession(
	ctx context.Context,
	token credentials.RefreshToken,
	accessLifetime time.Duration,
	now time.Time,
) (result ControlSession, retErr error)

func (*Database) RefreshPortPoolMetrics

func (d *Database) RefreshPortPoolMetrics(ctx context.Context, metrics *observability.Metrics) (retErr error)

RefreshPortPoolMetrics reads committed inventory on a worker, never a scrape. held includes services; a quarantined port stays unavailable until control releases it, regardless of an observer's clock.

func (*Database) RefreshServiceBrowserSession

func (d *Database) RefreshServiceBrowserSession(ctx context.Context, service, secret string, now time.Time,
	refresh func(context.Context, string) (BrowserTokenRotation, error), hostnames ...string) (BrowserAccessSession, error)

the browser row serializes refresh without locking the parent session that the authority must rotate. contenders release their connection before retrying so they cannot exhaust the authority's pool. the row can stay locked during an authority network request, so busy-row retries have a longer, capped budget than local visitor preparation. service and expiry remain fixed.

func (*Database) RegisterDeploymentCredential

func (d *Database) RegisterDeploymentCredential(ctx context.Context, r RegisterDeploymentCredentialRequest) (result DeploymentCredential, retErr error)

registration is manager-only. control stores the public key, not a second bootstrap secret or signing engine. the original key recovers one fixed grant.

func (*Database) RegisterIngress

func (d *Database) RegisterIngress(
	ctx context.Context,
	registration IngressRegistration,
	now time.Time,
	leaseDuration time.Duration,
) (result IngressLease, retErr error)

RegisterIngress creates or renews one ingress process lease.

func (*Database) RegisterRelay

func (d *Database) RegisterRelay(
	ctx context.Context,
	registration RelayRegistration,
	now time.Time,
	leaseDuration time.Duration,
) (result RelayLease, retErr error)

RegisterRelay creates or renews one relay process lease. A different process run cannot replace an unexpired lease for the same relay identity.

func (*Database) ReleaseServiceEndpoint

func (d *Database) ReleaseServiceEndpoint(ctx context.Context, service, actor string, revision int64, port int, now time.Time) (result ServiceRecord, retErr error)

releasing capacity does not delete the service or its captured tls hostname. the caller must already have disabled exposure; exact binding checks prevent a delayed request from releasing a replacement reservation.

func (*Database) ReleaseServicePorts

func (d *Database) ReleaseServicePorts(ctx context.Context, now time.Time) (int64, error)

quarantine is bounded by real authority, not merely elapsed wall time. a late issuance or unfinished DNS cleanup keeps the old port reserved. the captured issuance revision excludes later connector renewals, even on the same run.

func (*Database) ReleaseTeamDomain

func (d *Database) ReleaseTeamDomain(
	ctx context.Context,
	identityID, teamID, domainID string,
	now time.Time,
) (retErr error)

func (*Database) RemoveMembership

func (d *Database) RemoveMembership(
	ctx context.Context,
	identityID, teamID, membershipID string,
	now time.Time,
) (retErr error)

func (*Database) RenameDeployment

func (d *Database) RenameDeployment(ctx context.Context, team, project, old, name, actor string, expected int64, now time.Time) (result AppliedProjectConfiguration, retErr error)

rename changes the desired selector, not the durable namespace or credentials. historical names remain bound to this ID so a stale deployment cannot enroll into an unrelated deployment merely because its old key was reused.

func (*Database) RenameDeploymentNamespace

func (d *Database) RenameDeploymentNamespace(ctx context.Context, r RenameDeploymentNamespaceRequest) (result AppliedProjectConfiguration, retErr error)

RenameDeploymentNamespace changes DNS and publication authority in one transaction. a retry returns the original encrypted response, even after a later mutation. selector rename is deliberately a separate operation.

func (*Database) RenewConnectorPeerPair

func (d *Database) RenewConnectorPeerPair(ctx context.Context, issuer string, r ConnectorPeerPairRequest, now time.Time) (ConnectorPeerPair, error)

RenewConnectorPeerPair rechecks current authority for an unexpired pair before extending its serving deadline. it never changes the delivery generation.

func (*Database) RenewIngress

func (d *Database) RenewIngress(
	ctx context.Context,
	renewal IngressRenewal,
	now time.Time,
	leaseDuration time.Duration,
) (result IngressLease, retErr error)

RenewIngress extends one exact, unexpired ingress lease.

func (*Database) RenewRelay

func (d *Database) RenewRelay(
	ctx context.Context,
	renewal RelayRenewal,
	now time.Time,
	leaseDuration time.Duration,
) (RelayLease, error)

RenewRelay extends one exact, unexpired relay lease.

func (*Database) RenewWorkloadSession

func (d *Database) RenewWorkloadSession(ctx context.Context, id, credential string, proof WorkloadRenewal, now time.Time) (r WorkloadSession, retErr error)

func (*Database) RequestCompanyAdmission

func (d *Database) RequestCompanyAdmission(ctx context.Context, p ControlPrincipal, team, connection string, revision int64, slug string, now time.Time) (result CompanyAdmissionRequest, retErr error)

func (*Database) ReserveOperatorNameservers

func (d *Database) ReserveOperatorNameservers(ctx context.Context, domain, setID string) (retErr error)

ReserveOperatorNameservers keeps infrastructure names out of customer domains and endpoint bindings, even after the operator changes the default.

func (*Database) ResolveCompanyAccount

func (d *Database) ResolveCompanyAccount(ctx context.Context, issuer, subject string) (string, error)

func (*Database) ResolveCompanyEligibilityAccount

func (d *Database) ResolveCompanyEligibilityAccount(ctx context.Context, issuer, subject string, eligible bool) (string, error)

negative eligibility may offboard a disabled identity, never reactivate it.

func (*Database) ResolveCompanyLoginIntent

func (d *Database) ResolveCompanyLoginIntent(ctx context.Context, id, binding string, now time.Time) (result CompanyLoginIntent, retErr error)

func (*Database) ResolveLoginTeam

func (d *Database) ResolveLoginTeam(ctx context.Context, name string) (string, error)

func (*Database) RetireConnectorPeerPair

func (d *Database) RetireConnectorPeerPair(ctx context.Context, serviceID, pairID string, r ConnectorPeerPairRetireRequest, now time.Time) (result ConnectorPeerPairRetirement, retErr error)

RetireConnectorPeerPair commits only an exact negative fact. snapshot signature and stable session MAC remain verifiable after parent or serving revocation.

func (*Database) RetireProject

func (d *Database) RetireProject(ctx context.Context, team, project, actor string, expected int64, now time.Time) (AppliedProjectConfiguration, error)

retirement is an empty apply plus an inventory marker in the same transaction. preserve the source binding and revision so stale writers cannot recreate it.

func (*Database) RevokeControlSession

func (d *Database) RevokeControlSession(ctx context.Context, principal ControlPrincipal, now time.Time) error

func (*Database) RevokeDeploymentPublisher

func (d *Database) RevokeDeploymentPublisher(ctx context.Context, scope DeploymentScope, selector, publisher string, now time.Time) (retErr error)

func (*Database) RevokeGuestShare

func (d *Database) RevokeGuestShare(ctx context.Context, credential GuestCredential, id string, now time.Time) (result Share, retErr error)

func (*Database) RevokePublisherGrant

func (d *Database) RevokePublisherGrant(ctx context.Context, team, id, grant, editor string, now time.Time) (retErr error)

func (*Database) RevokePublisherIdentity

func (d *Database) RevokePublisherIdentity(ctx context.Context, team, id, editor string, now time.Time) (retErr error)

func (*Database) RevokeServiceGrant

func (d *Database) RevokeServiceGrant(ctx context.Context, serviceID, actorID, grantID string, now time.Time) (retErr error)

func (*Database) RevokeServiceHTTPGrant

func (d *Database) RevokeServiceHTTPGrant(ctx context.Context, service, actor, id string, now time.Time) (retErr error)

func (*Database) RevokeServiceInvitation

func (d *Database) RevokeServiceInvitation(ctx context.Context, serviceID, actorID, invitationID string, now time.Time) (retErr error)

func (*Database) RevokeShare

func (d *Database) RevokeShare(ctx context.Context, id, identity string, now time.Time) (result Share, retErr error)

func (*Database) RevokeTeamInvitation

func (d *Database) RevokeTeamInvitation(
	ctx context.Context,
	identityID, teamID, invitationID string,
	now time.Time,
) (retErr error)

func (*Database) RevokeVisitorDevice

func (d *Database) RevokeVisitorDevice(ctx context.Context, identityID, deviceID string, now time.Time) (retErr error)

func (*Database) RevokeWorkloadSession

func (d *Database) RevokeWorkloadSession(ctx context.Context, id, credential string, now time.Time) (retErr error)

func (*Database) RotateCompanyProvisioningToken

func (d *Database) RotateCompanyProvisioningToken(ctx context.Context, p ControlPrincipal, team, id string, revision int64, now time.Time) (result IdentityConnectionSecret, retErr error)

func (*Database) RotatePublisherKey

func (d *Database) RotatePublisherKey(ctx context.Context, token, sourceIP, replacementID, audience string, public ed25519.PublicKey, proof, currentProof string, now time.Time) (retErr error)

func (*Database) RotateVisitorSigningKey

func (d *Database) RotateVisitorSigningKey(ctx context.Context, issuer string, emergency bool, now time.Time) (retErr error)

RotateVisitorSigningKey is a control-owned operation. emergency rotation drops every previous verification key; ordinary rotation retains unexpired tokens.

func (*Database) SaveACMEOrderWork

func (d *Database) SaveACMEOrderWork(
	ctx context.Context,
	work ACMEOrderWork,
	now time.Time,
) (result ACMEOrderWork, retErr error)

func (*Database) SaveDNSAuthorityWork

func (d *Database) SaveDNSAuthorityWork(
	ctx context.Context,
	work DNSAuthorityWork,
	now time.Time,
) (result DNSAuthorityWork, retErr error)

func (*Database) SaveDNSChallengeChange

func (d *Database) SaveDNSChallengeChange(ctx context.Context, zoneID, recordName string, desiredDigest [32]byte, changeID string, now time.Time) error

func (*Database) SavePublisherAliasWildcard

func (d *Database) SavePublisherAliasWildcard(ctx context.Context, work PublisherAliasWildcardWork, shadowed []string,
	observation PublisherAliasWildcardObservation, failures int64, now, next time.Time,
) (retErr error)

func (*Database) SaveRelayCertificateOrderWork

func (d *Database) SaveRelayCertificateOrderWork(
	ctx context.Context,
	work RelayCertificateOrderWork,
	now time.Time,
) (result RelayCertificateOrderWork, retErr error)

func (*Database) SaveServiceEndpointDNSWork

func (d *Database) SaveServiceEndpointDNSWork(ctx context.Context, work ServiceEndpointDNSWork, now time.Time) (ServiceEndpointDNSWork, error)

func (*Database) SeedHumanAuthentication

func (d *Database) SeedHumanAuthentication(ctx context.Context, domain string, seeds HumanAuthenticationSeeds, now time.Time) error

func (*Database) SelectDeploymentServiceRun

func (d *Database) SelectDeploymentServiceRun(ctx context.Context, team, project, deployment, service string, source VisitorTokenSource, now time.Time) (result ServiceSelection, retErr error)

resolve under current visitor authority, not management authority. the existing run selector checks the exact binding's subject again before returning a run.

func (*Database) SelectServiceRun

func (d *Database) SelectServiceRun(ctx context.Context, serviceID, identityID, deviceID string, now time.Time) (ServiceSelection, error)

func (*Database) SelectVisitorServiceRun

func (d *Database) SelectVisitorServiceRun(ctx context.Context, serviceID string, subject VisitorSubject, now time.Time) (result ServiceSelection, retErr error)

func (*Database) SelectWorkloadServiceRun

func (d *Database) SelectWorkloadServiceRun(ctx context.Context, credential, service string, now time.Time) (ServiceSelection, error)

selection authenticates only the workload credential, never a human session. the selected run still needs a signed, source-bound connector peer pair.

func (*Database) ServiceBrowserSession

func (d *Database) ServiceBrowserSession(ctx context.Context, auth ServiceHTTPRun, secret string, revoke bool, now time.Time) (result VisitorPermission, retErr error)

func (*Database) ServiceClientIssuer

func (d *Database) ServiceClientIssuer(ctx context.Context) (*controlvisitor.Issuer, error)

the seed is durable control-only state. losing an individual control process never changes the client issuer, and storage-key rotation preserves its key.

func (*Database) ServiceHTTPBrowserTeam

func (d *Database) ServiceHTTPBrowserTeam(ctx context.Context, subject visitorscope.Scope, now time.Time) (string, error)

func (*Database) SetCompanyInvitationException

func (d *Database) SetCompanyInvitationException(ctx context.Context, p ControlPrincipal, team, invitation string, exception bool, now time.Time) (retErr error)

func (*Database) SetMaintenanceControl

func (d *Database) SetMaintenanceControl(
	ctx context.Context,
	name MaintenanceControlName,
	allowed bool,
	actorIdentityID, requestID string,
	now time.Time,
) (result MaintenanceControl, retErr error)

SetMaintenanceControl updates one gate and records the administrator action in the same transaction.

func (*Database) SetMembershipRole

func (d *Database) SetMembershipRole(
	ctx context.Context,
	identityID, teamID, membershipID string,
	role TeamRole,
	now time.Time,
) (result Membership, retErr error)

func (*Database) SetPreviewTeamAccess

func (d *Database) SetPreviewTeamAccess(ctx context.Context, request SetPreviewTeamAccessRequest, now time.Time) (result Preview, retErr error)

func (*Database) SetServiceEnabled

func (d *Database) SetServiceEnabled(ctx context.Context, serviceID, actorID string, enabled bool, now time.Time) (result ServiceRecord, retErr error)

SetServiceEnabled changes operational availability, not the saved declaration. suspension closes runs without releasing endpoints, grants, or project ownership. enabling permits new runs and never revives a closed publication.

func (*Database) SetTeamDefaultDomain

func (d *Database) SetTeamDefaultDomain(
	ctx context.Context,
	identityID, teamID, domainID string,
	now time.Time,
) (result Team, retErr error)

func (*Database) SetTeamFeedbackPolicy

func (d *Database) SetTeamFeedbackPolicy(ctx context.Context, identityID, teamID, authors string, now time.Time) (result TeamFeedbackPolicy, retErr error)

func (*Database) StartServiceRun

func (d *Database) StartServiceRun(ctx context.Context, service, id string, number int64, publisher PublisherIdentity, now time.Time) (result ServiceRunState, retErr error)

publisher authentication authorizes the exact prepared run and captured endpoint. the service's WebPKI certificate authenticates connector visitor TLS.

func (*Database) StoreRelayTransportCertificate

func (d *Database) StoreRelayTransportCertificate(
	ctx context.Context,
	relayServiceID, tlsServerName string,
	certificatePEM, privateKeyPEM []byte,
	now time.Time,
) (RelayTransportCertificate, error)

StoreRelayTransportCertificate validates and encrypts a new relay transport certificate and private key before storing them in PostgreSQL.

func (*Database) TransferDomain

func (d *Database) TransferDomain(ctx context.Context, actor, domain, destination string, accept bool, now time.Time) (result DomainTransfer, retErr error)

TransferDomain moves verified DNS authority without moving service state or asking the DNS provider to release and recreate the zone.

func (*Database) UpdateACMEAccountRegistration

func (d *Database) UpdateACMEAccountRegistration(
	ctx context.Context,
	accountID string,
	contactEmail string,
	accountURL string,
	acceptedTermsURL string,
	now time.Time,
) (ACMEAccount, error)

func (*Database) UpdateCompanyMembershipDecision

func (d *Database) UpdateCompanyMembershipDecision(ctx context.Context, p ControlPrincipal, team, member string, decision CompanyMembershipDecision, now time.Time) (retErr error)

func (*Database) UpdateDeployment

func (d *Database) UpdateDeployment(ctx context.Context, r UpdateDeploymentRequest) (result Deployment, retErr error)

updates replace only addresses and target trust for selected saved bindings. omitted services, hostname ownership, access, and HTTP policy stay unchanged.

func (*Database) ValidateServiceEndpointDNSWork

func (d *Database) ValidateServiceEndpointDNSWork(ctx context.Context, work ServiceEndpointDNSWork, now time.Time) error

func (*Database) VerifyDeploymentIdentity

func (d *Database) VerifyDeploymentIdentity(ctx context.Context, id, deployment, assertion, audience string, now time.Time) (result DeploymentPublisherVerification, retErr error)

verification consumes a one-use proof but never rotates the active lease.

func (*Database) VerifyDeviceBrowser

func (d *Database) VerifyDeviceBrowser(ctx context.Context, code string, binding []byte, identity OIDCIdentity, now time.Time) error

func (*Database) WithDNSRecordLock

func (d *Database) WithDNSRecordLock(ctx context.Context, recordName string, run func() error) (retErr error)

WithDNSRecordLock serializes the stored snapshot and DNS update for one record name across control processes. the dedicated transaction rolls back after the callback returns, releasing its lock; connection loss releases it too. the callback can still read through the pooled runtime connections.

func (*Database) WorkloadAssertionPolicy

func (d *Database) WorkloadAssertionPolicy(ctx context.Context, id, credential string) (ProjectWorkload, error)

WorkloadAssertionPolicy authenticates the exact session before verifying a rotating assertion. attachment separately fences revocation and expired leases.

func (*Database) WorkloadPolicy

func (d *Database) WorkloadPolicy(ctx context.Context, team, project, name, source string) (_ ProjectWorkload, retErr error)

policy lookup returns only the selected trust policy; JWT input cannot choose endpoints.

type DatabaseConnectionCounts

type DatabaseConnectionCounts struct {
	Open       int64 `json:"open"`
	Connecting int64 `json:"connecting"`
	Opened     int64 `json:"opened_total"`
	Closed     int64 `json:"closed_total"`
	Failed     int64 `json:"connect_failures_total"`
}

counts describe this process's client sockets, not PostgreSQL backend slots. only fixed purpose labels and counters are retained, never connection details.

type DatabaseDiagnostics

type DatabaseDiagnostics struct {
	CapturedAt          time.Time                           `json:"captured_at"`
	Sessions            []DatabaseSession                   `json:"sessions"`
	Truncated           bool                                `json:"truncated"`
	ActiveOperations    []DatabaseOperation                 `json:"active_operations"`
	OperationsTruncated bool                                `json:"operations_truncated"`
	Connections         map[string]DatabaseConnectionCounts `json:"connections,omitempty"`
	Pooler              *DatabasePoolerDiagnostics          `json:"pooler,omitempty"`
	Error               string                              `json:"error,omitempty"`
}

DatabaseDiagnostics contains bounded, parameter-free PostgreSQL activity.

type DatabaseMetrics

type DatabaseMetrics struct {
	Pool              *pgxpool.Stat
	ActiveOperations  []DatabaseOperation
	OperationsOmitted int
	Connections       map[string]DatabaseConnectionCounts
}

DatabaseMetrics contains process-local state that is safe to collect on every metrics scrape. it never acquires a database connection.

type DatabaseOperation

type DatabaseOperation struct {
	Operation      string  `json:"operation"`
	ElapsedSeconds float64 `json:"elapsed_seconds"`
}

type DatabasePoolerClients

type DatabasePoolerClients struct {
	Total     int  `json:"total"`
	Active    int  `json:"active"`
	Waiting   int  `json:"waiting"`
	Other     int  `json:"other"`
	Truncated bool `json:"truncated"`
}

type DatabasePoolerDiagnostics

type DatabasePoolerDiagnostics struct {
	Settings map[string]string      `json:"settings,omitempty"`
	Clients  *DatabasePoolerClients `json:"clients,omitempty"`
	Error    string                 `json:"error,omitempty"`
}

PgBouncer may deny its admin console to the runtime user. unavailable values remain absent and carry a sanitized error; they are never inferred from SKU.

type DatabaseSession

type DatabaseSession struct {
	PID                   int32    `json:"pid"`
	Operation             string   `json:"operation,omitempty"`
	State                 string   `json:"state"`
	WaitType              string   `json:"wait_type"`
	WaitEvent             string   `json:"wait_event"`
	TransactionAgeSeconds *float64 `json:"transaction_age_seconds"`
	QueryAgeSeconds       *float64 `json:"query_age_seconds"`
	QueryID               *int64   `json:"query_id,omitempty"`
	BlockingPIDs          []int32  `json:"blocking_pids"`
	BlockingPIDsTruncated bool     `json:"blocking_pids_truncated"`
}

type Deployment

type Deployment struct {
	ID         string                            `json:"id"`
	TeamID     string                            `json:"team_id"`
	ProjectKey string                            `json:"project_key"`
	Name       string                            `json:"name"`
	Revision   int64                             `json:"revision"`
	Targets    map[string]DeploymentTargetStatus `json:"targets"`
	Services   map[string]DeploymentService      `json:"services"`
}

type DeploymentCredential

type DeploymentCredential struct {
	ClientID       string                          `json:"client_id"`
	KeyID          string                          `json:"key_id"`
	GrantID        string                          `json:"grant_id"`
	TeamID         string                          `json:"team_id"`
	ProjectKey     string                          `json:"project_key"`
	Permissions    DeploymentCredentialPermissions `json:"permissions"`
	DeploymentIDs  []string                        `json:"deployment_ids"`
	AllDeployments bool                            `json:"all_deployments"`
	ExpiresAt      time.Time                       `json:"expires_at"`
}

type DeploymentCredentialPermissions

type DeploymentCredentialPermissions struct {
	Manage  map[string]string          `json:"manage,omitempty"`
	Connect map[string]string          `json:"connect,omitempty"`
	Publish *DeploymentPublishApproval `json:"publish,omitempty"`
}

type DeploymentPublishApproval

type DeploymentPublishApproval struct {
	Services  map[string]string `json:"services,omitempty"`
	Temporary string            `json:"temporary,omitempty"`
}

type DeploymentPublisher

type DeploymentPublisher struct {
	DeploymentPublisherStatus
	Services  map[string]string `json:"services"`
	RevokedAt *time.Time        `json:"revoked_at,omitempty"`
}

type DeploymentPublisherAssignments

type DeploymentPublisherAssignments struct {
	Member                DeploymentPublisherIdentity            `json:"member"`
	Revision              int64                                  `json:"revision,string"`
	ConfigurationHash     string                                 `json:"configuration_hash"`
	Services              []DeploymentPublisherServiceAssignment `json:"services"`
	CertificateStatePlans []CertificatePlan                      `json:"certificate_state_plans"`
}

type DeploymentPublisherEnrollment

type DeploymentPublisherEnrollment struct {
	Key          string            `json:"enrollment_key"`
	DeploymentID string            `json:"deployment_id"`
	ExpiresAt    time.Time         `json:"expires_at"`
	MaxMembers   int               `json:"max_members"`
	ID           string            `json:"enrollment_id"`
	Services     map[string]string `json:"services"`
}

type DeploymentPublisherIdentity

type DeploymentPublisherIdentity struct {
	TeamID              string `json:"team_id"`
	ProjectKey          string `json:"project_key"`
	DeploymentID        string `json:"deployment_id"`
	DeploymentName      string `json:"deployment_name"`
	PublisherIdentityID string `json:"publisher_identity_id"`
	KeyID               string `json:"key_id"`
}

type DeploymentPublisherLease

type DeploymentPublisherLease struct {
	AccessToken string    `json:"access_token"`
	ExpiresAt   time.Time `json:"expires_at"`
}

type DeploymentPublisherServiceAssignment

type DeploymentPublisherServiceAssignment struct {
	Service       string                      `json:"service"`
	ServiceID     string                      `json:"service_id"`
	GrantID       string                      `json:"grant_id"`
	TrustRevision int64                       `json:"trust_revision,string"`
	Configuration ProjectServiceConfiguration `json:"configuration"`
}

type DeploymentPublisherStatus

type DeploymentPublisherStatus struct {
	DeploymentPublisherIdentity
	Runtime          *PublisherRuntimeStatus `json:"runtime,omitempty"`
	ObservedRevision int64                   `json:"observed_revision,string"`
	CurrentRevision  int64                   `json:"current_revision,string"`
	SnapshotAt       time.Time               `json:"snapshot_at"`
	AcknowledgedAt   *time.Time              `json:"acknowledged_at,omitempty"`
	Healthy          bool                    `json:"healthy"`
	LeaseExpiresAt   *time.Time              `json:"lease_expires_at,omitempty"`
}

type DeploymentPublisherVerification

type DeploymentPublisherVerification struct {
	Member          DeploymentPublisherIdentity `json:"member"`
	DeploymentNames []string                    `json:"deployment_names"`
}

type DeploymentScope

type DeploymentScope struct {
	TeamID, ProjectKey, ActorID string
	AccessToken                 string `json:"-"`
}

type DeploymentService

type DeploymentService struct {
	ID            string           `json:"id"`
	Protocol      string           `json:"protocol"`
	TrustRevision int64            `json:"trust_revision"`
	Endpoint      *ServiceEndpoint `json:"endpoint,omitempty"`
	PublicURL     string           `json:"public_url,omitempty"`
}

type DeploymentSettings

type DeploymentSettings struct {
	Description string `json:"description,omitempty"`
	DomainID    string `json:"domain_id,omitempty"`
}

type DeploymentTarget

type DeploymentTarget struct {
	Address string               `json:"address"`
	TLS     *DeploymentTargetTLS `json:"tls,omitempty"`
}

type DeploymentTargetStatus

type DeploymentTargetStatus struct {
	App       bool                    `json:"app,omitempty"`
	Address   string                  `json:"address,omitempty"`
	TLS       *DeploymentTargetTLS    `json:"tls,omitempty"`
	Discovery *ProjectTargetDiscovery `json:"discovery,omitempty"`
}

reads preserve publisher-side discovery for deployments declared by apply; runtime writes still accept only the narrower explicit-address input above.

type DeploymentTargetTLS

type DeploymentTargetTLS struct {
	CA       string `json:"ca,omitempty"`
	Hostname string `json:"hostname,omitempty"`
}

type DeviceLogin

type DeviceLogin struct {
	TeamID, PreviousSessionID, ExpectedIdentityID string
	CompanyIntent                                 *CompanyLoginIntent
	UserCode                                      string
	ExpiresAt                                     time.Time
	Status                                        DeviceLoginStatus
	State, Nonce, Verifier                        string
	Binding                                       []byte
	Identity                                      *OIDCIdentity
	Session                                       *ControlSession
}

type DeviceLoginOptions

type DeviceLoginOptions struct{ Team, RefreshToken string }

type DeviceLoginStatus

type DeviceLoginStatus string
const (
	DevicePending   DeviceLoginStatus = "pending"
	DeviceApproved  DeviceLoginStatus = "approved"
	DeviceCancelled DeviceLoginStatus = "cancelled"
	DeviceDenied    DeviceLoginStatus = "denied"
)

type DeviceTokenSource

type DeviceTokenSource struct{ DeviceID string }

type Domain

type Domain struct {
	ID                    string
	Kind                  DomainKind
	TeamID                string
	CanonicalDomain       string
	DNSAuthorityReference string
	State                 DomainState
	AuthorityRevision     int64
	RequiredRecords       []DNSRecord
	ClaimStage            string
	ClaimExpiresAt        time.Time
	DelegationTarget      string
	CreatedAt             time.Time
	VerifiedAt            time.Time
	UpdatedAt             time.Time
	Release               *DomainRelease
}

type DomainKind

type DomainKind string

DomainKind distinguishes managed and custom team domains.

const (
	DomainKindManaged DomainKind = "managed"
	DomainKindCustom  DomainKind = "custom"
)

type DomainRelease

type DomainRelease struct {
	ObservedAt           time.Time
	Blockers             []string
	CertificateExpiresAt *time.Time
	CompletionUnknown    bool
	ReleasedAt           *time.Time
}

DomainRelease is an owner observation, never a release completion estimate.

type DomainState

type DomainState string

DomainState is the stored state of a team domain, including released domains. the team-domain query excludes released domains from public responses.

const (
	DomainPending   DomainState = "pending"
	DomainReady     DomainState = "ready"
	DomainReleasing DomainState = "releasing"
	DomainReleased  DomainState = "released"
	DomainFailed    DomainState = "failed"
)

type DomainTransfer

type DomainTransfer struct {
	State, Domain, Source, Destination string
	Blockers                           []string
	ExpiresAt                          *time.Time
}

type EmailDelivery

type EmailDelivery struct {
	ID       string
	Owner    string
	Attempts int64
	Payload  authorityv1.EmailDeliveryRequest
}

type EmailDeliveryOutcome

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

func InvitationEmailOutcome

func InvitationEmailOutcome(status int) EmailDeliveryOutcome

InvitationEmailOutcome treats only the mailer's accepted or permanently rejected responses as complete. transport failures use status 0 and retry.

type ExchangeWorkloadRequest

type ExchangeWorkloadRequest struct {
	TeamID, ProjectKey, Workload, SourceFingerprint, Nonce string
	Execution                                              oidc.WorkloadExecution
	PublicKey                                              ed25519.PublicKey
	Signature                                              []byte
	Services                                               []string
}

type FeedbackActor

type FeedbackActor struct {
	SourceIP                      string
	ServiceRun                    *ServiceHTTPRun
	Kind, IdentityID, DisplayName string
	BrowserCookieSecret           []byte
	TeamMember                    bool
	ShareID                       string
	CookieSecret, ShareSecret     []byte
	VisitAllowed                  bool
	VisitProof                    FeedbackVisitProof
}

type FeedbackBearerVisitProof

type FeedbackBearerVisitProof struct{ Token visitortoken.Token }

func (FeedbackBearerVisitProof) GoString

func (FeedbackBearerVisitProof) GoString() string

func (FeedbackBearerVisitProof) String

type FeedbackConnectorVisitProof

type FeedbackConnectorVisitProof struct {
	PairID             string
	DeliveryGeneration int64
	PermissionToken    visitortoken.Token
}

func (FeedbackConnectorVisitProof) GoString

func (FeedbackConnectorVisitProof) String

type FeedbackVisitProof

type FeedbackVisitProof interface {
	// contains filtered or unexported methods
}

FeedbackVisitProof is publisher-supplied evidence of the selected admission. the API contract owns its wire shape; browser request bodies cannot supply it.

type GetLocalProjectServiceRequest

type GetLocalProjectServiceRequest struct {
	TeamID, ProjectKey, SourceFingerprint, Service, WorktreeKey, ActorID string
	Now                                                                  time.Time
}

type GetProjectServiceRequest

type GetProjectServiceRequest struct {
	TeamID, ProjectKey, SourceFingerprint, Deployment, Service, IdentityID string
	Now                                                                    time.Time
}

type GrantTokenSource

type GrantTokenSource struct{ Credential string }

func (GrantTokenSource) GoString

func (GrantTokenSource) GoString() string

func (GrantTokenSource) String

func (GrantTokenSource) String() string

type GuestCredential

type GuestCredential struct {
	Token    credentials.AccessToken
	SourceIP netip.Addr
}

GuestCredential contains the trial bearer and the server-observed request peer. it is not a publisher grant, share, control session, or caller identity.

type GuestTrial

type GuestTrial struct {
	ID                    string
	NamespaceLabel        string
	DomainID              string
	IngressPoolID         string
	DNSAuthorityReference string
	SourceIPDigest        string
	SourceIPKeyID         string
	ExpiresAt             time.Time
	UsedReady             time.Duration
	ReadyDeadline         time.Time
	ServingUntil          time.Time
	LastDemoNumber        int64
}

type GuestTrialStats

type GuestTrialStats struct {
	Issued     int64
	Allocated  int64
	Ready      int64
	Expired    int64
	ReadyLimit int64
}

type HumanAuthenticationSeeds

type HumanAuthenticationSeeds struct {
	Issuer             string
	Administrators     []string
	TeamOwners         map[string]string
	DefaultTeam        string
	DefaultTeamMembers []string
}

HumanAuthenticationSeeds are explicit identities at one exact configured issuer. each privilege seed is applied once, never reconciled on restart.

type Identity

type Identity struct {
	ID              string
	DisplayName     string
	NormalizedEmail string
	EmailVerified   bool
	Administrator   bool
	CreatedAt       time.Time
}

type IdentityConnection

type IdentityConnection struct {
	ID        string `json:"identity_connection_id"`
	TeamID    string `json:"team_id"`
	Issuer    string `json:"issuer"`
	Admission string `json:"admission"`
	State     string `json:"state"`
	Revision  int64  `json:"revision,string"`
	SourceID  string `json:"source_id"`
}

type IdentityConnectionSecret

type IdentityConnectionSecret struct {
	IdentityConnection
	ProvisioningToken string `json:"provisioning_token"`
}

type IdentityConnectionSetup

type IdentityConnectionSetup struct {
	IdentityConnection
	SetupToken string    `json:"setup_token"`
	ExpiresAt  time.Time `json:"expires_at"`
}

type IdentityContext

type IdentityContext struct {
	Identity       Identity
	PersonalTeamID string
	DefaultTeamID  string
	Memberships    []Membership
}

type IngressLease

type IngressLease struct {
	IngressLeaseIdentity
	Region              region.ID
	ProtocolVersion     uint64
	ConnectionCapacity  uint64
	ReportedConnections uint64
	Draining            bool
	DrainDeadline       *time.Time
	RegisteredAt        time.Time
	RenewedAt           time.Time
	LeaseExpiresAt      time.Time
	ServingUntil        time.Time
}

IngressLease is the control-issued lease for one ingress process.

type IngressLeaseIdentity

type IngressLeaseIdentity struct {
	IngressID            string
	IngressRunID         string
	IngressLeaseRevision uint64
}

IngressLeaseIdentity identifies one exact ingress process lease.

type IngressPool

type IngressPool struct {
	ID          string
	IPv4Address netip.Addr
	IPv6Address netip.Addr
	State       IngressPoolState
}

IngressPool identifies one public ingress address group shared by ingress processes.

type IngressPoolState

type IngressPoolState string
const (
	IngressPoolDisabled IngressPoolState = "disabled"
	IngressPoolEnabled  IngressPoolState = "enabled"
	IngressPoolDraining IngressPoolState = "draining"
)

type IngressRegistration

type IngressRegistration struct {
	Region             region.ID
	IngressID          string
	IngressRunID       string
	ProtocolVersion    uint64
	ConnectionCapacity uint64
	IngressPoolID      string
	HTTPS              bool
	ServicePortRanges  []tcpport.Range
}

IngressRegistration describes one ingress process run.

type IngressRenewal

type IngressRenewal struct {
	IngressLeaseIdentity
	ReportedConnections uint64
}

IngressRenewal reports the current connection load for one process lease.

type IngressServiceRun

type IngressServiceRun struct {
	ServiceID, RunID, Protocol, Hostname string
	RunHostname                          *string
	AliasDNSUntil                        *time.Time
	RunNumber, EndpointRevision          int64
	Port                                 int
	ValidUntil                           time.Time
	Anonymous                            bool
	IP                                   *controlv1.VisitorPolicyIP
	Traffic                              trafficlimits.Limits
	Relays                               []ServiceRelay
	SourceAuthority                      []byte
	SourceKey                            []byte
	RecoveryEpisodeID                    *int64
}

IngressServiceRun contains the facts ingress needs before a visitor arrives. source authority proves the original socket addresses, not visitor permission.

type IngressServices

type IngressServices struct {
	ObservedAt time.Time
	ValidUntil time.Time
	Runs       []IngressServiceRun
}

type Invitation

type Invitation struct {
	PersonalAccountException   bool
	ID                         string
	TeamID                     string
	MemberSlug                 string
	InitialRole                TeamRole
	NormalizedEmailRestriction string
	State                      InvitationState
	CreatedAt                  time.Time
	ExpiresAt                  time.Time
}

type InvitationPreview

type InvitationPreview struct {
	TeamDisplayName string
	InitialRole     TeamRole
	ExpiresAt       time.Time
}

type InvitationSecret

type InvitationSecret struct {
	Invitation Invitation
	Secret     string
}

type InvitationState

type InvitationState string

InvitationState is the stored state of a team invitation.

const (
	InvitationPending  InvitationState = "pending"
	InvitationAccepted InvitationState = "accepted"
	InvitationRevoked  InvitationState = "revoked"
	InvitationExpired  InvitationState = "expired"
)

type IssuedCertificate

type IssuedCertificate struct {
	PEM                          []byte
	NotBefore, NotAfter, RenewAt time.Time
}

type IssuedVisitorToken

type IssuedVisitorToken struct {
	Token                visitortoken.Token
	Permission           visitortoken.Permission
	ServiceTrustRevision int64
}

type LocalProjectService

type LocalProjectService struct {
	Service     string           `json:"service"`
	WorktreeKey string           `json:"worktree_key"`
	ServiceID   string           `json:"service_id"`
	Hostname    string           `json:"hostname,omitempty"`
	Metadata    *ServiceMetadata `json:"metadata,omitempty"`
}

type LocalServiceSource

type LocalServiceSource struct {
	ProjectKey        string `json:"project_key"`
	SourceFingerprint string `json:"source_fingerprint"`
	Service           string `json:"service"`
	WorktreeKey       string `json:"worktree_key"`
}

type MaintenanceControl

type MaintenanceControl struct {
	Name      MaintenanceControlName
	Allowed   bool
	Revision  uint64
	UpdatedAt time.Time
	UpdatedBy string
}

MaintenanceControl is one stored gate for starting new work.

type MaintenanceControlName

type MaintenanceControlName string
const (
	MaintenanceControlServiceCreation     MaintenanceControlName = "service_creation"
	MaintenanceControlServiceRunCreation  MaintenanceControlName = "service_run_creation"
	MaintenanceControlCertificateIssuance MaintenanceControlName = "certificate_issuance"
)

type Membership

type Membership struct {
	TeamManagedLabel         string
	IdentityConnectionID     string
	ManualSuspendedAt        time.Time
	PersonalAccountException bool
	CompanySignInRequired    bool
	Active                   bool
	ID                       string
	TeamID                   string
	IdentityID               string
	TeamDisplayName          string
	TeamKind                 TeamKind
	Role                     TeamRole
	MemberSlug               string
	ManagedLabel             string
	PolicyRevision           int64
	CreatedAt                time.Time
	UpdatedAt                time.Time
}

type NamespaceScope

type NamespaceScope string

NamespaceScope identifies whether a publisher namespace belongs to one membership or a team.

const (
	NamespaceScopeMember NamespaceScope = "member"
	NamespaceScopeShared NamespaceScope = "shared"
)

type NewGuestTrial

type NewGuestTrial struct {
	GuestTrial
	Token        credentials.AccessToken
	CredentialID credentials.CredentialID
	Hash         credentials.SecretHash
	SourceIP     netip.Addr
}

func NewGuestTrialCredential

func NewGuestTrialCredential(sourceIP netip.Addr) (NewGuestTrial, error)

type OIDCIdentity

type OIDCIdentity struct {
	Issuer                 string
	Subject                string
	DisplayName            string
	NormalizedEmail        string
	EmailVerified          bool
	AssertionDigest        [32]byte
	AssertionID            string
	AssertionExpiry        time.Time
	TeamContexts           []oidc.TeamContext
	Nonce                  string
	ClientID               string
	IssuedAt               time.Time
	CompanyIntent          *CompanyIntentBinding
	AuthenticatedAt        time.Time
	TenantID, HostedDomain string
	Groups                 []string
}

OIDCIdentity contains the limited identity and assertion fields verified from an ID token.

type PoolConfig

type PoolConfig struct {
	URL                       string
	DisablePreparedStatements bool
}

func (PoolConfig) Open

func (p PoolConfig) Open(ctx context.Context, currentStorageKey, previousStorageKey string, mode naming.ManagedURLMode) (*Database, error)

Open connects to already-migrated control state. it never creates or migrates schema objects.

type Preview

type Preview struct {
	SchemaVersion       int
	ID                  string
	TeamID              string
	GuestID             string
	CreatedByIdentityID string
	ServiceIDs          []string
	TeamAccessEnabled   bool
	CreatedAt           time.Time
}

type PreviewPage

type PreviewPage struct {
	Previews   []PreviewSummary `json:"previews"`
	NextCursor string           `json:"next_cursor,omitempty"`
}

type PreviewSummary

type PreviewSummary struct {
	ID        string    `json:"id"`
	TeamID    string    `json:"team_id"`
	CreatedAt time.Time `json:"created_at"`
}

type ProjectApplicationRate

type ProjectApplicationRate struct {
	Count int    `json:"count"`
	Per   string `json:"per"`
	Burst *int   `json:"burst,omitempty"`
}

type ProjectConfiguration

type ProjectConfiguration struct {
	Workloads map[string]ProjectWorkload `json:"workloads,omitempty"`
	// local selection omits settings; saved deployments supply them, even when empty.
	Settings *DeploymentSettings                    `json:"settings,omitempty"`
	Services map[string]ProjectServiceConfiguration `json:"services"`
	OAuth    bool                                   `json:"oauth"`
	Webhooks map[string]ProjectWebhook              `json:"webhooks"`
}

func NormalizeProjectConfiguration

func NormalizeProjectConfiguration(input ProjectConfiguration) (ProjectConfiguration, string, error)

normalize a declarative value only. server code never evaluates project files.

type ProjectHTTPApplicationLimits

type ProjectHTTPApplicationLimits struct {
	Total       *int                    `json:"total,omitempty"`
	Concurrency *int                    `json:"concurrency,omitempty"`
	Rate        *ProjectApplicationRate `json:"rate,omitempty"`
}

type ProjectPage

type ProjectPage struct {
	Projects   []ProjectSummary `json:"projects"`
	NextCursor string           `json:"next_cursor,omitempty"`
}

type ProjectPublicMetadata

type ProjectPublicMetadata struct {
	SourceFingerprint string                 `json:"source_fingerprint"`
	Services          []ProjectPublicService `json:"services"`
}

type ProjectPublicService

type ProjectPublicService struct {
	Service   string `json:"service"`
	ServiceID string `json:"service_id"`
	Port      int    `json:"port"`
	Hostname  string `json:"hostname"`
}

type ProjectPublicationStatus

type ProjectPublicationStatus struct {
	Service                   string     `json:"service"`
	Deployment                string     `json:"deployment"`
	Kind                      string     `json:"service_kind"`
	WorktreeKey               string     `json:"worktree_key,omitempty"`
	ServiceID                 string     `json:"service_id,omitempty"`
	Hostname                  string     `json:"hostname"`
	Port                      int        `json:"port,omitempty"`
	ServiceRunID              string     `json:"service_run_id,omitempty"`
	RunNumber                 int64      `json:"run_number,omitempty,string"`
	PublicationState          string     `json:"publication_state,omitempty"`
	PublisherExpiresAt        *time.Time `json:"publisher_expires_at,omitempty"`
	CertificateExpiresAt      *time.Time `json:"certificate_expires_at,omitempty"`
	ReadyPublisherConnections int        `json:"ready_publisher_connections"`
	Ready                     bool       `json:"ready"`
	Reason                    string     `json:"reason"`
}

type ProjectServiceAccess

type ProjectServiceAccess struct {
	Team bool `json:"team"`
}

type ProjectServiceConfiguration

type ProjectServiceConfiguration struct {
	TargetDiscovery    *ProjectTargetDiscovery  `json:"target_discovery,omitempty"`
	Name               string                   `json:"name,omitempty"`
	Protocol           string                   `json:"protocol,omitempty"`
	Target             string                   `json:"target"`
	Hostname           string                   `json:"hostname,omitempty"`
	RunAliasParent     string                   `json:"publisher_alias_parent,omitempty"`
	CertificateScope   string                   `json:"certificate_scope,omitempty"`
	DomainID           string                   `json:"domain_id,omitempty"`
	Ephemeral          bool                     `json:"ephemeral,omitempty"`
	RequirePostQuantum *bool                    `json:"require_post_quantum,omitempty"`
	Traffic            *trafficlimits.Selection `json:"traffic,omitempty"`
	Public             *bool                    `json:"public,omitempty"`
	TargetTLS          *ProjectTargetTLS        `json:"target_tls,omitempty"`
	Access             *ProjectServiceAccess    `json:"access,omitempty"`
	HTTP               *config.HTTPService      `json:"http,omitempty"`
}

type ProjectStatus

type ProjectStatus struct {
	RetiredAt    *time.Time                 `json:"retired_at,omitempty"`
	TeamID       string                     `json:"team_id"`
	ProjectKey   string                     `json:"project_key"`
	ProjectLabel string                     `json:"project_label"`
	Revision     int64                      `json:"revision,string"`
	ObservedAt   time.Time                  `json:"observed_at"`
	Publications []ProjectPublicationStatus `json:"publications"`
	NextCursor   string                     `json:"next_cursor,omitempty"`
}

type ProjectSummary

type ProjectSummary struct {
	TeamID       string    `json:"team_id"`
	ProjectKey   string    `json:"project_key"`
	ProjectLabel string    `json:"project_label"`
	Revision     int64     `json:"revision,string"`
	UpdatedAt    time.Time `json:"updated_at"`
}

type ProjectTargetDiscovery

type ProjectTargetDiscovery struct {
	Type     string  `json:"type"`
	Region   string  `json:"region"`
	Cluster  *string `json:"cluster,omitempty"`
	Instance *string `json:"instance,omitempty"`
	Endpoint *string `json:"endpoint,omitempty"`
}

ProjectTargetDiscovery is handed unchanged to the assigned publisher. no resolved address, provider credential, application credential or local CA path is supplied by apply. protocol verification and target trust belong to discovery.

func (*ProjectTargetDiscovery) Normalize

func (t *ProjectTargetDiscovery) Normalize(protocol string) (*ProjectTargetDiscovery, error)

Normalize returns a fresh descriptor with explicit defaults. validation never changes a stored descriptor or a caller's source configuration.

func (*ProjectTargetDiscovery) Validate

func (t *ProjectTargetDiscovery) Validate(protocol string) error

type ProjectTargetTLS

type ProjectTargetTLS struct {
	Hostname           string `json:"hostname"`
	CAPEM              string `json:"ca_pem,omitempty"`
	Digest             string `json:"digest"`
	HostnameFromTarget bool   `json:"hostname_from_target,omitempty"`
}

type ProjectWebhook

type ProjectWebhook struct {
	Service   string   `json:"service"`
	Path      string   `json:"path"`
	Provider  string   `json:"provider"`
	Delivery  string   `json:"delivery,omitempty"`
	Methods   []string `json:"methods,omitempty"`
	SourceIPs []string `json:"source_ips,omitempty"`
}

type ProjectWorkload

type ProjectWorkload struct {
	Deployment         string                     `json:"deployment,omitempty"`
	Provider           string                     `json:"provider"`
	Trust              oidc.WorkloadTrust         `json:"trust"`
	GitHub             *ProjectWorkloadGitHub     `json:"github,omitempty"`
	Google             *ProjectWorkloadGoogle     `json:"google,omitempty"`
	Kubernetes         *ProjectWorkloadKubernetes `json:"kubernetes,omitempty"`
	GitLab             *ProjectWorkloadGitLab     `json:"gitlab,omitempty"`
	Services           []string                   `json:"services"`
	MaxDurationSeconds int                        `json:"max_duration_seconds"`
}

type ProjectWorkloadGitHub

type ProjectWorkloadGitHub struct {
	Repository        string   `json:"repository"`
	RepositoryID      string   `json:"repository_id"`
	RepositoryOwnerID string   `json:"repository_owner_id"`
	DefaultBranch     string   `json:"default_branch,omitempty"`
	WorkflowRef       string   `json:"workflow_ref"`
	Ref               string   `json:"ref"`
	Events            []string `json:"events"`
	Environment       string   `json:"environment,omitempty"`
	JobWorkflowRef    string   `json:"job_workflow_ref,omitempty"`
}

type ProjectWorkloadGitLab

type ProjectWorkloadGitLab = controlv1.ProjectWorkloadGitLab

type ProjectWorkloadGoogle

type ProjectWorkloadGoogle = controlv1.ProjectWorkloadGoogle

type ProjectWorkloadKubernetes

type ProjectWorkloadKubernetes = controlv1.ProjectWorkloadKubernetes

type ProvisionCompanyEligibilityRequest

type ProvisionCompanyEligibilityRequest struct {
	TeamID               string    `json:"team_id"`
	IdentityConnectionID string    `json:"identity_connection_id"`
	ConnectionRevision   int64     `json:"connection_revision,string"`
	IdentityID           string    `json:"identity_id"`
	Subject              string    `json:"subject"`
	Revision             int64     `json:"revision,string"`
	Eligible             bool      `json:"eligible"`
	ValidUntil           time.Time `json:"valid_until"`
	MemberSlug           string    `json:"member_slug"`
}

type PublicServiceVisitorAdmission

type PublicServiceVisitorAdmission struct {
	ServiceID, RunID, ConnectionID string
	RunNumber                      int64
	ExpiresAt                      time.Time
	Relays                         []ServiceRelay
	Traffic                        trafficlimits.Limits
	RecoveryEpisodeID              *int64
}

type PublicServiceVisitorState

type PublicServiceVisitorState string
const (
	PublicServiceVisitorPending       PublicServiceVisitorState = "pending"
	PublicServiceVisitorAuthenticated PublicServiceVisitorState = "authenticated"
	PublicServiceVisitorAllowed       PublicServiceVisitorState = "allowed"
	PublicServiceVisitorDenied        PublicServiceVisitorState = "denied"
)

type PublicServiceVisitorStatus

type PublicServiceVisitorStatus struct {
	State      PublicServiceVisitorState
	ValidUntil time.Time
}

PublicServiceVisitorStatus distinguishes TLS setup from an authenticated application stream. pending never extends its original admission deadline.

type PublisherAccess

type PublisherAccess struct {
	PublisherIdentity
	Token string
	Until time.Time
}

type PublisherAliasWildcardObservation

type PublisherAliasWildcardObservation uint8
const (
	PublisherAliasWildcardInconclusive PublisherAliasWildcardObservation = iota
	PublisherAliasWildcardWithdrawn
	PublisherAliasWildcardVerified
	PublisherAliasWildcardRemoved
)

type PublisherAliasWildcardWork

type PublisherAliasWildcardWork struct {
	Parent, TeamID, DomainID, PoolID, ZoneID, Domain, AuthorityReference string
	IPv4, IPv6                                                           *netip.Addr
	Worker                                                               string
	Epoch, ConsecutiveErrors                                             int64
	Removing, PoolUsable                                                 bool
}

type PublisherConnectionState

type PublisherConnectionState string

PublisherConnectionState is the stored state of one connection slot.

const (
	PublisherConnectionAssigned  PublisherConnectionState = "assigned"
	PublisherConnectionConnected PublisherConnectionState = "connected"
	PublisherConnectionReady     PublisherConnectionState = "ready"
	PublisherConnectionDraining  PublisherConnectionState = "draining"
	PublisherConnectionClosed    PublisherConnectionState = "closed"
	PublisherConnectionExpired   PublisherConnectionState = "expired"
)

type PublisherEnrollment

type PublisherEnrollment struct {
	ID, Key   string
	Scope     PublisherScope
	Until     time.Time
	Protocols []string
}

type PublisherIdentity

type PublisherIdentity struct {
	ID, KeyID, GrantID, CreatorID, Kind, GuestID string
	Ownership, OwnerMembershipID                 string
	Scope                                        PublisherScope
	ExpiresAt                                    *time.Time
}

type PublisherIdentityPage

type PublisherIdentityPage struct {
	Identities []PublisherRecord
	NextCursor string
}

type PublisherRuntimeRequest

type PublisherRuntimeRequest struct {
	PublisherIdentityID string
	ScopeID             string
	ProcessRunID        string
	Action              string
	Assertion           string
	Audience            string
	SourceIP            string
	ExpectedEpoch       int64
	Now                 time.Time
	Deployment          *controlv1.PublisherDeploymentReport
}

type PublisherRuntimeResponse

type PublisherRuntimeResponse struct {
	Epoch           int64                     `json:"epoch,string"`
	LeaseExpiresAt  *time.Time                `json:"lease_expires_at,omitempty"`
	DeploymentLease *DeploymentPublisherLease `json:"deployment_lease,omitempty"`
}

type PublisherRuntimeStatus

type PublisherRuntimeStatus struct {
	PublisherIdentityID string                                    `json:"publisher_identity_id"`
	TeamID              string                                    `json:"team_id"`
	ProcessRunID        string                                    `json:"process_run_id"`
	Epoch               int64                                     `json:"epoch,string"`
	Evidence            string                                    `json:"evidence"`
	AddressFamily       string                                    `json:"address_family"`
	StartedAt           time.Time                                 `json:"started_at"`
	ObservedAt          time.Time                                 `json:"observed_at"`
	LastSeenAt          time.Time                                 `json:"last_seen_at"`
	LeaseExpiresAt      time.Time                                 `json:"lease_expires_at"`
	StoppedAt           *time.Time                                `json:"stopped_at,omitempty"`
	Active              bool                                      `json:"active"`
	Deployment          *controlv1.PublisherDeploymentObservation `json:"deployment,omitempty"`
}

type PublisherScope

type PublisherScope struct {
	TeamID, GuestID, Kind, ServiceID, DomainID, Namespace, MembershipID string
	NamespaceScope                                                      NamespaceScope
}

type RealizeLocalProjectServiceRequest

type RealizeLocalProjectServiceRequest struct {
	TeamID, ProjectKey, SourceFingerprint, Service, WorktreeKey, ActorID string
	WorktreeLabel                                                        string
	PreviewPublisher                                                     string
	DNSAutomation                                                        bool
	Configuration                                                        ProjectServiceConfiguration
	Now                                                                  time.Time
}

type RegisterDeploymentCredentialRequest

type RegisterDeploymentCredentialRequest struct {
	DeploymentScope
	Name, IdempotencyKey string
	PublicKey            ed25519.PublicKey
	Permissions          map[string][]string
	TemporaryPublication string
	DeploymentIDs        []string
	AllDeployments       bool
	Lifetime             time.Duration
	Now                  time.Time
}

type RegisteredKeyTokenSource

type RegisteredKeyTokenSource struct{ Credential string }

func (RegisteredKeyTokenSource) GoString

func (RegisteredKeyTokenSource) GoString() string

func (RegisteredKeyTokenSource) String

type RelayCertificateOrderState

type RelayCertificateOrderState string

RelayCertificateOrderState is the persisted stage of relay transport certificate issuance. cleaning precedes installation; failed_cleaning preserves cleanup after failure.

const (
	RelayCertificatePending         RelayCertificateOrderState = "pending"
	RelayCertificateAuthorizing     RelayCertificateOrderState = "authorizing"
	RelayCertificatePresenting      RelayCertificateOrderState = "presenting"
	RelayCertificatePresented       RelayCertificateOrderState = "presented"
	RelayCertificateValidating      RelayCertificateOrderState = "validating"
	RelayCertificateReadyToFinalize RelayCertificateOrderState = "ready_to_finalize"
	RelayCertificateFinalizing      RelayCertificateOrderState = "finalizing"
	RelayCertificateCleaning        RelayCertificateOrderState = "cleaning"
	RelayCertificateFailedCleaning  RelayCertificateOrderState = "failed_cleaning"
	RelayCertificateComplete        RelayCertificateOrderState = "complete"
	RelayCertificateFailed          RelayCertificateOrderState = "failed"
)

type RelayCertificateOrderWork

type RelayCertificateOrderWork struct {
	ID                     string
	Account                ACMEAccount
	RelayServiceID         string
	TLSServerName          string
	PrivateKeyPEM          []byte
	CSRDER                 []byte
	CSRDigest              [32]byte
	State                  RelayCertificateOrderState
	OrderRevision          uint64
	OrderURL               string
	FinalizeURL            string
	CertificateURL         string
	AuthorizationURL       string
	AuthorizationExpiresAt *time.Time
	ChallengeURL           string
	ChallengeToken         string
	ChallengeDigest        [32]byte
	PresentationReference  string
	CertificatePEM         []byte
	NotBefore              *time.Time
	NotAfter               *time.Time
	RenewAt                *time.Time
	Attempts               uint64
	AvailableAt            time.Time
	LastError              string
	CreatedAt              time.Time
	UpdatedAt              time.Time
	WorkerID               string
	WorkEpoch              uint64
	WorkExpiresAt          time.Time
}

func (RelayCertificateOrderWork) Challenge

func (RelayCertificateOrderWork) Finalization

func (work RelayCertificateOrderWork) Finalization() (ACMEFinalization, error)

func (RelayCertificateOrderWork) IssuedCertificate

func (work RelayCertificateOrderWork) IssuedCertificate() (IssuedCertificate, error)

func (*RelayCertificateOrderWork) RecordIssuedCertificate

func (work *RelayCertificateOrderWork) RecordIssuedCertificate(pem []byte, now time.Time) error

RecordIssuedCertificate schedules cleanup before installation. reused authorizations have no challenge to clean and can complete immediately.

type RelayDNSChallengeContext

type RelayDNSChallengeContext struct {
	OrderID               string
	RelayServiceID        string
	TLSServerName         string
	State                 RelayCertificateOrderState
	ChallengeDigest       [32]byte
	PresentationReference string
	Presentations         []DNSChallengePresentation
}

type RelayLease

type RelayLease struct {
	RelayLeaseIdentity
	Region               region.ID
	PeerSigningPublicKey []byte
	ProtocolVersion      uint64
	RelayAddress         string
	TLSServerName        string
	InternalRelayAddress string
	ObservedAddress      *netip.Addr
	InternalNetworks     []netip.Prefix
	ConnectionCapacity   uint64
	StreamCapacity       uint64
	ReportedConnections  uint64
	ReportedStreams      uint64
	Draining             bool
	DrainDeadline        *time.Time
	RegisteredAt         time.Time
	RenewedAt            time.Time
	LeaseExpiresAt       time.Time
	ServingUntil         time.Time
}

RelayLease is the control-issued lease for one relay process.

type RelayLeaseIdentity

type RelayLeaseIdentity struct {
	RelayServiceID     string
	RelayID            string
	RelayRunID         string
	RelayLeaseRevision uint64
}

RelayLeaseIdentity identifies one exact relay process lease.

type RelayRegistration

type RelayRegistration struct {
	Region               region.ID
	PeerSigningPublicKey []byte
	RelayServiceID       string
	RelayID              string
	RelayRunID           string
	ProtocolVersion      uint64
	RelayAddress         string
	TLSServerName        string
	InternalRelayAddress string
	InternalNetworks     []netip.Prefix
	ConnectionCapacity   uint64
	StreamCapacity       uint64
}

RelayRegistration describes one relay process and its relay service.

type RelayRenewal

type RelayRenewal struct {
	RelayLeaseIdentity
	ReportedConnections uint64
	ReportedStreams     uint64
}

RelayRenewal reports the relay process's current load.

type RelayTransportCertificate

type RelayTransportCertificate struct {
	RelayServiceID string
	TLSServerName  string
	CertificatePEM string
	PrivateKeyPEM  string
	Serial         string
	NotAfter       time.Time
}

RelayTransportCertificate contains a relay transport certificate and private key. it is returned only to a relay process with a current lease for the matching relay service.

type RenameDeploymentNamespaceRequest

type RenameDeploymentNamespaceRequest struct {
	TeamID, ProjectKey, Deployment, NamespaceLabel, ActorID, IdempotencyKey string
	ExpectedRevision                                                        int64
	DNSAutomation                                                           bool
	Now                                                                     time.Time
}

type RollbackFailure

type RollbackFailure struct {
	OperationErr error
	RollbackErr  error
}

RollbackFailure retains the operation result separately from its cleanup. a rollback timeout is not evidence that the operation itself timed out.

func (*RollbackFailure) Error

func (e *RollbackFailure) Error() string

func (*RollbackFailure) Unwrap

func (e *RollbackFailure) Unwrap() []error

type ServiceAuditFilter

type ServiceAuditFilter struct {
	ServiceID string
	Service   string
	After     string
	Since     *time.Time
	Limit     int
}

type ServiceAuditPage

type ServiceAuditPage struct {
	Events     []serviceaudit.Event `json:"events"`
	NextCursor string               `json:"next_cursor,omitempty"`
}

type ServiceClientCertificate

type ServiceClientCertificate struct {
	ServiceID      string    `json:"service_id"`
	CertificatePEM string    `json:"certificate_pem"`
	IssuerPEM      string    `json:"issuer_pem"`
	ExpiresAt      time.Time `json:"expires_at"`
}

type ServiceDeleteConditions

type ServiceDeleteConditions struct {
	Revision      int64
	Unconditional bool
}

service deletion conditions describe the manager's observed settings, not publisher, guest, run-token, or authoritative project cleanup permission.

func (ServiceDeleteConditions) Validate

func (c ServiceDeleteConditions) Validate() error

type ServiceEndpoint

type ServiceEndpoint struct {
	Hostname string `json:"hostname"`
	// HTTP uses shared 443; zero means a non-HTTP service has no reservation.
	// neither value selects a local connector listener or enables public access.
	Port   int  `json:"port"`
	Public bool `json:"public"`
}

type ServiceEndpointDNSState

type ServiceEndpointDNSState string

ServiceEndpointDNSState is the stored state of a service endpoint's DNS.

const (
	ServiceEndpointDNSUnmanaged ServiceEndpointDNSState = "unmanaged"
	ServiceEndpointDNSPending   ServiceEndpointDNSState = "pending"
	ServiceEndpointDNSPublished ServiceEndpointDNSState = "published"
	ServiceEndpointDNSRemoving  ServiceEndpointDNSState = "removing"
	ServiceEndpointDNSRemoved   ServiceEndpointDNSState = "removed"
	ServiceEndpointDNSFailed    ServiceEndpointDNSState = "failed"
)

type ServiceEndpointDNSWork

type ServiceEndpointDNSWork struct {
	Hostname, ServiceID, OwnerID, DomainID, PoolID, AuthorityReference string
	Public                                                             bool
	State                                                              ServiceEndpointDNSState
	Revision, Epoch, Attempts, ConsecutiveErrors                       int64
	Worker                                                             string
	ExpiresAt, AvailableAt                                             time.Time
	LastError                                                          string
}

type ServiceGrant

type ServiceGrant struct {
	ID, ServiceID, Kind, IdentityID, InvitationID string
	CreatedAt                                     time.Time
	ExpiresAt, RevokedAt                          *time.Time
}

type ServiceHTTPRun

type ServiceHTTPRun struct {
	Subject  visitorscope.Scope
	RunID    string
	Number   int64
	Token    credentials.ServiceRunToken
	Hostname string
}

ServiceHTTPRun carries an exact service/run credential. browser/share scopes cannot be interpreted as publisher permission.

type ServiceHostnameError

type ServiceHostnameError struct {
	Namespace string
}

ServiceHostnameError contains only the current actor's default namespace on a ready authorized domain. it never describes the rejected hostname's owner.

func (*ServiceHostnameError) Error

func (e *ServiceHostnameError) Error() string

func (*ServiceHostnameError) Unwrap

func (e *ServiceHostnameError) Unwrap() error

type ServiceInventory

type ServiceInventory struct {
	ServiceMetadata
	KubernetesAuth                                          *controlv1.KubernetesAuth
	ID, TeamID, TeamName, Name, ServiceRunID, VisitorAccess string
	RunNumber                                               int64
	CreatedAt                                               time.Time
	RequirePostQuantum                                      bool
}

type ServiceInvitation

type ServiceInvitation struct {
	ID, ServiceID, Email, Secret string
	ExpiresAt                    time.Time
	AcceptedAt, RevokedAt        *time.Time
}

type ServiceInvitationPreview

type ServiceInvitationPreview struct {
	ServiceID string    `json:"service_id"`
	TeamID    string    `json:"team_id"`
	Name      string    `json:"name"`
	Protocol  string    `json:"protocol"`
	ExpiresAt time.Time `json:"expires_at"`
}

type ServiceMetadata

type ServiceMetadata struct {
	Protocol      string            `json:"protocol"`
	TLS           *ServiceTargetTLS `json:"target_tls,omitempty"`
	PublisherPool bool              `json:"publisher_pool"`
	TrustRevision int64             `json:"trust_revision,string"`
	Endpoint      *ServiceEndpoint  `json:"endpoint,omitempty"`
}

func (ServiceMetadata) Validate

func (m ServiceMetadata) Validate() error

type ServiceObservationResult

type ServiceObservationResult struct {
	Accepted   int `json:"accepted"`
	Duplicates int `json:"duplicates"`
}

type ServicePlacement

type ServicePlacement struct {
	DomainID         string `json:"domain_id,omitempty"`
	Hostname         string `json:"hostname,omitempty"`
	WorktreeKey      string `json:"worktree_key,omitempty"`
	WorktreeLabel    string `json:"worktree_label,omitempty"`
	PreviewPublisher string `json:"preview_publisher_id,omitempty"`
	UseSavedAddress  bool   `json:"use_saved_address,omitempty"`
	DNSAutomation    bool   `json:"-"`
	SourceKey        string `json:"-"`
	RunAliasParent   string `json:"-"`
	CertificateScope string `json:"-"`
	Reserve          bool   `json:"-"`
}

ServicePlacement selects a ready team domain and a source-bound local worktree. control captures the resulting identity once; defaults never rename it.

func (ServicePlacement) Validate

func (p ServicePlacement) Validate() error

type ServicePublisherConnection

type ServicePublisherConnection struct {
	ServiceID, RunID, ConnectionID, RelayServiceID string
	RunNumber, Revision                            int64
}

type ServiceRecord

type ServiceRecord struct {
	ServiceMetadata
	ID, TeamID, GuestID, DomainID, Name string
	EndpointRevision                    int64
	ServiceRevision                     int64
	Placement                           *ServicePlacement   `json:"placement,omitempty"`
	Source                              *LocalServiceSource `json:"source,omitempty"`
	HTTPLimits                          *ProjectHTTPApplicationLimits
	HTTPRequestBodyIdleTimeout          *string
	Enabled                             bool
	Ephemeral, RequirePostQuantum       bool
	ExpiresAt                           *time.Time
	CreatedAt                           time.Time
	Recovered                           bool `json:"-"`
}

type ServiceRecoveryObservation

type ServiceRecoveryObservation struct {
	ServiceRunReference
	RecoveryEpisodeID uint64
	OpenedAt          time.Time
	ObservedAt        time.Time
	ObservedSeconds   float64
}

type ServiceRelay

type ServiceRelay struct {
	TLSServerName                string    `json:"tls_server_name"`
	PublisherConnectionID        string    `json:"publisher_connection_id"`
	ConnectionSlot               int16     `json:"connection_slot"`
	RelayServiceID               string    `json:"relay_service_id"`
	RelayID                      string    `json:"relay_id"`
	RelayRunID                   string    `json:"relay_run_id"`
	InternalRelayAddress         string    `json:"internal_relay_address"`
	RelayLeaseRevision           int64     `json:"relay_lease_revision,string"`
	ConnectionAssignmentRevision int64     `json:"connection_assignment_revision,string"`
	LeaseExpiresAt               time.Time `json:"lease_expires_at"`
	ServingUntil                 time.Time `json:"serving_until"`
}

type ServiceRunAssignment

type ServiceRunAssignment struct {
	PublisherConnectionID, RelayServiceID, RelayAddress, TLSServerName, Credential, State string
	ConnectionSlot                                                                        int16
	Revision                                                                              int64
	CredentialExpiresAt                                                                   time.Time
}

type ServiceRunCursor

type ServiceRunCursor struct {
	Start, After ServiceRunReference
}

ServiceRunCursor bounds native continuation to one circular pass. references describe traversal, not authority; every admission still checks current state.

func (ServiceRunCursor) Valid

func (c ServiceRunCursor) Valid() bool

type ServiceRunHealth

type ServiceRunHealth struct {
	Healthy                       bool
	StreamCapacity, ActiveStreams int32
}

type ServiceRunPreparation

type ServiceRunPreparation struct {
	ServiceID, TeamID, GuestID, RunID, PublisherIdentityID, PublisherGrantID, PublisherKeyID, IdempotencyKey string
	Token                                                                                                    string
	RunNumber                                                                                                int64
	ExpiresAt                                                                                                time.Time
	CertificatePlan                                                                                          CertificatePlan
	Hostname, DomainID                                                                                       string
	RunHostname                                                                                              string
	Traffic                                                                                                  trafficlimits.Limits
	RequirePostQuantum                                                                                       bool
}

type ServiceRunReference

type ServiceRunReference struct {
	ServiceID, RunID string
	RunNumber        int64
}

type ServiceRunRequest

type ServiceRunRequest struct {
	Metadata                        ServiceMetadata
	PreferredRegions                []string
	TrafficSelection                *trafficlimits.Selection
	TrafficDefaults, TrafficCeiling trafficlimits.Limits
}

ServiceRunRequest separates run-local selections from saved target trust.

type ServiceRunState

type ServiceRunState struct {
	PolicyConfirmation              *controlv1.PublisherPolicyConfirmation
	AliasPolicyConfirmation         *controlv1.PublisherPolicyConfirmation
	ServiceID, RunID, Token, State  string
	RunNumber                       int64
	EndpointRevision                int64
	PublicEndpointReady             bool
	RunHostname                     string
	RunAliasReady                   bool
	ExpiresAt                       time.Time
	ObservedAt, ServingUntil        time.Time
	RenewAfter                      time.Duration
	Connections                     []ServiceRunAssignment
	VisitorSourceKey                [32]byte
	Healthy                         bool
	StreamCapacity, ReportedStreams int32
}

type ServiceSelection

type ServiceSelection struct {
	Subject        VisitorSubject
	KubernetesAuth *controlv1.KubernetesAuth
	ServiceMetadata
	ServiceID, ServiceRunID, IdentityID, DeviceID string
	RunNumber                                     int64
	ExpiresAt                                     time.Time
	PairReady                                     *ConnectorPeerPairReady
}

type ServiceTargetTLS

type ServiceTargetTLS struct {
	Hostname string `json:"hostname"`
	System   bool   `json:"system"`
	PEM      string `json:"pem,omitempty"`
	Digest   string `json:"digest"`
}

private metadata contains public trust material only, never a target address, target credential, local path, remote bundle URL, or publisher private key.

type ServiceUpdateConditions

type ServiceUpdateConditions struct {
	ConfigurationDigest        string
	UnconditionalConfiguration bool
	PublisherPool              *bool
}

update conditions describe observed state, independently of desired settings.

func (ServiceUpdateConditions) ValidateConfiguration

func (c ServiceUpdateConditions) ValidateConfiguration(replacement bool) error

configuration replacements require exactly one observed digest or an explicit unconditional choice. metadata-only updates do not replace configuration.

type ServiceVisitorValidity

type ServiceVisitorValidity struct {
	Allowed    bool
	Admitted   bool
	ValidUntil time.Time
}

type SetPreviewTeamAccessRequest

type SetPreviewTeamAccessRequest struct {
	PreviewID, TeamID, IdentityID string
	Enabled                       bool
}

type Share

type Share struct {
	SchemaVersion                                int
	ID, PreviewID, TeamID, GuestID, Scope, Label string
	ServiceIDs                                   []string
	EntryServiceID, CreatedByIdentityID          string
	EntryHostname                                string
	CreatedAt, ExpiresAt                         time.Time
	RevokedAt                                    *time.Time
}

type SharePage

type SharePage struct {
	Shares     []Share
	NextCursor string
}

type ShareRedemption

type ShareRedemption struct {
	ShareID, CookieSecret string
	ExpiresAt             time.Time
	NextURL               string
	Bridge                bool
}

type ShareSessionTokenSource

type ShareSessionTokenSource struct{ ShareID, Secret, RunID string }

func (ShareSessionTokenSource) GoString

func (ShareSessionTokenSource) GoString() string

func (ShareSessionTokenSource) String

type ShareTokenSource

type ShareTokenSource struct{ ShareID, Secret string }

func (ShareTokenSource) GoString

func (ShareTokenSource) GoString() string

func (ShareTokenSource) String

func (ShareTokenSource) String() string

type Team

type Team struct {
	ID              string
	Kind            TeamKind
	DisplayName     string
	ManagedLabel    string
	DefaultDomainID string
	PolicyRevision  int64
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

type TeamFeedbackPolicy

type TeamFeedbackPolicy struct {
	Authors string `json:"authors"`
}

type TeamKind

type TeamKind string

TeamKind distinguishes personal and organization teams.

const (
	TeamKindPersonal     TeamKind = "personal"
	TeamKindOrganization TeamKind = "organization"
)

type TeamRole

type TeamRole string

TeamRole is a membership's authorization role.

const (
	TeamRoleMember TeamRole = "member"
	TeamRoleAdmin  TeamRole = "admin"
	TeamRoleOwner  TeamRole = "owner"
)

type UpdateDeploymentRequest

type UpdateDeploymentRequest struct {
	DeploymentScope
	Selector         string
	ExpectedRevision int64
	Targets          map[string]DeploymentTarget
	Now              time.Time
}

type VisitorAccessMode

type VisitorAccessMode string

VisitorAccessMode selects whether tnl requires a visitor credential.

const (
	VisitorAccessRestricted VisitorAccessMode = "restricted"
	VisitorAccessAnonymous  VisitorAccessMode = "anonymous"
)

func (VisitorAccessMode) Valid

func (mode VisitorAccessMode) Valid() bool

type VisitorDevice

type VisitorDevice struct {
	ID         string     `json:"id"`
	IdentityID string     `json:"identity_id"`
	PublicKey  string     `json:"public_key"`
	CreatedAt  time.Time  `json:"created_at"`
	RevokedAt  *time.Time `json:"revoked_at,omitempty"`
}

type VisitorPermission

type VisitorPermission struct {
	Authenticated bool
	IdentityID    string
	DisplayName   string
	TeamMember    bool
	VisitAllowed  bool
	Reason        string
	ExpiresAt     *time.Time
}

VisitorPermission is a current decision, not a reusable authorization token.

type VisitorSubject

type VisitorSubject = tunnelv1.VisitorSubject

type VisitorTokenSource

type VisitorTokenSource interface {
	// contains filtered or unexported methods
}

VisitorTokenSource is closed: supplied credentials select exactly one source. authentication and current parent facts are checked before anonymous policy.

type WorkloadGitHubExecution

type WorkloadGitHubExecution struct {
	RepositoryID      string `json:"repository_id"`
	RepositoryOwnerID string `json:"repository_owner_id"`
	RunID             string `json:"run_id"`
	RunAttempt        string `json:"run_attempt"`
	CheckRunID        string `json:"check_run_id"`
}

type WorkloadRenewal

type WorkloadRenewal struct {
	Sequence  int64
	Signature []byte
}

type WorkloadService

type WorkloadService struct {
	ID             string                    `json:"id"`
	Service        string                    `json:"service"`
	Protocol       string                    `json:"protocol"`
	Endpoint       *ServiceEndpoint          `json:"endpoint"`
	KubernetesAuth *controlv1.KubernetesAuth `json:"kubernetes_auth,omitempty"`
}

type WorkloadServiceAuthorization

type WorkloadServiceAuthorization struct {
	Subject        VisitorSubject `json:"subject"`
	ServiceID      string         `json:"service_id"`
	ValidUntil     time.Time      `json:"valid_until"`
	PolicyRevision int64          `json:"policy_revision,string"`
}

type WorkloadSession

type WorkloadSession struct {
	RenewalSequence    int64                    `json:"renewal_sequence,string"`
	ID                 string                   `json:"id"`
	Credential         string                   `json:"credential"`
	TeamID             string                   `json:"team_id"`
	ProjectKey         string                   `json:"project_key"`
	Workload           string                   `json:"workload"`
	Provider           string                   `json:"provider"`
	Subject            VisitorSubject           `json:"subject"`
	LeaseExpiresAt     time.Time                `json:"lease_expires_at"`
	IdentityExpiresAt  time.Time                `json:"identity_expires_at"`
	ExpiresAt          *time.Time               `json:"expires_at,omitempty"`
	RenewAfter         time.Time                `json:"renew_after"`
	ServiceIDs         []string                 `json:"service_ids"`
	Binding            string                   `json:"binding"`
	AssertionExpiresAt *time.Time               `json:"assertion_expires_at,omitempty"`
	GitHub             *WorkloadGitHubExecution `json:"github,omitempty"`
}

func (WorkloadSession) ExecutionReference

func (r WorkloadSession) ExecutionReference() string

a trace-safe execution reference contains no JWT, credential or public key.

type WorkloadTokenSource

type WorkloadTokenSource struct{ Credential string }

func (WorkloadTokenSource) GoString

func (WorkloadTokenSource) GoString() string

func (WorkloadTokenSource) String

func (WorkloadTokenSource) String() string

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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