Documentation
¶
Overview ¶
Package scope defines the session/project scoping token that gates cross-session delivery in the daemon. The design goal is to make global (cross-project) access the loud, deliberate exception rather than the silent default.
Almost every delivery path — proxy lookups, overlay endpoint resolution, broadcast fan-out — takes a Scope. A Scope built with Project(path) only matches that one project. A Scope built with Unscoped(reason) matches everything but emits an audit log line at the construction site, so every global access is greppable and traceable.
The zero value is invalid on purpose: callers must construct a Scope explicitly, which prevents "forgot to scope" bugs from compiling into a silent global.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizePath ¶
NormalizePath is the single canonical path normalizer used for all scope comparisons. It resolves to an absolute path and lowercases on Windows for case-insensitive filesystems. Empty and "." normalize to "".
Types ¶
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope identifies which project(s) an operation is allowed to touch.
Construct via Project (single project) or Unscoped (all projects, audited). The zero value reports Valid() == false and matches nothing.
func Project ¶
Project returns a Scope restricted to a single project directory. The path is normalized so callers may pass a raw, un-normalized directory.
func Unscoped ¶
Unscoped returns a Scope that matches every project. It is the deliberate escape hatch for the handful of daemon-wide operations (shutdown reaps, state restore, orphan scans). Every call logs an audit line identifying the caller and reason so global access stays rare and visible.
func (Scope) IsUnscoped ¶
IsUnscoped reports whether this scope matches every project.
func (Scope) Match ¶
Match reports whether the given project directory falls within this scope. An unscoped scope matches anything. An invalid (zero) scope matches nothing. The argument is normalized before comparison.
func (Scope) ProjectPath ¶
ProjectPath returns the normalized project path, or "" when unscoped.