Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveWingConfig ¶ added in v0.34.0
func SaveWingConfig(dir string, cfg *WingConfig) error
SaveWingConfig writes wing.yaml to dir.
func ToolNames ¶ added in v0.130.0
func ToolNames(tools []*ToolConfig) []string
ToolNames returns just the tool names from a slice of configs.
Types ¶
type AllowKey ¶ added in v0.34.0
type AllowKey struct {
Key string `yaml:"key,omitempty"` // base64 raw P-256 public key (optional)
UserID string `yaml:"user_id,omitempty"` // relay user ID
Email string `yaml:"email,omitempty"` // auto-set from relay, for display
}
AllowKey is an allowed user for wing access control.
type Config ¶
type Config struct {
Dir string `yaml:"-"`
DefaultAgent string `yaml:"default_agent"`
DefaultEmbedder string `yaml:"default_embedder"`
WingID string `yaml:"wing_id"`
Hostname string `yaml:"-"` // os.Hostname(), not persisted
PollInterval string `yaml:"poll_interval"`
DefaultMaxRetries int `yaml:"max_retries"`
RoostURL string `yaml:"roost_url"`
Vars map[string]string `yaml:"vars"`
}
func (*Config) RelayDBPath ¶ added in v0.16.1
func (*Config) ResolveVars ¶
type ICEServer ¶ added in v0.108.0
type ICEServer struct {
URLs []string `yaml:"urls" json:"urls"`
Username string `yaml:"username,omitempty" json:"username,omitempty"`
Credential string `yaml:"credential,omitempty" json:"credential,omitempty"`
}
ICEServer is a STUN/TURN server configuration for WebRTC P2P connections.
type PathEntry ¶ added in v0.56.0
type PathEntry struct {
Path string `yaml:"path" json:"path"`
Members []string `yaml:"members,omitempty" json:"members,omitempty"`
}
PathEntry is a directory path with optional per-folder member ACLs. When Members is nil/empty, the path is visible to all authenticated users (legacy behavior). When Members is set, only those emails + owner/admin can access the path.
type PathList ¶ added in v0.56.0
type PathList []PathEntry
PathList is a list of PathEntry values that supports mixed YAML formats: plain strings ("~/repos") and mappings ({path: ~/repos, members: [...]}).
func (PathList) MarshalYAML ¶ added in v0.56.0
MarshalYAML serializes PathList: entries without members become plain strings (backwards compat).
func (PathList) PathsForUser ¶ added in v0.56.0
PathsForUser returns paths accessible to the given email/orgRole. Owner/admin get all paths. Members get only entries where their email is in Members (case-insensitive) or where Members is empty/nil (legacy open entries).
type ToolConfig ¶ added in v0.130.0
type ToolConfig struct {
Name string `yaml:"name"`
Description string `yaml:"description,omitempty"`
Run string `yaml:"run"`
Env map[string]string `yaml:"env,omitempty"`
Timeout string `yaml:"timeout,omitempty"`
MaxConcurrent int `yaml:"max_concurrent,omitempty"`
}
ToolConfig defines a privileged tool that the wing daemon can execute on behalf of sandboxed agents.
func LoadToolsDir ¶ added in v0.130.0
func LoadToolsDir(dir string) ([]*ToolConfig, error)
LoadToolsDir reads all .yaml files from dir and returns parsed tool configs. Returns nil (no error) if dir doesn't exist. Warns on world-readable files.
func (*ToolConfig) TimeoutDuration ¶ added in v0.130.0
func (t *ToolConfig) TimeoutDuration() time.Duration
TimeoutDuration parses the Timeout field as a time.Duration. Returns 0 if empty or unparseable.
type WingConfig ¶ added in v0.34.0
type WingConfig struct {
WingID string `yaml:"wing_id"`
Label string `yaml:"label,omitempty"` // display name shown in the web UI
Roost string `yaml:"roost,omitempty"`
Org string `yaml:"org,omitempty"`
Paths PathList `yaml:"paths,omitempty"`
Root string `yaml:"root,omitempty"` // compat: folded into Paths on load
Labels []string `yaml:"labels,omitempty"`
EggConfig string `yaml:"egg_config,omitempty"`
Conv string `yaml:"conv,omitempty"`
Audit bool `yaml:"audit,omitempty"`
Debug bool `yaml:"debug,omitempty"`
Locked bool `yaml:"locked,omitempty"` // explicit lock mode toggle
Spectate bool `yaml:"spectate,omitempty"` // allow spectator (read-only) session viewing
AuthTTL string `yaml:"auth_ttl,omitempty"` // passkey auth token duration (default "1h")
AllowKeys []AllowKey `yaml:"allow_keys,omitempty"`
Admins []string `yaml:"admins,omitempty"` // emails with admin role (see all sessions, all paths)
IdleTimeout string `yaml:"idle_timeout,omitempty"` // kill sessions idle for this long (e.g. "4h")
ConnectionMode string `yaml:"connection_mode,omitempty"` // "relay" (default), "p2p", "p2p_only", "direct"
// P2P / Direct mode settings
ICEServers []ICEServer `yaml:"ice_servers,omitempty"` // STUN/TURN servers for WebRTC
DirectPort int `yaml:"direct_port,omitempty"` // port for direct WebSocket connections
DirectTLS bool `yaml:"direct_tls,omitempty"` // enable TLS for direct mode
// JWT signing key for roost mode (base64-DER P-256 private key).
// Auto-generated on first roost start. Server mode uses WT_JWT_KEY env instead.
JWTKey string `yaml:"jwt_key,omitempty"`
// ToolsDir is the directory containing privileged tool YAML configs.
// Defaults to ~/.wingthing/tools/ if empty.
ToolsDir string `yaml:"tools_dir,omitempty"`
}
WingConfig holds wing-specific settings persisted in ~/.wingthing/wing.yaml.
func LoadWingConfig ¶ added in v0.34.0
func LoadWingConfig(dir string) (*WingConfig, error)
LoadWingConfig reads wing.yaml from dir. If the file doesn't exist, it returns a zero-value config (no error). If a legacy wing-id file exists, the wing_id is seeded from it.
func (*WingConfig) IsAdmin ¶ added in v0.63.0
func (c *WingConfig) IsAdmin(email string) bool
IsAdmin returns true if email is in the Admins list (case-insensitive).