Documentation
¶
Overview ¶
Package relayconfig owns saved profiles, active relay selection and frontend choice.
Index ¶
- Constants
- Variables
- func Encode(config Config) ([]byte, error)
- func Path() (string, error)
- func RelayRouteGuidance(hint networkendpoint.RelayBaseHint) string
- func Save(config Config) error
- func SelectRelays(config Config, override []string) ([]relayprofile.Candidate, error)
- func ShareIntent(config Config, override []string) (relayprofile.Intent, error)
- func ValidateFrontURL(raw string) error
- type Config
- func (c Config) CredentialProfile(address, key string) relayprofile.Candidate
- func (c Config) MergeRelay(p relayprofile.Candidate) (Config, error)
- func (c Config) Preferences(defaultFrontend string) Preferences
- func (c *Config) SetEnabled(address string, enabled bool) error
- func (c *Config) SetMode(mode string) error
- func (config Config) SettingsRevision() string
- func (config Config) TURNSettings() turn.Settings
- func (config Config) Validate() error
- type FileStore
- type PreferenceEdit
- type Preferences
- type RelayView
Constants ¶
const ( PathEnvironment = "WINDSHARE_CONFIG" MaximumProfiles = 64 )
const ( Automatic = "automatic" Selected = "selected" )
Variables ¶
var ( ErrConfig = errors.New("invalid sharing configuration") ErrRelayURL = errors.New("invalid relay URL") // Decode wraps both ErrConfig and ErrRepeatedMember for ambiguous names. ErrRepeatedMember = configjson.ErrRepeatedMember )
var ErrFrontURL = errors.New("invalid frontend URL")
Functions ¶
func RelayRouteGuidance ¶
func RelayRouteGuidance(hint networkendpoint.RelayBaseHint) string
RelayRouteGuidance applies to an observed HTTP failure. The same spelling can still name a working mount or an unused profile.
func Save ¶
Save replaces the entire allowed set. Merging would silently retain providers that a newly imported private-only configuration deliberately excludes.
func SelectRelays ¶
func SelectRelays(config Config, override []string) ([]relayprofile.Candidate, error)
SelectRelays treats a saved list or explicit override as the complete allowed set. No infrastructure is added implicitly, including development listeners.
func ShareIntent ¶
func ShareIntent(config Config, override []string) (relayprofile.Intent, error)
func ValidateFrontURL ¶
Reject literal whitespace rather than rewriting the saved address: capability construction trims some copied characters and encodes others into the path. Explicitly escaped path characters remain part of the configured address.
Types ¶
type Config ¶
type Config struct {
ManagedTURNPolicies []turn.ManagedPolicy
TURN turn.ManualSettings
FrontURL string
Profiles []relayprofile.Candidate
ActiveRelays []string
ConfiguredOnly bool
}
func ReadSettings ¶
func ReadSettings(tx *statefile.Transaction) (Config, error)
ReadSettings lets the setup store observe settings under the shared commit lock.
func (Config) CredentialProfile ¶
func (c Config) CredentialProfile(address, key string) relayprofile.Candidate
CredentialProfile updates only the secret for an existing endpoint. A manual credential carries no discovery metadata and cannot withdraw a published capability.
func (Config) MergeRelay ¶
func (c Config) MergeRelay(p relayprofile.Candidate) (Config, error)
MergeRelay runs on a copy for both enrollment preflight and its eventual commit. Re-discovery cannot erase a device key or re-enable a deliberately disabled profile.
func (Config) Preferences ¶
func (c Config) Preferences(defaultFrontend string) Preferences
func (Config) SettingsRevision ¶
func (Config) TURNSettings ¶
TURNSettings projects only authority and policy; unrelated application settings cannot become a dependency of runtime TURN configuration.
type FileStore ¶
type FileStore struct{ Path string }
FileStore is injectable so applications never read another caller's configuration implicitly.
type PreferenceEdit ¶
func (PreferenceEdit) Apply ¶
func (e PreferenceEdit) Apply(c *Config) error