Documentation
¶
Overview ¶
package clientstate owns fresh v1 SQLite state, authenticated secret storage, and the transactional project journal shared by apps and publications.
Index ¶
- Constants
- Variables
- func CanonicalServer(value string) (string, error)
- func DatabasePath(root string) string
- func DefaultDir() (string, error)
- func NewAuthOperationID() (string, error)
- func OpenPrivateFile(path string) (*os.File, error)
- func PrepareRoot(root string) (string, error)
- func SavedServerAt(ctx context.Context, root string) (string, bool, error)
- func TelemetryEnabledAt(ctx context.Context, root string) (bool, error)
- func UseMemoryKeychainForTesting()
- func ValidatePrivateFile(info os.FileInfo, directory bool) error
- func WrappingKeyPath(root string) string
- type AliasInfo
- type AliasPublishRun
- type AliasRegistration
- type AliasScope
- type AliasSelection
- type AuthOperation
- type AuthPhase
- type BeginTunnelOptions
- type CertificateCache
- type Connector
- type ControlSession
- type ControlSessionRefreshPhase
- type Database
- func (d *Database) ActiveWebhookDefinitions(ctx context.Context, server string, scope IntegrationScope) (map[string]config.Webhook, error)
- func (d *Database) AdmitOAuthReturn(ctx context.Context, server, hostname, state, path, serviceID string, ...) error
- func (d *Database) AliasCandidate(ctx context.Context, id string) (AliasSelection, TunnelInfo, error)
- func (d *Database) AliasSelection(ctx context.Context, scope AliasScope) (AliasSelection, error)
- func (d *Database) BeginTunnel(ctx context.Context, options BeginTunnelOptions) (*Tunnel, error)
- func (d *Database) CachedWebhookPolicy(ctx context.Context, server, provider string) (webhooksource.CacheEntry, error)
- func (d *Database) ClaimWebhookReceiver(ctx context.Context, server string, scope IntegrationScope, ...) error
- func (d *Database) ClearAliasRun(ctx context.Context, aliasID, owner string) error
- func (d *Database) ClearIntegrationURLReady(ctx context.Context, server, hostname, publisherInstanceID string) error
- func (d *Database) ClearTelemetryOutbox(ctx context.Context) error
- func (d *Database) Close() error
- func (d *Database) CommitRuntimeUpdate(ctx context.Context, project string, update RuntimeUpdate) (RuntimeSnapshot, error)
- func (d *Database) ConsumeOAuthCallback(ctx context.Context, server, hostname, state, path string) (OAuthCallback, OAuthRedirectOrigin, error)
- func (d *Database) DeleteTelemetryEvents(ctx context.Context, events []TelemetryOutboxEvent) error
- func (d *Database) ExclusiveWebhookReceiver(ctx context.Context, server string, scope IntegrationScope, name string, ...) (TunnelInfo, error)
- func (d *Database) GetInspection(ctx context.Context, primary string, number int64) (InspectionRecord, error)
- func (d *Database) InstallationID(ctx context.Context) (string, error)
- func (d *Database) IntegrationURLHostname(ctx context.Context, server, projectKey, namespace, purpose, proposed string) (string, error)
- func (d *Database) IntegrationURLReady(ctx context.Context, server, hostname string) (bool, error)
- func (d *Database) KnownProjectServices(ctx context.Context, project, server string) ([]string, error)
- func (d *Database) ListInspections(ctx context.Context, filter InspectionFilter) ([]InspectionRecord, error)
- func (d *Database) ListRuntimeSnapshots(ctx context.Context) ([]RuntimeSnapshot, error)
- func (d *Database) LocalProjectIdentity(ctx context.Context, root, checkoutKey string) (string, string, error)
- func (d *Database) MarkAliasRunReady(ctx context.Context, run AliasPublishRun) error
- func (d *Database) MarkIntegrationURLReady(ctx context.Context, server, hostname, publisherInstanceID, serviceID string, ...) error
- func (d *Database) PendingTelemetryEvents(ctx context.Context, limit int) ([]TelemetryOutboxEvent, error)
- func (d *Database) PrepareOAuthReturn(ctx context.Context, server, hostname, state, path, serviceID string, ...) (func(context.Context) error, error)
- func (d *Database) PruneTelemetryOutbox(ctx context.Context) error
- func (d *Database) PublisherEnrollmentFiles(instance string) (*PublisherEnrollmentFiles, error)
- func (d *Database) PublisherJobFileManifest(ctx context.Context) ([]byte, bool, error)
- func (d *Database) PublisherJobRegistry(ctx context.Context) ([]byte, bool, error)
- func (d *Database) QueueTelemetryEvent(ctx context.Context, id string, event json.RawMessage, epoch int64) error
- func (d *Database) ReadRuntimeSnapshot(ctx context.Context, project string) (RuntimeSnapshot, error)
- func (d *Database) RecordAliasFailure(ctx context.Context, selection AliasSelection, reason failure.Reason) error
- func (d *Database) RegisterAlias(ctx context.Context, registration AliasRegistration) (AliasSelection, error)
- func (d *Database) ReleaseAlias(ctx context.Context, scope AliasScope, project string) (AliasSelection, error)
- func (d *Database) ReleaseWebhookReceiver(ctx context.Context, server string, scope IntegrationScope, ...) error
- func (d *Database) RemovePublisherJobRegistry(ctx context.Context) error
- func (d *Database) Root() string
- func (d *Database) RuntimeEventsAfter(ctx context.Context, project, cursor string) ([]RuntimeEvent, error)
- func (d *Database) SaveOAuthCallback(ctx context.Context, input SaveOAuthCallbackInput) error
- func (d *Database) SavePublisherJobFileManifest(ctx context.Context, value []byte) error
- func (d *Database) SavePublisherJobRegistry(ctx context.Context, value []byte) error
- func (d *Database) SaveServer(ctx context.Context, serverOrigin string) error
- func (d *Database) SaveWebhookPolicy(ctx context.Context, server, provider string, entry webhooksource.CacheEntry) error
- func (d *Database) SavedServer(ctx context.Context) (string, bool, error)
- func (d *Database) SelectAlias(ctx context.Context, scope AliasScope, project string, force bool) (AliasSelection, error)
- func (d *Database) Server(ctx context.Context, serverOrigin string) (*Store, error)
- func (d *Database) SetTelemetryEnabled(ctx context.Context, enabled bool) error
- func (d *Database) Snapshot(ctx context.Context) (TunnelSnapshot, error)
- func (d *Database) SnapshotProject(ctx context.Context, projectRoot string) (TunnelSnapshot, error)
- func (d *Database) TelemetryEnabled(ctx context.Context) (bool, error)
- func (d *Database) TelemetryPreference(ctx context.Context) (TelemetryPreference, error)
- func (d *Database) WebhookHostname(ctx context.Context, server string, scope IntegrationScope) (string, error)
- func (d *Database) WebhookReceiverCurrent(ctx context.Context, receiver TunnelInfo) (bool, error)
- func (d *Database) WebhookReceivers(ctx context.Context, server string, scope IntegrationScope, name string, ...) ([]TunnelInfo, error)
- func (d *Database) WorktreeHashSalt(ctx context.Context) ([worktreeHashSaltLength]byte, error)
- type FeedbackAction
- type FeedbackAnchor
- type FeedbackAuthorize
- type FeedbackChangedFile
- type FeedbackElement
- type FeedbackEventType
- type FeedbackEvidence
- type FeedbackFailedRequest
- type FeedbackStore
- func (f *FeedbackStore) AppendFeedbackEvent(ctx context.Context, id, key string, body controlv1.AppendFeedbackEventRequest) (result controlv1.FeedbackEvent, retErr error)
- func (f *FeedbackStore) Create(ctx context.Context, service, run, key string, ...) (result controlv1.FeedbackThread, retErr error)
- func (f *FeedbackStore) Delete(ctx context.Context, id string) (retErr error)
- func (f *FeedbackStore) Events(ctx context.Context, service, id string, after uint64) (result controlv1.FeedbackEventPage, retErr error)
- func (f *FeedbackStore) GetFeedbackThread(ctx context.Context, id string) (result controlv1.FeedbackThread, retErr error)
- func (f *FeedbackStore) List(ctx context.Context, service, path, state, cursor string) (result controlv1.FeedbackThreadPage, retErr error)
- type FeedbackTextBoundary
- type FeedbackThreadState
- type GuestSession
- type InspectionFilter
- type InspectionRecord
- type InspectionRecorder
- type IntegrationScope
- type IntegrationURLInfo
- type Lock
- func LockAuthCleanupContext(ctx context.Context, store *Store, id string) (*Lock, error)
- func LockAuthOperationContext(ctx context.Context, store *Store, id string) (*Lock, error)
- func LockControlSessionContext(ctx context.Context, store *Store) (*Lock, error)
- func LockGuestSessionContext(ctx context.Context, store *Store) (*Lock, error)
- func LockHostnameContext(ctx context.Context, store *Store, hostname string) (*Lock, error)
- func LockPublisherHostnameContext(ctx context.Context, store *Store, hostname, publisherIdentityID string) (*Lock, error)
- type Material
- type OAuthCallback
- type OAuthCallbackDestination
- type OAuthCallbackScope
- type OAuthRedirectOrigin
- type OpenOptions
- type Pending
- type PendingPublisherEnrollment
- type PortOccupiedError
- type PortReservedError
- type PrivateDirectory
- func (d *PrivateDirectory) Lock(ctx context.Context, name string) (*Lock, error)
- func (d *PrivateDirectory) Path() string
- func (d *PrivateDirectory) Read(name string, limit int64) ([]byte, bool, error)
- func (d *PrivateDirectory) Scoped(scope string) (*PrivateDirectory, error)
- func (d *PrivateDirectory) Sync(name string) error
- func (d *PrivateDirectory) Write(name string, data []byte) error
- type ProtectionMode
- type PublisherEnrollmentFiles
- type PublisherIdentity
- type PublisherSelection
- type RuntimeEvent
- type RuntimeSnapshot
- type RuntimeUpdate
- type SaveOAuthCallbackInput
- type SourceState
- type Store
- func (s *Store) ActiveAuthOperation(ctx context.Context) (AuthOperation, bool, error)
- func (s *Store) AppendPublisherProvision(ctx context.Context, kind, binding string, previous int64, document []byte) error
- func (s *Store) AuthOperation(ctx context.Context, id string) (AuthOperation, error)
- func (s *Store) CancelAuthOperations(ctx context.Context) error
- func (s *Store) CancelledAuthCredentials(ctx context.Context) ([]AuthOperation, error)
- func (s *Store) CertificatesForPublisher(team, publisher string, plan controlv1.CertificatePlan) (*CertificateCache, error)
- func (s *Store) ClearControlSessionRefreshPending(ctx context.Context) error
- func (s *Store) Connectors(ctx context.Context, identity string) ([]Connector, error)
- func (s *Store) ControlSession(ctx context.Context) (ControlSession, bool, error)
- func (s *Store) CreateAuthOperation(ctx context.Context, op AuthOperation) error
- func (s *Store) DemoFeedback(ctx context.Context, preview string, authorize FeedbackAuthorize) (*FeedbackStore, error)
- func (s *Store) DiscardDemoFeedback(ctx context.Context, preview string) error
- func (s *Store) EnrollVisitorDevice(ctx context.Context, identity, deviceID string, public ed25519.PublicKey) error
- func (s *Store) EnsureEnrolledVisitorDevice(ctx context.Context, identity string, ...) (VisitorDevice, error)
- func (s *Store) EnsureVisitorDevice(ctx context.Context, identity string) (VisitorDevice, error)
- func (s *Store) Feedback(ctx context.Context, project, preview string, authorize FeedbackAuthorize) (*FeedbackStore, error)
- func (s *Store) GuestSession(ctx context.Context) (GuestSession, bool, error)
- func (s *Store) IdentityDirectory() string
- func (s *Store) ImportDeploymentIdentity(ctx context.Context, member controlv1.DeploymentPublisherIdentity, ...) error
- func (s *Store) ImportPublisherIdentity(ctx context.Context, identity PublisherIdentity) error
- func (s *Store) InstallAuthSession(ctx context.Context, op *AuthOperation, session ControlSession) error
- func (s *Store) InstallPublisherIdentity(ctx context.Context, identity PublisherIdentity, selection PublisherSelection) error
- func (s *Store) ListenService(ctx context.Context, identityID, serviceID, protocol string) (net.Listener, error)
- func (s *Store) ListenServiceAt(ctx context.Context, identity, service, address string) (net.Listener, error)
- func (s *Store) LockControlSession() (*Lock, error)
- func (s *Store) LockHostname(hostname string) (*Lock, error)
- func (s *Store) LockPublisherSigningIdentity(ctx context.Context, scope string) (*Lock, error)
- func (s *Store) MarkControlSessionRefreshPending(ctx context.Context) error
- func (s *Store) PendingPublisherEnrollment(ctx context.Context, id string) (PendingPublisherEnrollment, bool, error)
- func (s *Store) PendingPublisherEnrollmentForSelection(ctx context.Context, kind, key string) (PendingPublisherEnrollment, bool, error)
- func (s *Store) PreviewID(ctx context.Context, teamID, worktreeKey string) (string, bool, error)
- func (s *Store) PromotePublisherEnrollment(ctx context.Context, enrollmentID string, identity PublisherIdentity) error
- func (s *Store) PublisherCertificateMaterialExists(ctx context.Context, team, publisher string) (bool, error)
- func (s *Store) PublisherIdentity(ctx context.Context, id string) (PublisherIdentity, bool, error)
- func (s *Store) PublisherIdentityFiles(team, publisher string) (*PrivateDirectory, error)
- func (s *Store) PublisherProvision(ctx context.Context, kind, binding string) ([]byte, int64, error)
- func (s *Store) RecordPublisherEnrollmentResult(ctx context.Context, id string, document []byte) error
- func (s *Store) RemoveConnector(ctx context.Context, identity, service string, processID int) error
- func (s *Store) RemoveControlSession(ctx context.Context) error
- func (s *Store) RemoveGuestSession(ctx context.Context) error
- func (s *Store) RemovePendingPublisherEnrollment(ctx context.Context, id string) error
- func (s *Store) RemovePublisherIdentity(ctx context.Context, id string) error
- func (s *Store) RemovePublisherSelection(ctx context.Context, kind, key string) error
- func (s *Store) RemoveServicePort(ctx context.Context, identityID, serviceID string) error
- func (s *Store) RemoveVisitorDevice(ctx context.Context, identity string) error
- func (s *Store) RequirePublisherCertificatePlans(ctx context.Context, team, publisher string, plans []controlv1.CertificatePlan) error
- func (s *Store) SaveConnector(ctx context.Context, value Connector) error
- func (s *Store) SaveControlSession(ctx context.Context, session ControlSession) error
- func (s *Store) SaveGuestSession(ctx context.Context, session GuestSession) error
- func (s *Store) SavePendingPublisherEnrollment(ctx context.Context, value PendingPublisherEnrollment) error
- func (s *Store) SavePreviewID(ctx context.Context, teamID, worktreeKey, id string) error
- func (s *Store) SaveSelectedTeam(ctx context.Context, teamID string) error
- func (s *Store) SelectPublisherIdentity(ctx context.Context, kind, key, id string) error
- func (s *Store) SelectedPublisherIdentity(ctx context.Context, kind, key string) (PublisherIdentity, bool, error)
- func (s *Store) SelectedTeam(ctx context.Context) (string, bool, error)
- func (s *Store) ServiceListenAddress(ctx context.Context, identity, service, protocol, override string) (string, error)
- func (s *Store) ServicePort(ctx context.Context, identityID, serviceID string) (int, bool, error)
- func (s *Store) SetDeploymentPublisherEnrollmentSecret(ctx context.Context, id, scope string, secret []byte) error
- func (s *Store) UpdateAuthOperation(ctx context.Context, op *AuthOperation) error
- func (s *Store) VisitorDevice(ctx context.Context, identity string) (VisitorDevice, bool, error)
- func (s *Store) WithIdentityDirectory(path string) (*Store, error)
- type TelemetryOutboxEvent
- type TelemetryPreference
- type Tunnel
- func (t *Tunnel) CancelWithCause(err error)
- func (t *Tunnel) Context() context.Context
- func (t *Tunnel) Finish(ctx context.Context, runErr error) error
- func (t *Tunnel) ID() string
- func (t *Tunnel) NewInspectionRecorder(primary, project, shared, service string, policy inspection.Policy) *InspectionRecorder
- func (t *Tunnel) RegisterWebhookEndpoint(ctx context.Context, name string, definition []byte) error
- func (t *Tunnel) SetDraining(ctx context.Context) error
- func (t *Tunnel) SetIntegrationScope(ctx context.Context, scope IntegrationScope) error
- func (t *Tunnel) SetProvisioning(ctx context.Context, publishRunNumber uint64) error
- func (t *Tunnel) SetReady(ctx context.Context, publicURL string, publishRunNumber uint64) error
- func (t *Tunnel) SetServiceRun(ctx context.Context, id string, number uint64, hostname string) error
- type TunnelCommand
- type TunnelInfo
- type TunnelSnapshot
- type TunnelState
- type TunnelSummary
- type VisitorDevice
- type WebhookEndpointInfo
- type WebhookReceiverInfo
Constants ¶
const ( FeedbackOpen FeedbackThreadState = "open" FeedbackResolved FeedbackThreadState = "resolved" FeedbackCreated FeedbackEventType = "thread.created" FeedbackReply FeedbackEventType = "reply" FeedbackUpdate FeedbackEventType = "update" FeedbackThreadResolved FeedbackEventType = "thread.resolved" FeedbackThreadReopened FeedbackEventType = "thread.reopened" )
const ReviewSchemaVersion = 1
const RuntimeEventBytes = 8 << 20
const RuntimeEventRetention = 2048
Variables ¶
var ( ErrAliasNotFound = errors.New("alias has no local declaration") ErrAliasPolicyConflict = errors.New("another worktree declares a different alias or uses its hostname") ErrAliasOwned = errors.New("another live worktree owns this alias") ErrAliasNotSelected = errors.New("this worktree is not selected for the alias") ErrAliasSelectionStale = errors.New("alias selection changed") )
var ( ErrAuthOperationNotFound = errors.New("login operation not found") ErrAuthOperationChanged = errors.New("login operation changed") )
var ( ErrFeedbackNotFound = errors.New("clientstate: feedback thread not found") ErrFeedbackInvalid = errors.New("clientstate: feedback request is invalid") ErrFeedbackAccess = errors.New("clientstate: feedback access denied") ErrFeedbackIdempotency = errors.New("clientstate: feedback idempotency conflict") ErrFeedbackState = errors.New("clientstate: feedback state changed") )
var ErrCertificateExpired = certificatestore.ErrCertificateExpired
var ErrLocked = errors.New("clientstate: state is locked by another process")
var ErrPrivatePortReserved = errors.New("loopback port is reserved for another service")
var ErrPublisherStateConflict = certificatestore.ErrPublisherStateConflict
var ErrRuntimeConflict = errors.New("clientstate: runtime snapshot changed; read a new snapshot before updating")
var ErrRuntimeCursorExpired = errors.New("local event cursor expired; read a new status snapshot")
var ErrWebhookNotSelected = errors.New("this worktree is not the selected webhook receiver")
var ErrWebhookOwned = errors.New("another running tunnel is selected for this webhook")
var ErrWebhookPolicyConflict = errors.New("another worktree declares a conflicting webhook path or policy")
Functions ¶
func CanonicalServer ¶
CanonicalServer validates and normalizes a tnl server origin.
func DatabasePath ¶
DatabasePath returns the shared client database path within root.
func DefaultDir ¶
func NewAuthOperationID ¶
func OpenPrivateFile ¶
OpenPrivateFile validates both the path and opened descriptor and rejects symlinks, public permissions, wrong owners, and a replaced path. do not use it for sqlite database or sidecar files: closing an extra descriptor can release locks held by live sqlite connections in this process.
func PrepareRoot ¶
PrepareRoot creates or validates an owner-only canonical state root. local HTTP API descriptors use the same trust boundary as the database.
func SavedServerAt ¶
SavedServerAt reads the selected origin without unlocking or creating state.
func TelemetryEnabledAt ¶
TelemetryEnabledAt checks an existing database without creating client state or migrating it. an absent database defaults to enabled.
func UseMemoryKeychainForTesting ¶
func UseMemoryKeychainForTesting()
UseMemoryKeychainForTesting is unnecessary outside macOS; file protection is already isolated by each fixture's private state directory.
func ValidatePrivateFile ¶
ValidatePrivateFile validates descriptor metadata without changing permissions.
func WrappingKeyPath ¶
WrappingKeyPath is separate from the database and its backups. file protection is the default outside macOS and can be explicitly selected for system state.
Types ¶
type AliasInfo ¶
type AliasInfo struct {
Name string `json:"name"`
Server string `json:"server"`
Hostname string `json:"hostname"`
PublicURL string `json:"public_url"`
Service string `json:"service"`
SelectedProject string `json:"selected_project"`
DefaultProject string `json:"default_project"`
State string `json:"state"`
ServiceID string `json:"service_id,omitempty"`
RunNumber uint64 `json:"run_number,omitempty"`
Reason failure.Reason `json:"reason,omitempty"`
Action string `json:"action,omitempty"`
}
type AliasPublishRun ¶
type AliasPublishRun struct {
Selection AliasSelection
Owner string
Receiver TunnelInfo
ServiceID string
Number uint64
}
type AliasRegistration ¶
type AliasRegistration struct {
Scope AliasScope
Hostname, Service, TunnelID string
IntegrationScope IntegrationScope
Fingerprint [32]byte
}
type AliasScope ¶
type AliasScope struct {
Server, ProjectKey, TeamID, MembershipID, Namespace, Name string
}
AliasScope identifies a project alias in one member/domain context. ProjectKey is the primary checkout's corresponding project directory, not a branch name.
type AliasSelection ¶
type AliasSelection struct {
ID string
Scope AliasScope
Hostname, Service, Project string
Revision uint64
Fingerprint [32]byte
}
type AuthOperation ¶
type AuthOperation struct {
Team string `json:"team,omitempty"`
SelectedTeamID string `json:"selected_team_id,omitempty"`
ID string `json:"operation_id"`
Server string `json:"server"`
Method string `json:"method"`
Phase AuthPhase `json:"status"`
ApprovalURL string `json:"approval_url,omitempty"`
UserCode string `json:"user_code,omitempty"`
ExpiresAt time.Time `json:"expires_at"`
Interval time.Duration `json:"-"`
IntervalSeconds int64 `json:"interval_seconds"`
NextPollAt time.Time `json:"-"`
Revision int64 `json:"-"`
Private []byte `json:"-"`
}
AuthOperation contains only browser-safe operation information. private checkpoints are sealed separately and never serialized by output adapters.
type AuthPhase ¶
type AuthPhase string
const ( AuthPending AuthPhase = "pending" AuthRedeeming AuthPhase = "redeeming" AuthCredentialReceived AuthPhase = "credential_received" AuthExchanging AuthPhase = "exchanging" AuthIssued AuthPhase = "issued" AuthCompleted AuthPhase = "completed" AuthCancelled AuthPhase = "cancelled" AuthDenied AuthPhase = "denied" AuthExpired AuthPhase = "expired" AuthRecoveryRequired AuthPhase = "recovery_required" )
type BeginTunnelOptions ¶
type BeginTunnelOptions struct {
Command TunnelCommand
Server string
Target string
ServiceProtocol controlv1.ServiceProtocol
Project string
Service string
ServiceID string
IntegrationScope IntegrationScope
}
type CertificateCache ¶
type CertificateCache = certificatestore.CertificateCache
type ControlSession ¶
type ControlSession struct {
SessionID string
AccessToken string
AccessExpiresAt time.Time
RefreshToken string
RefreshExpiresAt time.Time
RefreshPending bool
}
func (ControlSession) RefreshPhase ¶
func (session ControlSession) RefreshPhase(now time.Time) ControlSessionRefreshPhase
type ControlSessionRefreshPhase ¶
type ControlSessionRefreshPhase uint8
refresh_pending is a persisted checkpoint, not a network-in-flight signal. a process that reads it cannot tell whether the one-use token was spent, so recovery takes precedence even if the refresh credential has since expired.
const ( RefreshAvailable ControlSessionRefreshPhase = iota RefreshExpired RefreshRecoveryRequired )
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database owns the shared local client database.
func OpenWithOptions ¶
func (*Database) ActiveWebhookDefinitions ¶
func (*Database) AdmitOAuthReturn ¶
func (d *Database) AdmitOAuthReturn(ctx context.Context, server, hostname, state, path, serviceID string, number uint64) error
AdmitOAuthReturn binds the browser's final callback hop to the service run that started login. unknown states are ordinary app requests; a known return never falls through to a replacement run, including after it was consumed.
func (*Database) AliasCandidate ¶
func (d *Database) AliasCandidate(ctx context.Context, id string) (AliasSelection, TunnelInfo, error)
AliasCandidate reads selection and its current ready receiver in one snapshot. a caller must compare its captured revision and tunnel/run identity before admitting a request; election alone does not reject a changed selection.
func (*Database) AliasSelection ¶
func (d *Database) AliasSelection(ctx context.Context, scope AliasScope) (AliasSelection, error)
func (*Database) BeginTunnel ¶
BeginTunnel registers a local tunnel and maintains its liveness lease until Finish joins the heartbeat worker.
func (*Database) CachedWebhookPolicy ¶
func (d *Database) CachedWebhookPolicy(ctx context.Context, server, provider string) (webhooksource.CacheEntry, error)
CachedWebhookPolicy returns the last policy for one server and fixed provider.
func (*Database) ClaimWebhookReceiver ¶
func (*Database) ClearAliasRun ¶
func (*Database) ClearIntegrationURLReady ¶
func (*Database) ClearTelemetryOutbox ¶
func (*Database) CommitRuntimeUpdate ¶
func (d *Database) CommitRuntimeUpdate(ctx context.Context, project string, update RuntimeUpdate) (RuntimeSnapshot, error)
CommitRuntimeUpdate allocates the cursor in SQLite and commits the snapshot, event, and retention together. it never trusts a writer's event history.
func (*Database) ConsumeOAuthCallback ¶
func (d *Database) ConsumeOAuthCallback(ctx context.Context, server, hostname, state, path string) (OAuthCallback, OAuthRedirectOrigin, error)
ConsumeOAuthCallback atomically removes one mapping and checks its tunnel is still ready. a callback for a stopped or replaced service run cannot be sent to a different app merely because the hostname was reused.
func (*Database) DeleteTelemetryEvents ¶
func (d *Database) DeleteTelemetryEvents(ctx context.Context, events []TelemetryOutboxEvent) error
func (*Database) ExclusiveWebhookReceiver ¶
func (d *Database) ExclusiveWebhookReceiver(ctx context.Context, server string, scope IntegrationScope, name string, fingerprint [32]byte) (TunnelInfo, error)
func (*Database) GetInspection ¶
func (*Database) InstallationID ¶
InstallationID returns the stable pseudonymous identifier for this client database.
func (*Database) IntegrationURLHostname ¶
func (d *Database) IntegrationURLHostname(ctx context.Context, server, projectKey, namespace, purpose, proposed string) (string, error)
IntegrationURLHostname preserves the first selected hostname for each scope.
func (*Database) IntegrationURLReady ¶
func (*Database) KnownProjectServices ¶
func (d *Database) KnownProjectServices(ctx context.Context, project, server string) ([]string, error)
KnownProjectServices returns IDs previously published by this project/server, including services whose local tunnels have stopped. these IDs select a fresh signed read; they do not prove current authority.
func (*Database) ListInspections ¶
func (d *Database) ListInspections(ctx context.Context, filter InspectionFilter) ([]InspectionRecord, error)
func (*Database) ListRuntimeSnapshots ¶
func (d *Database) ListRuntimeSnapshots(ctx context.Context) ([]RuntimeSnapshot, error)
func (*Database) LocalProjectIdentity ¶
func (d *Database) LocalProjectIdentity(ctx context.Context, root, checkoutKey string) (string, string, error)
LocalProjectIdentity keeps the checkout mapping on this machine. concurrent callers share the first committed random identifiers, not path hashes.
func (*Database) MarkAliasRunReady ¶
func (d *Database) MarkAliasRunReady(ctx context.Context, run AliasPublishRun) error
func (*Database) MarkIntegrationURLReady ¶
func (d *Database) MarkIntegrationURLReady(ctx context.Context, server, hostname, publisherInstanceID, serviceID string, runNumber uint64) error
MarkIntegrationURLReady renews one locally ready integration service run. only the publisher instance that marked it ready may clear the lease.
func (*Database) PendingTelemetryEvents ¶
func (*Database) PrepareOAuthReturn ¶
func (d *Database) PrepareOAuthReturn(ctx context.Context, server, hostname, state, path, serviceID string, number uint64) (func(context.Context) error, error)
PrepareOAuthReturn validates a final return without spending it. the returned claim rechecks current destination ownership atomically when consumed, after reversible request admission. a known claim never becomes an unknown state.
func (*Database) PruneTelemetryOutbox ¶
func (*Database) PublisherEnrollmentFiles ¶
func (d *Database) PublisherEnrollmentFiles(instance string) (*PublisherEnrollmentFiles, error)
func (*Database) PublisherJobFileManifest ¶
PublisherJobFileManifest stores the exact pinned-file set separately from the registry; both documents remain protected inside the database.
func (*Database) PublisherJobRegistry ¶
PublisherJobRegistry keeps the root-owned job snapshot sealed as one value.
func (*Database) QueueTelemetryEvent ¶
func (*Database) ReadRuntimeSnapshot ¶
func (d *Database) ReadRuntimeSnapshot(ctx context.Context, project string) (RuntimeSnapshot, error)
ReadRuntimeSnapshot reads services, publications, and the current cursor in one transaction. an empty project is initialized under SQLite's writer lock.
func (*Database) RecordAliasFailure ¶
func (*Database) RegisterAlias ¶
func (d *Database) RegisterAlias(ctx context.Context, registration AliasRegistration) (AliasSelection, error)
RegisterAlias defaults ownership to the primary checkout. registration never takes an explicit selection from another worktree, even after it stops.
func (*Database) ReleaseAlias ¶
func (d *Database) ReleaseAlias(ctx context.Context, scope AliasScope, project string) (AliasSelection, error)
ReleaseAlias returns an override to the primary checkout, even if its service is stopped. only the selected worktree may release its selection.
func (*Database) ReleaseWebhookReceiver ¶
func (*Database) RemovePublisherJobRegistry ¶
func (*Database) RuntimeEventsAfter ¶
func (*Database) SaveOAuthCallback ¶
func (d *Database) SaveOAuthCallback(ctx context.Context, input SaveOAuthCallbackInput) error
SaveOAuthCallback stores an opaque OAuth state digest, never the state value. duplicate states fail closed rather than replacing another worktree's login.
func (*Database) SavePublisherJobFileManifest ¶
func (*Database) SavePublisherJobRegistry ¶
func (*Database) SaveServer ¶
SaveServer records the server selected by a successful login.
func (*Database) SaveWebhookPolicy ¶
func (d *Database) SaveWebhookPolicy(ctx context.Context, server, provider string, entry webhooksource.CacheEntry) error
SaveWebhookPolicy updates the bounded client-state copy of a validated catalog response.
func (*Database) SavedServer ¶
SavedServer returns the server selected by the last successful login.
func (*Database) SelectAlias ¶
func (d *Database) SelectAlias(ctx context.Context, scope AliasScope, project string, force bool) (AliasSelection, error)
SelectAlias requires a ready caller service. without force, another selected live tunnel retains ownership through reprovisioning. stopping it permits an explicit selection change, but never causes automatic reassignment.
func (*Database) SetTelemetryEnabled ¶
SetTelemetryEnabled saves the preference across commands and projects.
func (*Database) Snapshot ¶
func (d *Database) Snapshot(ctx context.Context) (TunnelSnapshot, error)
Snapshot returns one consistent view of all nonterminal local tunnels.
func (*Database) SnapshotProject ¶
SnapshotProject returns one consistent view of a project's nonterminal tunnels.
func (*Database) TelemetryEnabled ¶
TelemetryEnabled returns the saved preference for this client state.
func (*Database) TelemetryPreference ¶
func (d *Database) TelemetryPreference(ctx context.Context) (TelemetryPreference, error)
func (*Database) WebhookHostname ¶
func (*Database) WebhookReceiverCurrent ¶
func (*Database) WebhookReceivers ¶
func (d *Database) WebhookReceivers(ctx context.Context, server string, scope IntegrationScope, name string, digest [32]byte) ([]TunnelInfo, error)
type FeedbackAction ¶
type FeedbackAnchor ¶
type FeedbackAnchor struct {
SchemaVersion int `json:"schema_version"`
Selectors []string `json:"selectors"`
X float64 `json:"x"`
Y float64 `json:"y"`
Selection *struct {
Start FeedbackTextBoundary `json:"start"`
End FeedbackTextBoundary `json:"end"`
Text string `json:"text"`
} `json:"selection,omitempty"`
}
type FeedbackAuthorize ¶
type FeedbackAuthorize func(context.Context, string, string) (controlv1.FeedbackAuthorization, error)
FeedbackAuthorize obtains a fresh content-free control decision. it is composed by the publisher or signed-in client, never supplied by browser input.
type FeedbackChangedFile ¶
type FeedbackElement ¶
type FeedbackEventType ¶
type FeedbackEventType string
type FeedbackEvidence ¶
type FeedbackEvidence struct {
SchemaVersion int `json:"schema_version"`
Element *FeedbackElement `json:"element,omitempty"`
Actions []FeedbackAction `json:"actions"`
FailedRequests []FeedbackFailedRequest `json:"failed_requests"`
}
type FeedbackFailedRequest ¶
type FeedbackStore ¶
type FeedbackStore struct {
// contains filtered or unexported fields
}
FeedbackStore owns content for exactly one local project identity, server and preview. it shares client state's connection and transaction/cleanup ownership.
func (*FeedbackStore) AppendFeedbackEvent ¶
func (f *FeedbackStore) AppendFeedbackEvent(ctx context.Context, id, key string, body controlv1.AppendFeedbackEventRequest) (result controlv1.FeedbackEvent, retErr error)
func (*FeedbackStore) Create ¶
func (f *FeedbackStore) Create(ctx context.Context, service, run, key string, body controlv1.CreateFeedbackReportRequest) (result controlv1.FeedbackThread, retErr error)
Create validates and normalizes locally before authorization. no submitted content, request digest or thread ID is sent to control.
func (*FeedbackStore) Delete ¶
func (f *FeedbackStore) Delete(ctx context.Context, id string) (retErr error)
func (*FeedbackStore) Events ¶
func (f *FeedbackStore) Events(ctx context.Context, service, id string, after uint64) (result controlv1.FeedbackEventPage, retErr error)
func (*FeedbackStore) GetFeedbackThread ¶
func (f *FeedbackStore) GetFeedbackThread(ctx context.Context, id string) (result controlv1.FeedbackThread, retErr error)
func (*FeedbackStore) List ¶
func (f *FeedbackStore) List(ctx context.Context, service, path, state, cursor string) (result controlv1.FeedbackThreadPage, retErr error)
type FeedbackTextBoundary ¶
type FeedbackThreadState ¶
type FeedbackThreadState string
type GuestSession ¶
func (GuestSession) GoString ¶
func (GuestSession) GoString() string
func (GuestSession) String ¶
func (GuestSession) String() string
type InspectionFilter ¶
type InspectionRecord ¶
type InspectionRecord struct {
Number int64 `json:"number"`
TunnelID string `json:"tunnel_id"`
PrimaryCheckoutRoot string `json:"primary_checkout_root"`
Project string `json:"project_root"`
Service string `json:"service,omitempty"`
Protocol inspection.Protocol `json:"protocol"`
ReceivedAt time.Time `json:"received_at"`
Method string `json:"method,omitempty"`
Path string `json:"path,omitempty"`
Status int `json:"status,omitempty"`
DurationMS int64 `json:"duration_ms"`
Origin string `json:"origin"`
Operation inspection.Operation `json:"operation,omitempty"`
Result inspection.Result `json:"result,omitempty"`
RedisCommand string `json:"redis_command,omitempty"`
SQLState string `json:"sql_state,omitempty"`
Rows int64 `json:"rows,omitempty"`
ResultSets int64 `json:"result_sets,omitempty"`
MySQLErrorCode int64 `json:"mysql_error_code,omitempty"`
}
func InspectionRecordFromSummary ¶
func InspectionRecordFromSummary(summary inspection.Summary) InspectionRecord
InspectionRecordFromSummary preserves completion outcomes, including an HTTP response interrupted after successful headers were already sent.
type InspectionRecorder ¶
type InspectionRecorder struct {
// contains filtered or unexported fields
}
InspectionRecorder drops observations instead of blocking visitor traffic.
func (*InspectionRecorder) Close ¶
func (r *InspectionRecorder) Close(ctx context.Context) error
Close drains queued records after the publisher stops and before client state closes.
func (*InspectionRecorder) Observe ¶
func (r *InspectionRecorder) Observe(record InspectionRecord)
type IntegrationScope ¶
IntegrationScope identifies one project's integration URLs in a namespace. the primary project root is shared by its worktrees, not their branch names.
func (IntegrationScope) IsZero ¶
func (s IntegrationScope) IsZero() bool
func (IntegrationScope) Validate ¶
func (s IntegrationScope) Validate() error
type IntegrationURLInfo ¶
type IntegrationURLInfo struct {
Kind string `json:"kind"`
Server string `json:"server"`
Hostname string `json:"hostname"`
PublicURL string `json:"public_url"`
State string `json:"state"`
Reason failure.Reason `json:"reason,omitempty"`
Action string `json:"action,omitempty"`
Endpoints []WebhookEndpointInfo `json:"endpoints,omitempty"`
}
IntegrationURLInfo describes a saved project URL while its local project has a tunnel. readiness comes from the integration URL publisher's current lease.
type Lock ¶
Lock owns a local state lock. Store methods choose its scope and path.
func LockAuthCleanupContext ¶
func LockAuthOperationContext ¶
LockAuthOperationContext serializes waiters without holding the credential lock.
func LockGuestSessionContext ¶
LockGuestSessionContext serializes guest credential issuance for one selected server.
func LockHostnameContext ¶
type Material ¶
type Material = certificatestore.Material
type OAuthCallback ¶
OAuthCallback identifies the exact local service run that started a login.
type OAuthCallbackDestination ¶
type OAuthCallbackDestination struct {
TunnelID, Path, Query string
}
type OAuthCallbackScope ¶
type OAuthCallbackScope struct {
Server, Hostname string
IntegrationScope IntegrationScope
}
type OAuthRedirectOrigin ¶
OAuthRedirectOrigin is the exact service and run that started login. an alias origin is independent of the local app tunnel receiving the callback.
type OpenOptions ¶
type OpenOptions struct {
// optional telemetry drops work instead of waiting behind a SQLite writer.
NoWait bool
// protection defaults to Keychain on macOS and a private file elsewhere.
// reopening must use the same mode; the database verifies the wrapping key.
Protection ProtectionMode
}
type Pending ¶
type Pending = certificatestore.Pending
type PendingPublisherEnrollment ¶
type PendingPublisherEnrollment struct {
EnrollmentID string
SelectionKind string
SelectionKey string
PublicKey []byte
SigningKey []byte
EnrollmentSecret []byte
ResultJSON []byte
ExpiresAt time.Time
}
PendingPublisherEnrollment keeps one key across an interrupted one-use redemption. the secret is present only when local setup must retry issuance.
type PortOccupiedError ¶
PortOccupiedError identifies the saved port occupied by another process. the assignment is not silently changed behind a configured GUI profile.
func (*PortOccupiedError) Error ¶
func (e *PortOccupiedError) Error() string
func (*PortOccupiedError) Unwrap ¶
func (e *PortOccupiedError) Unwrap() error
type PortReservedError ¶
type PortReservedError struct{ Port int }
func (*PortReservedError) Error ¶
func (e *PortReservedError) Error() string
func (*PortReservedError) Unwrap ¶
func (e *PortReservedError) Unwrap() error
type PrivateDirectory ¶
type PrivateDirectory struct {
// contains filtered or unexported fields
}
PrivateDirectory holds small durable identity files. SQLite and its wrapping key remain in the runtime state directory, independently of this filesystem.
func OpenPrivateDirectory ¶
func OpenPrivateDirectory(path string) (*PrivateDirectory, error)
func (*PrivateDirectory) Path ¶
func (d *PrivateDirectory) Path() string
func (*PrivateDirectory) Scoped ¶
func (d *PrivateDirectory) Scoped(scope string) (*PrivateDirectory, error)
func (*PrivateDirectory) Sync ¶
func (d *PrivateDirectory) Sync(name string) error
Sync recovers an uncertain rename/sync outcome before a recovered key or staged certificate may authorize another external issuance/install operation.
type ProtectionMode ¶
type ProtectionMode string
const ( ProtectionFile ProtectionMode = "file" ProtectionKeychain ProtectionMode = "keychain" )
type PublisherEnrollmentFiles ¶
type PublisherEnrollmentFiles struct {
// contains filtered or unexported fields
}
PublisherEnrollmentFiles stores one encrypted SDK enrollment record. the slot is independent of the server profile so reopening can verify the saved origin before selecting a control client.
type PublisherIdentity ¶
type PublisherSelection ¶
PublisherSelection names a local use of an installed identity. its key is opaque to persistence and keeps the caller's existing selection encoding.
type RuntimeEvent ¶
type RuntimeSnapshot ¶
type RuntimeSnapshot struct {
SchemaVersion int `json:"schema_version"`
Project string `json:"project"`
Cursor string `json:"cursor"`
ObservedAt time.Time `json:"observed_at"`
Services []json.RawMessage `json:"services"`
Publications []TunnelInfo `json:"publications,omitempty"`
}
RuntimeSnapshot is one transactional project view. service values belong to the app runtime; publication observations are maintained by native tunnels. callers treat cursors as opaque and use RuntimeEventsAfter for exclusive resume.
type RuntimeUpdate ¶
type RuntimeUpdate struct {
// nil services append an event without replacing the app snapshot. non-nil
// services require ExpectedCursor to prevent lost updates from app writers.
Services []json.RawMessage
ExpectedCursor string
Type string
Payload json.RawMessage
// snapshot embeds the exact committed project view in the event payload.
Snapshot bool
}
type SaveOAuthCallbackInput ¶
type SaveOAuthCallbackInput struct {
Scope OAuthCallbackScope
Origin OAuthRedirectOrigin
Destination OAuthCallbackDestination
State string
}
type SourceState ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store scopes credentials, certificates, and locks to one server profile.
func (*Store) ActiveAuthOperation ¶
func (*Store) AppendPublisherProvision ¶
func (s *Store) AppendPublisherProvision(ctx context.Context, kind, binding string, previous int64, document []byte) error
AppendPublisherProvision commits one transition before its external effect. the expected revision prevents a stale writer from replacing another key.
func (*Store) AuthOperation ¶
func (*Store) CancelAuthOperations ¶
CancelAuthOperations runs under the credential lock, as does session installation.
func (*Store) CancelledAuthCredentials ¶
func (s *Store) CancelledAuthCredentials(ctx context.Context) ([]AuthOperation, error)
func (*Store) CertificatesForPublisher ¶
func (s *Store) CertificatesForPublisher(team, publisher string, plan controlv1.CertificatePlan) (*CertificateCache, error)
CertificatesForPublisher selects durable native TLS storage independently of SQLite and its wrapping key. native and host publishers use the same engine.
func (*Store) ClearControlSessionRefreshPending ¶
func (*Store) Connectors ¶
func (*Store) ControlSession ¶
func (*Store) CreateAuthOperation ¶
func (s *Store) CreateAuthOperation(ctx context.Context, op AuthOperation) error
func (*Store) DemoFeedback ¶
func (s *Store) DemoFeedback(ctx context.Context, preview string, authorize FeedbackAuthorize) (*FeedbackStore, error)
func (*Store) DiscardDemoFeedback ¶
DiscardDemoFeedback is run cleanup, not a browser deletion capability. the exact demo-only scope cannot select a project/worktree's retained feedback.
func (*Store) EnrollVisitorDevice ¶
func (s *Store) EnrollVisitorDevice(ctx context.Context, identity, deviceID string, public ed25519.PublicKey) error
EnrollVisitorDevice binds the issued device ID to the exact pending key. a stale enrollment reply cannot replace another key or enrollment.
func (*Store) EnsureEnrolledVisitorDevice ¶
func (s *Store) EnsureEnrolledVisitorDevice(ctx context.Context, identity string, enroll func(context.Context, ed25519.PublicKey) (controlv1.VisitorDevice, error)) (VisitorDevice, error)
EnsureEnrolledVisitorDevice shares one protected key between connector sessions and service client certificates. a lost response retries that key.
func (*Store) EnsureVisitorDevice ¶
EnsureVisitorDevice persists the retry key before sending an enrollment. concurrent callers select the same winning key without replacing it.
func (*Store) Feedback ¶
func (s *Store) Feedback(ctx context.Context, project, preview string, authorize FeedbackAuthorize) (*FeedbackStore, error)
func (*Store) GuestSession ¶
func (*Store) IdentityDirectory ¶
func (*Store) ImportDeploymentIdentity ¶
func (s *Store) ImportDeploymentIdentity(ctx context.Context, member controlv1.DeploymentPublisherIdentity, key ed25519.PrivateKey, selection string) error
ImportDeploymentIdentity updates the public document and its authenticated encryption context together. callers first verify current membership with control. only the display selector may change; neither identity nor key may.
func (*Store) ImportPublisherIdentity ¶
func (s *Store) ImportPublisherIdentity(ctx context.Context, identity PublisherIdentity) error
ImportPublisherIdentity installs the exact public document and key once. retries may select it again but cannot silently replace its signing key.
func (*Store) InstallAuthSession ¶
func (s *Store) InstallAuthSession(ctx context.Context, op *AuthOperation, session ControlSession) error
InstallAuthSession atomically completes the checkpoint and installs credentials. the caller holds the credential lock, so logout cannot race the transaction.
func (*Store) InstallPublisherIdentity ¶
func (s *Store) InstallPublisherIdentity(ctx context.Context, identity PublisherIdentity, selection PublisherSelection) error
InstallPublisherIdentity commits an exact imported key and its selection together. a failed installation cannot leave the selection partially changed.
func (*Store) ListenService ¶
func (s *Store) ListenService(ctx context.Context, identityID, serviceID, protocol string) (net.Listener, error)
ListenService reserves the listener before persisting a new port. an existing assignment is never changed on a conflict. SQLite's immediate writer transaction serializes allocation across local publisher processes.
func (*Store) ListenServiceAt ¶
func (s *Store) ListenServiceAt(ctx context.Context, identity, service, address string) (net.Listener, error)
ListenServiceAt binds an exact loopback address. the first fixed address establishes a missing saved port; an existing assignment is never changed by an override. a stopped service's reservation still belongs to it. port zero is permitted for a foreground ephemeral listener and is not saved.
func (*Store) LockControlSession ¶
func (*Store) LockPublisherSigningIdentity ¶
LockPublisherSigningIdentity serializes key creation and registration for one server-scoped publisher identity. callers hold it across read, create, save.
func (*Store) MarkControlSessionRefreshPending ¶
func (*Store) PendingPublisherEnrollment ¶
func (*Store) PendingPublisherEnrollmentForSelection ¶
func (*Store) PromotePublisherEnrollment ¶
func (s *Store) PromotePublisherEnrollment(ctx context.Context, enrollmentID string, identity PublisherIdentity) error
PromotePublisherEnrollment commits the installed key and its first selection together. a repeated redemption can only reuse the same public document/key.
func (*Store) PublisherCertificateMaterialExists ¶
func (*Store) PublisherIdentity ¶
func (*Store) PublisherIdentityFiles ¶
func (s *Store) PublisherIdentityFiles(team, publisher string) (*PrivateDirectory, error)
func (*Store) PublisherProvision ¶
func (s *Store) PublisherProvision(ctx context.Context, kind, binding string) ([]byte, int64, error)
PublisherProvision reads the latest protected journal entry. absence is only permission to start when the owner has also ruled out remote or receipt state.
func (*Store) RecordPublisherEnrollmentResult ¶
func (s *Store) RecordPublisherEnrollmentResult(ctx context.Context, id string, document []byte) error
RecordPublisherEnrollmentResult keeps a successful redemption recoverable even when the process stops before it can install the identity.
func (*Store) RemoveConnector ¶
func (*Store) RemoveControlSession ¶
func (*Store) RemovePendingPublisherEnrollment ¶
func (*Store) RemovePublisherIdentity ¶
func (*Store) RemovePublisherSelection ¶
func (*Store) RemoveServicePort ¶
func (*Store) RemoveVisitorDevice ¶
func (*Store) RequirePublisherCertificatePlans ¶
func (s *Store) RequirePublisherCertificatePlans(ctx context.Context, team, publisher string, plans []controlv1.CertificatePlan) error
RequirePublisherCertificatePlans checks control's monotonic plan inventory.
func (*Store) SaveConnector ¶
SaveConnector records a local supervisor observation, without secrets or provider targets. expired observations cannot reserve a new listener.
func (*Store) SaveControlSession ¶
func (s *Store) SaveControlSession(ctx context.Context, session ControlSession) error
func (*Store) SaveGuestSession ¶
func (s *Store) SaveGuestSession(ctx context.Context, session GuestSession) error
func (*Store) SavePendingPublisherEnrollment ¶
func (s *Store) SavePendingPublisherEnrollment(ctx context.Context, value PendingPublisherEnrollment) error
func (*Store) SavePreviewID ¶
SavePreviewID records the preview identity returned by control.
func (*Store) SaveSelectedTeam ¶
SaveSelectedTeam records the selected team for this server origin.
func (*Store) SelectPublisherIdentity ¶
func (*Store) SelectedPublisherIdentity ¶
func (*Store) SelectedTeam ¶
SelectedTeam returns the stable team selection for this server origin.
func (*Store) ServiceListenAddress ¶
func (s *Store) ServiceListenAddress(ctx context.Context, identity, service, protocol, override string) (string, error)
ServiceListenAddress chooses an install-time address using only reads. it does not bind a socket or save a reservation. a supervisor must later use ListenServiceAt with this exact address; a conflict is an error rather than permission to choose another port. an override never renumbers a saved assignment, even when another service's reservation is currently inactive.
func (*Store) ServicePort ¶
func (*Store) SetDeploymentPublisherEnrollmentSecret ¶
func (s *Store) SetDeploymentPublisherEnrollmentSecret(ctx context.Context, id, scope string, secret []byte) error
SetDeploymentPublisherEnrollmentSecret refreshes only a pending deployment task's bootstrap secret. its protected signing key is never deleted or replaced, including when a previous redemption response was lost.
func (*Store) UpdateAuthOperation ¶
func (s *Store) UpdateAuthOperation(ctx context.Context, op *AuthOperation) error
func (*Store) VisitorDevice ¶
type TelemetryOutboxEvent ¶
type TelemetryOutboxEvent struct {
ID string
JSON json.RawMessage
Epoch int64
}
type TelemetryPreference ¶
telemetry preferences fence work collected before an off/on change.
type Tunnel ¶
type Tunnel struct {
// contains filtered or unexported fields
}
Tunnel is the write handle for one local publication.
func (*Tunnel) CancelWithCause ¶
CancelWithCause stops this tunnel when a local reporting boundary fails. Finish records the original cause after joining lease maintenance.
func (*Tunnel) Context ¶
Context is canceled if the parent ends or a failed heartbeat leaves the tunnel's local lease unmaintained.
func (*Tunnel) Finish ¶
Finish cancels and joins lease maintenance before recording the terminal state so a late heartbeat cannot overwrite it.
func (*Tunnel) NewInspectionRecorder ¶
func (t *Tunnel) NewInspectionRecorder(primary, project, shared, service string, policy inspection.Policy) *InspectionRecorder
func (*Tunnel) RegisterWebhookEndpoint ¶
RegisterWebhookEndpoint declares a path for this tunnel's integration group. receiver selection remains separate: only the declared service receives it.
func (*Tunnel) SetIntegrationScope ¶
func (t *Tunnel) SetIntegrationScope(ctx context.Context, scope IntegrationScope) error
SetIntegrationScope joins this tunnel to its machine-local project scope.
func (*Tunnel) SetProvisioning ¶
type TunnelInfo ¶
type TunnelInfo struct {
ID string `json:"tunnel_id"`
Command TunnelCommand `json:"command"`
State TunnelState `json:"state"`
ProcessID int `json:"process_id"`
Server string `json:"server"`
Project string `json:"project"`
Service string `json:"service,omitempty"`
ServiceProtocol controlv1.ServiceProtocol `json:"service_protocol,omitempty"`
ServiceID string `json:"service_id,omitempty"`
PublishRunNumber uint64 `json:"publish_run_number,omitempty"`
ServiceRunID string `json:"service_run_id,omitempty"`
RunHostname string `json:"run_hostname,omitempty"`
Hostname string `json:"hostname,omitempty"`
PublicURL string `json:"public_url,omitempty"`
Target string `json:"target,omitempty"`
Framework string `json:"framework,omitempty"`
IntegrationScope IntegrationScope `json:"-"`
StartedAt time.Time `json:"started_at"`
UpdatedAt time.Time `json:"updated_at"`
HeartbeatAt time.Time `json:"heartbeat_at"`
LeaseExpiresAt time.Time `json:"lease_expires_at"`
Failure string `json:"failure,omitempty"`
}
type TunnelSnapshot ¶
type TunnelSnapshot struct {
SchemaVersion int `json:"schema_version"`
ObservedAt time.Time `json:"observed_at"`
Summary TunnelSummary `json:"summary"`
Tunnels []TunnelInfo `json:"tunnels"`
IntegrationURLs []IntegrationURLInfo `json:"integration_urls"`
Aliases []AliasInfo `json:"aliases"`
}
func (*TunnelSnapshot) SelectService ¶
func (snapshot *TunnelSnapshot) SelectService(name string)
SelectService narrows a snapshot to publications, aliases and webhook endpoints for one named service. project-wide integration URLs have no service selector.
type TunnelState ¶
type TunnelState string
const ( TunnelStateStarting TunnelState = "starting" TunnelStateProvisioning TunnelState = "provisioning" TunnelStateReady TunnelState = "ready" TunnelStateDraining TunnelState = "draining" TunnelStateStopped TunnelState = "stopped" TunnelStateFailed TunnelState = "failed" TunnelStateStale TunnelState = "stale" )
type TunnelSummary ¶
type VisitorDevice ¶
type VisitorDevice struct {
ID string
PublicKey ed25519.PublicKey
SigningKey ed25519.PrivateKey `json:"-"`
}
VisitorDevice is the protected per-server, per-identity Ed25519 device key. ID is empty until enrollment succeeds. the key is never a plaintext DB field.
type WebhookEndpointInfo ¶
type WebhookEndpointInfo struct {
Name string `json:"name"`
Service string `json:"service"`
Path string `json:"path"`
URL string `json:"url"`
Delivery string `json:"delivery"`
State string `json:"state"`
ReadyReceivers []WebhookReceiverInfo `json:"ready_receivers"`
Owner *WebhookReceiverInfo `json:"owner,omitempty"`
Reason failure.Reason `json:"reason,omitempty"`
Action string `json:"action,omitempty"`
}
Source Files
¶
- alias_publish_runs.go
- alias_status.go
- aliases.go
- auth_operations.go
- certificates.go
- connectors.go
- control_session.go
- deployment_identity.go
- deployment_runtime.go
- doc.go
- feedback.go
- feedback_model.go
- feedback_validation.go
- guest_session.go
- identity_directory.go
- inspections.go
- installation.go
- integration_scope.go
- integration_url_names.go
- integration_url_readiness.go
- integration_url_status.go
- keychain_testing_other.go
- local_project_identities.go
- locks.go
- oauth_callbacks.go
- previews.go
- project_services.go
- protector.go
- protector_other.go
- publisher_enrollment_files.go
- publisher_job_documents.go
- publisher_provision.go
- publisher_state.go
- runtime.go
- service_ports.go
- sqlite.go
- state.go
- telemetry.go
- telemetry_outbox.go
- tunnels.go
- visitor_devices.go
- webhook_catalog.go
- webhook_endpoints.go
- webhook_owners.go
Directories
¶
| Path | Synopsis |
|---|---|
|
package certificatestore owns durable publisher certificate transitions.
|
package certificatestore owns durable publisher certificate transitions. |