alpha

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: Apache-2.0 Imports: 7 Imported by: ? 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 alpha is the shared convention for hand-modeling a Tailscale feature that is alpha or unreleased in the pinned tailscale.com/client/tailscale/v2 SDK, so a tool in this repo can pick up an alpha feature early instead of waiting for the SDK to catch up.

It owns the Registry, which validates and queries a caller-owned feature inventory; RepositoryFeatures, the canonical inventory of every feature this repository hand-models (Name, DocURL, ModeledDate, and pipeline Stage); and AlphaHint, the string "alpha-hint" and the third SourceRef confidence value alongside "derived" and "hint" (AGENTS.md AX convention 13). A hint is editorial evidence verified against a stable pinned module; AlphaHint is editorial evidence against a surface Tailscale itself calls unstable — categorically weaker.

Shared hand-modeled policy syntax can also live here when more than one tool needs an identical representation; the declarative node-sharing selector grammar is the first. Its relationship data was hand-modeled here too, until tailscale.com/client/tailscale/v2 v2.11.0 grew a real externalTailnets field and the migration tripwire moved the model onto the SDK's type. Each feature is expected to carry its own migration tripwire — a test that fails once the pinned SDK adds real support for the feature, forcing a conscious decision to migrate off the hand-modeled types rather than letting them silently diverge from the now-real SDK types. RepositoryFeatures makes the feature discoverable; it does not enforce that feature's tripwire itself.

Index

Constants

View Source
const AlphaHint = "alpha-hint"

AlphaHint is the string "alpha-hint": the source-provenance confidence tier for data derived from a Tailscale feature this repo has hand-modeled ahead of the pinned SDK. It is deliberately its own SourceRef value, not folded into "hint": a hint describes evidence against a stable pinned module, while AlphaHint describes evidence against a surface Tailscale itself calls unstable.

Variables

This section is empty.

Functions

func LooksLikeExternalSelector

func LooksLikeExternalSelector(selector string) bool

LooksLikeExternalSelector reports whether selector uses the cross-tailnet scheme syntax, whether or not the rest of it is well-formed.

It is deliberately more permissive than ParseExternalSelector: a mistyped cross-tailnet reference is still a cross-tailnet reference, and a caller that routed it to the local-selector vocabulary instead would report the typo as "this rule names nobody" rather than "this cannot be decided from this tailnet's policy". Recognizing it here lets the caller keep that distinction and surface the parse error.

Types

type ExternalSelector

type ExternalSelector struct {
	Kind  ExternalSelectorKind
	Alias string
	Name  string
}

ExternalSelector is a parsed cross-tailnet group or tag selector. Alias is the local key in ExternalTailnets; Name omits the ordinary group: or tag: prefix because Kind carries that distinction.

func ParseExternalSelector

func ParseExternalSelector(selector string) (ExternalSelector, error)

ParseExternalSelector parses the declarative node-sharing selector forms group://<alias>/<name> and tag://<alias>/<name>. Same-tailnet group:name and tag:name selectors are intentionally rejected so callers cannot conflate local and cross-tailnet references.

type ExternalSelectorKind

type ExternalSelectorKind string

ExternalSelectorKind distinguishes the two cross-tailnet selector forms declarative node sharing currently documents.

const (
	// ExternalSelectorGroup identifies group://<alias>/<name> selectors.
	ExternalSelectorGroup ExternalSelectorKind = "group"
	// ExternalSelectorTag identifies tag://<alias>/<name> selectors.
	ExternalSelectorTag ExternalSelectorKind = "tag"
)

type Feature

type Feature struct {
	Name        string
	DocURL      string
	ModeledDate time.Time
	Stage       Stage
}

Feature is one hand-modeled Tailscale alpha feature: what it is, where its spec comes from, when this repo started modeling it, and how far it has moved through Tailscale's own release pipeline.

func RepositoryFeatures

func RepositoryFeatures() []Feature

RepositoryFeatures returns the canonical repository-wide feature inventory. Add every hand-modeled alpha or unreleased feature to the slice returned here. A fresh slice is returned on every call, so callers cannot mutate the inventory exposed to the rest of the repository.

type LiveVerifyFunc

type LiveVerifyFunc func(ctx context.Context) error

LiveVerifyFunc exercises one hand-modeled alpha feature against a real, live tailnet and reports a non-nil error when the feature's hand-modeled type no longer matches what the live API actually returns. It takes only ctx: the credentials and client it needs to make that call are the registering caller's to close over, so this package never depends on how a feature talks to the live API.

type Registry

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

Registry validates and queries a caller-owned feature inventory. It is not shared package state; registering a feature does not update the canonical inventory returned by RepositoryFeatures.

func NewRegistry

func NewRegistry() *Registry

NewRegistry returns an empty, caller-owned Registry.

func (*Registry) List

func (r *Registry) List() []Feature

List returns every registered Feature, sorted by Name so the result is deterministic across the randomized map-iteration order Go uses internally.

func (*Registry) Lookup

func (r *Registry) Lookup(name string) (Feature, bool)

Lookup returns the Feature registered under name, if any.

func (*Registry) Register

func (r *Registry) Register(f Feature) error

Register adds f to the registry. It rejects a Feature missing a required field, an unrecognized Stage, and a Name already registered — the same fail-loud posture sanitize.ParseLevel uses for an unrecognized Level.

type Stage

type Stage string

Stage is a hand-modeled feature's position in Tailscale's own release pipeline.

const (
	StageAlpha Stage = "alpha"
	StageBeta  Stage = "beta"
	StageGA    Stage = "ga"
)

type VerifierRegistry

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

VerifierRegistry is a caller-owned collection of LiveVerifyFuncs, each tied to a Feature name already present in a backing Registry. It is a separate type from Registry, not a field on Feature, because a LiveVerifyFunc closes over live credentials and is not comparable — bundling it onto Feature would break Feature's use as plain, comparable inventory data.

func NewVerifierRegistry

func NewVerifierRegistry(features *Registry) *VerifierRegistry

NewVerifierRegistry returns an empty VerifierRegistry backed by features. RegisterVerifier rejects a feature name that features does not already have registered, so features must be populated first.

func (*VerifierRegistry) RegisterVerifier

func (vr *VerifierRegistry) RegisterVerifier(featureName string, verify LiveVerifyFunc) error

RegisterVerifier ties verify to featureName. It rejects a nil verify, a featureName not already present in the backing Registry — a live-verify function for an unregistered feature is either a typo or dead code — and a featureName that already carries a verifier.

func (*VerifierRegistry) RunAll

func (vr *VerifierRegistry) RunAll(ctx context.Context) []VerifyResult

RunAll runs every registered LiveVerifyFunc against ctx and returns one VerifyResult per verifier, sorted by FeatureName so a caller's output is deterministic. It does not stop at the first failure: schema drift in one feature should not hide drift in another.

type VerifyResult

type VerifyResult struct {
	FeatureName string
	Err         error
}

VerifyResult is one feature's live-verify outcome.

Jump to

Keyboard shortcuts

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