config

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLocation = "/etc/featherpanel/config.yml"

Variables

DefaultTLSConfig sets sane defaults to use when configuring the internal webserver to listen for public connections.

@see https://blog.cloudflare.com/exposing-go-on-the-internet

Functions

func ConfigureDirectories

func ConfigureDirectories() error

ConfigureDirectories ensures that all the system directories exist on the system. These directories are created so that only the owner can read the data, and no other users.

This function IS NOT thread-safe.

func ConfigureTimezone

func ConfigureTimezone() error

ConfigureTimezone sets the timezone data for the configuration if it is currently missing. If a value has been set, this functionality will only run to validate that the timezone being used is valid.

This function IS NOT thread-safe.

func EnableLogRotation

func EnableLogRotation() error

EnableLogRotation writes a logrotate file for wings to the system logrotate configuration directory if one exists and a logrotate file is not found. This allows us to basically automate away the log rotation for most installs, but also enable users to make modifications on their own.

This function IS NOT thread-safe.

func EnsureFeatherUser

func EnsureFeatherUser() error

EnsureFeatherUser ensures that the FeatherPanel core user exists on the system. This user will be the owner of all data in the root data directory and is used as the user within containers. If files are not owned by this user there will be issues with permissions on Docker mount points.

This function IS NOT thread safe and should only be called in the main thread when the application is booting.

func Expand

func Expand(v string) (string, error)

Expand expands an input string by calling os.ExpandEnv to expand all environment variables, then checks if the value is prefixed with `file://` to support reading the value from a file.

NOTE: the order of expanding environment variables first then checking if the value references a file is important. This behaviour allows a user to pass a value like `file://${CREDENTIALS_DIRECTORY}/token` to allow us to work with credentials loaded by systemd's `LoadCredential` (or `LoadCredentialEncrypted`) options without the user needing to assume the path of `CREDENTIALS_DIRECTORY` or use a preStart script to read the files for us.

func FetchRuntimeConfigYAML added in v1.4.0

func FetchRuntimeConfigYAML(ctx context.Context, bootstrap *JoinBootstrap, allowInsecure bool) ([]byte, error)

FetchRuntimeConfigYAML downloads the runtime config from the panel using bootstrap credentials.

func FromFile

func FromFile(path string) error

FromFile reads the configuration from the provided file and stores it in the global singleton for this instance.

func GetJwtAlgorithm

func GetJwtAlgorithm() *jwt.HMACSHA

GetJwtAlgorithm returns the in-memory JWT algorithm.

func IsFullWingsConfig added in v1.4.0

func IsFullWingsConfig(raw []byte) bool

IsFullWingsConfig reports whether join-data already contains a complete config.yml.

func IsKVMAvailable added in v1.0.7

func IsKVMAvailable() bool

IsKVMAvailable checks if KVM is available on the host system by checking if /dev/kvm exists and is accessible.

func MergeConfigWithRaw added in v1.0.7

func MergeConfigWithRaw(rawYAML []byte, cfg *Configuration) ([]byte, error)

MergeConfigWithRaw merges a Configuration struct with raw YAML content, preserving comments from the original file while updating values. This function parses the raw YAML as a node tree, updates values, and writes back.

func NormalizePanelURL added in v1.4.0

func NormalizePanelURL(baseURL string) string

NormalizePanelURL returns the panel origin (scheme + host, optional port) with no path or query.

func ReadRawConfig added in v1.0.7

func ReadRawConfig(path string) ([]byte, error)

ReadRawConfig reads the configuration file as raw YAML text, preserving comments.

func Set

func Set(c *Configuration)

Set the global configuration instance. This is a blocking operation such that anything trying to set a different configuration value, or read the configuration will be paused until it is complete.

func SetDebugViaFlag

func SetDebugViaFlag(d bool)

SetDebugViaFlag tracks if the application is running in debug mode because of a command line flag argument. If so we do not want to store that configuration change to the disk.

func Update

func Update(callback func(c *Configuration))

Update performs an in-situ update of the global configuration object using a thread-safe mutex lock. This is the correct way to make modifications to the global configuration.

func UpdateYAMLNode added in v1.0.7

func UpdateYAMLNode(rootNode *yaml.Node, path string, value interface{}) error

UpdateYAMLNode updates a YAML node tree using dot-notation paths. This preserves comments and formatting while updating specific values.

func UseOpenat2

func UseOpenat2() bool

func VerifyJoinCredentials added in v1.4.0

func VerifyJoinCredentials(ctx context.Context, bootstrap *JoinBootstrap, allowInsecure bool) error

VerifyJoinCredentials checks the bootstrap token against the panel health endpoint.

func WriteConfigWithComments added in v1.0.7

func WriteConfigWithComments(cfg *Configuration) error

WriteConfigWithComments writes the configuration to disk while preserving comments from the original file. If no original file exists or merging fails, it falls back to standard marshaling.

func WriteRawConfig added in v1.0.7

func WriteRawConfig(path string, content []byte) error

WriteRawConfig writes raw YAML content to the configuration file.

func WriteToDisk

func WriteToDisk(c *Configuration) error

WriteToDisk writes the configuration to the disk. This is a thread safe operation and will only allow one write at a time. Additional calls while writing are queued up.

Types

type ApiConfiguration

type ApiConfiguration struct {
	// The interface that the internal webserver should bind to.
	Host string `default:"0.0.0.0" yaml:"host"`

	// The port that the internal webserver should bind to.
	Port int `default:"8080" yaml:"port"`

	// Docs controls whether the auto-generated Swagger/OpenAPI documentation is served.
	Docs DocsConfiguration `yaml:"docs"`

	// SSL configuration for the daemon.
	Ssl struct {
		Enabled         bool   `json:"enabled" yaml:"enabled"`
		CertificateFile string `json:"cert" yaml:"cert"`
		KeyFile         string `json:"key" yaml:"key"`
	}

	// Determines if functionality for allowing remote download of files into server directories
	// is enabled on this instance. If set to "true" remote downloads will not be possible for
	// servers.
	DisableRemoteDownload bool `json:"-" yaml:"disable_remote_download"`

	// RemoteDownload defines settings specific to server remote file downloads.
	RemoteDownload struct {
		// MaxRedirects specifies the maximum number of HTTP redirects to follow during a remote file download. Defaults to 10.
		MaxRedirects int `default:"10" json:"max_redirects" yaml:"max_redirects"`
	} `json:"remote_download" yaml:"remote_download"`

	// RemoteDownloadAllowlist allows remote downloads of files into server directories to
	// connect to otherwise blocked private/internal destinations. Entries may be hostnames,
	// IP addresses, or CIDR ranges.
	RemoteDownloadAllowlist []string `json:"-" yaml:"remote_download_allowlist"`

	// The maximum size for files uploaded through the Panel in MiB.
	UploadLimit int64 `default:"100" json:"upload_limit" yaml:"upload_limit"`

	// A list of IP address of proxies that may send a X-Forwarded-For header to set the true clients IP
	TrustedProxies []string `json:"trusted_proxies" yaml:"trusted_proxies"`

	// If set to true, TLS certificate verification errors will be ignored when making
	// API calls to the Panel. This is useful for development environments with self-signed
	// certificates. The command line flag --ignore-certificate-errors takes precedence.
	IgnoreCertificateErrors bool `json:"ignore_certificate_errors" yaml:"ignore_certificate_errors"`
}

ApiConfiguration defines the configuration for the internal API that is exposed by the Wings webserver.

type Backups

type Backups struct {
	// WriteLimit imposes a Disk I/O write limit on backups to the disk, this affects all
	// backup drivers as the archiver must first write the file to the disk in order to
	// upload it to any external storage provider.
	//
	// If the value is less than 1, the write speed is unlimited,
	// if the value is greater than 0, the write speed is the value in MiB/s.
	//
	// Defaults to 0 (unlimited)
	WriteLimit int `default:"0" yaml:"write_limit"`

	// CompressionLevel determines how much backups created by wings should be compressed.
	//
	// "none" -> no compression will be applied
	// "best_speed" -> uses gzip level 1 for fast speed
	// "best_compression" -> uses gzip level 9 for minimal disk space useage
	//
	// Defaults to "best_speed" (level 1)
	CompressionLevel string `default:"best_speed" yaml:"compression_level"`

	// RestoreHostAllowlist allows backup restore downloads to connect to otherwise blocked
	// private/internal destinations. Entries may be hostnames, IP addresses, or CIDR ranges.
	RestoreHostAllowlist []string `yaml:"restore_host_allowlist"`

	// RemoveBackupsOnServerDelete deletes backups associated with a server when the server is deleted
	RemoveBackupsOnServerDelete bool `default:"true" yaml:"remove_backups_on_server_delete"`

	// PBS configures the optional Proxmox Backup Server destination. When enabled,
	// the panel may request adapter "pbs" so server files are streamed with
	// proxmox-backup-client (pxar) instead of writing local tar.gz archives.
	PBS PBSBackups `yaml:"pbs"`
}

type Configuration

type Configuration struct {
	Token Token `json:"-" yaml:"-"`

	// Determines if wings should be running in debug mode. This value is ignored
	// if the debug flag is passed through the command line arguments.
	Debug bool

	// Determines if wings should run with minimal logging output. This value is
	// ignored if debug mode is enabled.
	Quiet bool

	AppName string `default:"FeatherPanel" json:"app_name" yaml:"app_name"`

	// A unique identifier for this node in the Panel.
	Uuid string

	// An identifier for the token which must be included in any requests to the panel
	// so that the token can be looked up correctly.
	AuthenticationTokenId string `json:"token_id" yaml:"token_id"`

	// The token used when performing operations. Requests to this instance must
	// validate against it.
	AuthenticationToken string `json:"token" yaml:"token"`

	Api    ApiConfiguration    `json:"api" yaml:"api"`
	System SystemConfiguration `json:"system" yaml:"system"`
	Docker DockerConfiguration `json:"docker" yaml:"docker"`

	// Sentry configures GlitchTip / Sentry-compatible error reporting.
	Sentry SentryConfiguration `json:"sentry" yaml:"sentry"`

	// Defines internal throttling configurations for server processes to prevent
	// someone from running an endless loop that spams data to logs.
	Throttles ConsoleThrottles

	// The location where the panel is running that this daemon should connect to
	// to collect data and send events.
	PanelLocation string                   `json:"-" yaml:"remote"`
	RemoteQuery   RemoteQueryConfiguration `json:"remote_query" yaml:"remote_query"`

	// AllowedMounts is a list of allowed host-system mount points.
	// This is required to have the "Server Mounts" feature work properly.
	AllowedMounts []string `json:"-" yaml:"allowed_mounts"`

	SearchRecursion SearchRecursion `yaml:"Search"`
	// BlockBaseDirMount indicates whether mounting to /home/container is blocked.
	// If true, mounting to /home/container is blocked.
	// If false, mounting to /home/container is allowed.
	BlockBaseDirMount bool `default:"true" json:"-" yaml:"BlockBaseDirMount"`

	// AllowedOrigins is a list of allowed request origins.
	// The Panel URL is automatically allowed, this is only needed for adding
	// additional origins.
	AllowedOrigins []string `json:"allowed_origins" yaml:"allowed_origins"`

	// AllowCORSPrivateNetwork sets the `Access-Control-Request-Private-Network` header which
	// allows client browsers to make requests to internal IP addresses over HTTP.  This setting
	// is only required by users running Wings without SSL certificates and using internal IP
	// addresses in order to connect. Most users should NOT enable this setting.
	AllowCORSPrivateNetwork bool `json:"allow_cors_private_network" yaml:"allow_cors_private_network"`

	// IgnorePanelConfigUpdates causes confiuration updates that are sent by the panel to be ignored.
	IgnorePanelConfigUpdates bool `json:"ignore_panel_config_updates" yaml:"ignore_panel_config_updates"`
	// contains filtered or unexported fields
}

func Get

func Get() *Configuration

Get returns the global configuration instance. This is a thread-safe operation that will block if the configuration is presently being modified.

Be aware that you CANNOT make modifications to the currently stored configuration by modifying the struct returned by this function. The only way to make modifications is by using the Update() function and passing data through in the callback.

func NewAtPath

func NewAtPath(path string) (*Configuration, error)

NewAtPath creates a new struct and set the path where it should be stored. This function does not modify the currently stored global configuration.

func (*Configuration) ApplyPanelConfiguration added in v1.4.3

func (c *Configuration) ApplyPanelConfiguration(p PanelConfiguration)

ApplyPanelConfiguration sets the values in the configuration that the Panel is allowed to set.

func (*Configuration) PanelConfiguration added in v1.4.3

func (c *Configuration) PanelConfiguration() PanelConfiguration

PanelConfiguration returns the values in the configuration that the Panel is allowed to set.

func (*Configuration) Path added in v1.0.7

func (c *Configuration) Path() string

Path returns the file path where this configuration is stored.

func (*Configuration) ResolveToken added in v1.4.3

func (c *Configuration) ResolveToken(remote bool) error

ResolveToken populates the derived Token field, preferring values pinned through the environment over those in the configuration itself.

Set remote when the values came from the Panel. Local values may use "file://" or "$VAR" indirection; expanding one sent over the network would leak files and environment variables back out through the token we attach to every request. Environment overrides must already match remote values so a configuration update cannot leave Wings and the Panel using different keys.

type ConsoleThrottles

type ConsoleThrottles struct {
	// Whether or not the throttler is enabled for this instance.
	Enabled bool `json:"enabled" yaml:"enabled" default:"true"`

	// The total number of lines that can be output in a given Period period before
	// a warning is triggered and counted against the server.
	Lines uint64 `json:"lines" yaml:"lines" default:"2000"`

	// The amount of time after which the number of lines processed is reset to 0. This runs in
	// a constant loop and is not affected by the current console output volumes. By default, this
	// will reset the processed line count back to 0 every 100ms.
	Period uint64 `json:"line_reset_interval" yaml:"line_reset_interval" default:"100"`
}

type CrashDetection

type CrashDetection struct {
	// CrashDetectionEnabled sets if crash detection is enabled globally for all servers on this node.
	CrashDetectionEnabled bool `default:"true" yaml:"enabled"`

	// Determines if Wings should detect a server that stops with a normal exit code of
	// "0" as being crashed if the process stopped without any Wings interaction. E.g.
	// the user did not press the stop button, but the process stopped cleanly.
	DetectCleanExitAsCrash bool `default:"true" yaml:"detect_clean_exit_as_crash"`

	// Timeout specifies the timeout between crashes that will not cause the server
	// to be automatically restarted, this value is used to prevent servers from
	// becoming stuck in a boot-loop after multiple consecutive crashes.
	Timeout int `default:"60" json:"timeout"`

	// MaxRestarts specifies how many times a server may be automatically restarted
	// after a crash before Wings stops attempting to recover it. The counter resets
	// when the server is manually started. A value of 0 disables this limit.
	MaxRestarts int `default:"0" yaml:"max_restarts"`
}

type CreatePanelLocationRequest added in v1.4.0

type CreatePanelLocationRequest struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description,omitempty"`
	FlagCode    string `json:"flag_code,omitempty"`
}

CreatePanelLocationRequest is the body for PUT /api/admin/locations.

type CreatePanelNodeRequest added in v1.4.0

type CreatePanelNodeRequest struct {
	Name               string  `json:"name"`
	Description        string  `json:"description,omitempty"`
	FQDN               string  `json:"fqdn"`
	LocationID         int     `json:"location_id"`
	Public             int     `json:"public"`
	Scheme             string  `json:"scheme"`
	BehindProxy        int     `json:"behind_proxy"`
	MaintenanceMode    int     `json:"maintenance_mode"`
	Memory             int     `json:"memory"`
	MemoryOverallocate int     `json:"memory_overallocate"`
	Disk               int     `json:"disk"`
	DiskOverallocate   int     `json:"disk_overallocate"`
	UploadSize         int     `json:"upload_size"`
	DaemonListen       int     `json:"daemonListen"`
	DaemonSFTP         int     `json:"daemonSFTP"`
	FastDLPort         int     `json:"fastdl_port"`
	DaemonBase         string  `json:"daemonBase"`
	DaemonType         string  `json:"daemon_type,omitempty"`
	PublicIPv4         *string `json:"public_ip_v4"`
	PublicIPv6         *string `json:"public_ip_v6"`
	SFTPSubdomain      *string `json:"sftp_subdomain"`
}

CreatePanelNodeRequest is the body for PUT /api/admin/nodes.

type DockerConfiguration

type DockerConfiguration struct {
	// Network configuration that should be used when creating a new network
	// for containers run through the daemon.
	Network DockerNetworkConfiguration `json:"network" yaml:"network"`

	// Domainname is the Docker domainname for all containers.
	Domainname string `default:"" json:"domainname" yaml:"domainname"`

	// Registries .
	Registries map[string]RegistryConfiguration `json:"registries" yaml:"registries"`

	// TmpfsSize specifies the size for the /tmp directory mounted into containers. Please be
	// aware that Docker utilizes the host's system memory for this value, and that we do not
	// keep track of the space used there, so avoid allocating too much to a server.
	TmpfsSize uint `default:"100" json:"tmpfs_size" yaml:"tmpfs_size"`

	// ContainerPidLimit sets the total number of processes that can be active in a container
	// at any given moment. This is a security concern in shared-hosting environments where a
	// malicious process could create enough processes to cause the host node to run out of
	// available pids and crash.
	ContainerPidLimit int64 `default:"512" json:"container_pid_limit" yaml:"container_pid_limit"`

	// InstallerLimits defines the limits on the installer containers that prevents a server's
	// installation process from unintentionally consuming more resources than expected. This
	// is used in conjunction with the server's defined limits. Whichever value is higher will
	// take precedence in the installer containers.
	InstallerLimits struct {
		Memory int64 `default:"1024" json:"memory" yaml:"memory"`
		Cpu    int64 `default:"100" json:"cpu" yaml:"cpu"`
	} `json:"installer_limits" yaml:"installer_limits"`

	// CpuShares is the relative CFS weight given to server containers that have a
	// CPU limit, used when the host is fully saturated; it limits nothing on an idle
	// host. It defaults to 1024, which is what Wings has always set. Set it to 0 to
	// leave containers at the engine default: cgroup v2 turns 1024 shares into less
	// than half of its default weight, so 0 gives servers more weight than host
	// system services.
	CpuShares int64 `default:"1024" json:"cpu_shares" yaml:"cpu_shares"`

	// CpuPeriod is the length of a CFS scheduling window in microseconds. Server
	// quotas scale with it, so the configured CPU limits stay the same. A shorter
	// period reduces the worst case throttle latency at the cost of additional
	// scheduler overhead.
	CpuPeriod int64 `default:"100000" json:"cpu_period" yaml:"cpu_period"`

	// CpuBurst allows containers to bank unused CFS quota within a period and spend
	// it on short spikes without raising their long term CPU limit. Percent sizes the
	// burst relative to a server's quota and is capped at 100 by the kernel. Requires
	// Linux 5.14 or newer, it is skipped silently otherwise.
	CpuBurst struct {
		Enabled bool  `default:"true" json:"enabled" yaml:"enabled"`
		Percent int64 `default:"100" json:"percent" yaml:"percent"`
	} `json:"cpu_burst" yaml:"cpu_burst"`

	// Overhead controls the memory overhead given to all containers to circumvent certain
	// software such as the JVM not staying below the maximum memory limit.
	Overhead Overhead `json:"overhead" yaml:"overhead"`

	UsePerformantInspect bool `default:"true" json:"use_performant_inspect" yaml:"use_performant_inspect"`

	// RuntimeReconciliation periodically verifies Docker runtime state against the
	// process state Wings tracks, recovering servers stuck in starting/stopping when
	// Docker and containerd become desynchronized or Docker API calls hang.
	RuntimeReconciliation RuntimeReconciliationConfiguration `json:"runtime_reconciliation" yaml:"runtime_reconciliation"`

	// Sets the user namespace mode for the container when user namespace remapping option is
	// enabled.
	//
	// If the value is blank, the daemon's user namespace remapping configuration is used,
	// if the value is "host", then the featherpanel containers are started with user namespace
	// remapping disabled
	UsernsMode string `default:"" json:"userns_mode" yaml:"userns_mode"`

	// Sets the IPS that the user is able to bind to
	SystemIps []string `default:"[]" json:"system_ips" yaml:"system_ips"`

	// EnableNativeKVM enables native KVM support for containers. This allows containers
	// to access /dev/kvm for hardware-accelerated virtualization. The default value is
	// automatically set to true if KVM is available on the host system, otherwise false.
	EnableNativeKVM bool `json:"enable_native_kvm" yaml:"enable_native_kvm"`

	LogConfig struct {
		Type   string            `default:"local" json:"type" yaml:"type"`
		Config map[string]string `` /* 127-byte string literal not displayed */
	} `json:"log_config" yaml:"log_config"`
}

DockerConfiguration defines the docker configuration used by the daemon when interacting with containers and networks on the system.

func (DockerConfiguration) ContainerLogConfig

func (c DockerConfiguration) ContainerLogConfig() container.LogConfig

func (DockerConfiguration) CpuPeriodMicroseconds added in v1.5.0

func (c DockerConfiguration) CpuPeriodMicroseconds() int64

CpuPeriodMicroseconds returns the configured CFS period clamped to the range the kernel accepts. A zero value (unset) falls back to the 100ms default.

func (DockerConfiguration) RegistryCredentialsForImage added in v1.4.0

func (c DockerConfiguration) RegistryCredentialsForImage(img string) (string, *RegistryConfiguration)

RegistryCredentialsForImage returns registry credentials for an image only when the configured registry and image reference share the same registry identity.

type DockerNetworkConfiguration

type DockerNetworkConfiguration struct {
	// The interface that should be used to create the network. Must not conflict
	// with any other interfaces in use by Docker or on the system.
	Interface string `default:"172.19.0.1" json:"interface" yaml:"interface"`

	// Dns is the list of DNS servers for containers. When empty or omitted, Docker
	// uses its embedded resolver (127.0.0.11), which forwards to the host's resolvers
	// and avoids resolution failures when custom DNS IPs are unreachable from the
	// bridge (e.g. firewall, or api.minecraftservices.com / Yggdrasil auth failing).
	// Set explicitly if you need containers to use specific resolvers (e.g. 8.8.8.8).
	Dns []string `default:"[\"1.1.1.1\", \"1.0.0.1\"]"`

	// The name of the network to use. If this network already exists it will not
	// be created. If it is not found, a new network will be created using the interface
	// defined.
	Name   string `default:"featherpanel_nw"`
	ISPN   bool   `default:"false" yaml:"ispn"`
	IPv6   bool   `default:"true" yaml:"IPv6"`
	Driver string `default:"bridge"`
	Mode   string `default:"featherpanel_nw" yaml:"network_mode"`
	// IsInternal, when true, creates an internal-only network: containers cannot
	// reach the internet (e.g. Minecraft auth to api.minecraftservices.com will fail).
	// Leave false for game servers that need outbound access.
	IsInternal bool                    `default:"false" yaml:"is_internal"`
	EnableICC  bool                    `default:"true" yaml:"enable_icc"`
	NetworkMTU int64                   `default:"1500" yaml:"network_mtu"`
	Interfaces dockerNetworkInterfaces `yaml:"interfaces"`
}

type DocsConfiguration added in v1.0.4

type DocsConfiguration struct {
	Enabled bool `default:"true" yaml:"enabled"`
}

type FastDLConfiguration added in v1.2.4

type FastDLConfiguration struct {
	// Enabled controls whether FastDL is enabled. When enabled, nginx configuration
	// will be generated for servers that have FastDL enabled. Requires nginx to be installed.
	Enabled bool `default:"false" json:"enabled" yaml:"enabled"`

	// The bind port for the nginx FastDL server.
	Port int `default:"80" json:"bind_port" yaml:"bind_port"`

	// PublicHostname is the hostname clients use in sv_downloadurl (node FQDN).
	// When empty, falls back to extracting a host from PanelLocation (legacy).
	PublicHostname string `json:"public_hostname" yaml:"public_hostname"`

	// NginxConfigPath is the path where nginx config files will be written.
	// Defaults to /etc/nginx/sites-available/featherwings-fastdl
	NginxConfigPath string `default:"/etc/nginx/sites-available/featherwings-fastdl" json:"nginx_config_path" yaml:"nginx_config_path"`
}

type FileCollaboration added in v1.4.0

type FileCollaboration struct {
	// Enabled turns collaborative editing on or off for this node.
	Enabled bool `default:"true" json:"enabled" yaml:"enabled"`

	// FileSizeCap is the maximum file size in bytes that can be collaboratively edited.
	FileSizeCap uint64 `default:"1048576" json:"file_size_cap" yaml:"file_size_cap"`

	// MaxSessionsPerServer limits concurrent collab sessions (files) per server.
	MaxSessionsPerServer uint64 `default:"16" json:"max_sessions_per_server" yaml:"max_sessions_per_server"`

	// MaxSessionsPerConnection limits how many files one websocket may edit at once.
	MaxSessionsPerConnection uint64 `default:"8" json:"max_sessions_per_connection" yaml:"max_sessions_per_connection"`

	// MaxEditorsPerSession limits editor tabs for the same file on one connection.
	MaxEditorsPerSession uint64 `default:"32" json:"max_editors_per_session" yaml:"max_editors_per_session"`

	// MaxCursorsPerConnection limits awareness cursors tracked per connection.
	MaxCursorsPerConnection uint64 `default:"64" json:"max_cursors_per_connection" yaml:"max_cursors_per_connection"`

	// SessionGracePeriod is how long (seconds) an empty session is kept before teardown.
	SessionGracePeriod uint64 `default:"30" json:"session_grace_period" yaml:"session_grace_period"`
}

FileCollaboration configures Yjs-based collaborative file editing over the server websocket (Calagopus-compatible event names).

type FileHistory added in v1.4.0

type FileHistory struct {
	Enabled             bool   `default:"true" yaml:"enabled"`
	ZstdLevel           int    `default:"3" yaml:"zstd_level"`
	AnchorInterval      uint64 `default:"4" yaml:"anchor_interval"`
	KeepChains          uint64 `default:"5" yaml:"keep_chains"`
	FileSizeCap         uint64 `default:"1048576" yaml:"file_size_cap"`
	PerFileDiskBudget   uint64 `default:"5242880" yaml:"per_file_disk_budget"`
	PerServerDiskBudget uint64 `default:"209715200" yaml:"per_server_disk_budget"`
	MaintenanceInterval uint64 `default:"3600" yaml:"maintenance_interval"`
}

FileHistory configures compressed, per-server file revision storage.

type HostTerminalConfiguration added in v1.0.4

type HostTerminalConfiguration struct {
	// Enabled toggles whether the host terminal websocket is available.
	Enabled bool `default:"true" yaml:"enabled"`

	// Shell specifies the shell executable to launch for terminal sessions.
	Shell string `default:"/bin/bash" yaml:"shell"`

	// DisabledCommands is a list of commands (full command or executable name) that cannot be executed.
	DisabledCommands []string `yaml:"disabled_commands"`
}

HostTerminalConfiguration defines settings for exposing a host shell.

type JoinBootstrap added in v1.4.0

type JoinBootstrap struct {
	UUID    string `yaml:"uuid"`
	TokenID string `yaml:"token_id"`
	Token   string `yaml:"token"`
	Remote  string `yaml:"remote"`
	Api     struct {
		Port int `yaml:"port"`
	} `yaml:"api"`
	RemoteQuery RemoteQueryConfiguration `yaml:"remote_query"`
}

JoinBootstrap is the minimal YAML embedded in panel join-data. FeatherWings uses it to authenticate against GET /api/remote/config and write the runtime config.

func ParseJoinBootstrap added in v1.4.0

func ParseJoinBootstrap(raw []byte) (*JoinBootstrap, error)

ParseJoinBootstrap decodes bootstrap YAML from join-data.

func (*JoinBootstrap) ValidateJoin added in v1.4.0

func (b *JoinBootstrap) ValidateJoin() error

ValidateJoin ensures the bootstrap contains enough data to contact the panel.

type OAuth2DevicePollResult added in v1.4.0

type OAuth2DevicePollResult struct {
	Status      string
	Interval    int
	Credentials *OAuth2DeviceTokenResponse
}

OAuth2DevicePollResult reports the state of a device token poll.

func PollOAuth2Device added in v1.4.0

func PollOAuth2Device(ctx context.Context, baseURL, deviceCode string, allowInsecure bool) (*OAuth2DevicePollResult, error)

PollOAuth2Device polls the callback-less OAuth2 device flow until it is approved, denied, pending, or expired.

type OAuth2DeviceStartResponse added in v1.4.0

type OAuth2DeviceStartResponse struct {
	DeviceCode              string `json:"device_code"`
	UserCode                string `json:"user_code"`
	VerificationURI         string `json:"verification_uri"`
	VerificationURIComplete string `json:"verification_uri_complete"`
	ExpiresIn               int    `json:"expires_in"`
	Interval                int    `json:"interval"`
}

OAuth2DeviceStartResponse is returned by POST /api/user/api-clients/oauth2/device.

func StartOAuth2Device added in v1.4.0

func StartOAuth2Device(ctx context.Context, baseURL string, payload map[string]string, allowInsecure bool) (*OAuth2DeviceStartResponse, error)

StartOAuth2Device starts the callback-less OAuth2 device authorization flow.

type OAuth2DeviceTokenResponse added in v1.4.0

type OAuth2DeviceTokenResponse struct {
	TokenType         string `json:"token_type"`
	PublicKey         string `json:"public_key"`
	PrivateKey        string `json:"private_key"`
	AuthorizationCode string `json:"authorization_code"`
	IssuedAt          string `json:"issued_at"`
}

OAuth2DeviceTokenResponse contains credentials returned after a device grant is approved.

type Overhead

type Overhead struct {
	// Override controls if the overhead limits should be overridden by the values in the config file.
	Override bool `default:"false" json:"override" yaml:"override"`

	// DefaultMultiplier sets the default multiplier for if no Multipliers are able to be applied.
	DefaultMultiplier float64 `default:"1.05" json:"default_multiplier" yaml:"default_multiplier"`

	// Multipliers allows overriding DefaultMultiplier depending on the amount of memory
	// configured for a server.
	//
	// Default values (used if Override is `false`)
	// - Less than 2048 MB of memory, multiplier of 1.15 (15%)
	// - Less than 4096 MB of memory, multiplier of 1.10 (10%)
	// - Otherwise, multiplier of 1.05 (5%) - specified in DefaultMultiplier
	//
	// If the defaults were specified in the config they would look like:
	// “`yaml
	// multipliers:
	//   2048: 1.15
	//   4096: 1.10
	// “`
	Multipliers map[int]float64 `json:"multipliers" yaml:"multipliers"`
}

Overhead controls the memory overhead given to all containers to circumvent certain software such as the JVM not staying below the maximum memory limit.

func (Overhead) GetMultiplier

func (o Overhead) GetMultiplier(memoryLimit int64) float64

type PBSBackups added in v1.4.0

type PBSBackups struct {
	// Enabled marks this node as capable of using PBS as a backup destination.
	// The panel reads this via Wings config to choose adapter "pbs" automatically.
	Enabled bool `default:"false" json:"enabled" yaml:"enabled"`

	// Repository is the PBS repository string, e.g.
	// "backup@pbs!token@pbs.example.com:datastore".
	// Alternative component fields below may be used instead.
	Repository string `json:"repository" yaml:"repository"`

	// Server, Port, Datastore, and AuthID are optional alternatives to Repository.
	Server    string `json:"server" yaml:"server"`
	Port      int    `json:"port" yaml:"port"`
	Datastore string `json:"datastore" yaml:"datastore"`
	AuthID    string `json:"auth_id" yaml:"auth_id"`

	// Password is the PBS user password or API token secret (PBS_PASSWORD).
	Password string `json:"password" yaml:"password"`

	// Fingerprint is an optional TLS certificate pin (PBS_FINGERPRINT). Leave empty
	// when the PBS cert is issued by a trusted CA (e.g. Let's Encrypt / ACME) —
	// proxmox-backup-client does not require it then, and pinning breaks on renewal.
	// Set only for self-signed or otherwise untrusted certificates.
	Fingerprint string `json:"fingerprint" yaml:"fingerprint"`

	// Namespace is the PBS namespace for FeatherPanel backups (default "featherpanel").
	Namespace string `default:"featherpanel" json:"namespace" yaml:"namespace"`

	// Binary is the proxmox-backup-client executable path/name.
	Binary string `default:"proxmox-backup-client" json:"binary" yaml:"binary"`

	// ArchiveName is the pxar archive name inside each snapshot (without path).
	// Defaults to root.pxar so PBS file browser matches PVE CT backups (root.pxar.didx).
	ArchiveName string `default:"root.pxar" json:"archive_name" yaml:"archive_name"`

	// ChangeDetectionMode is passed to proxmox-backup-client (--change-detection-mode).
	// "metadata" is recommended so unchanged files are not re-read when possible.
	ChangeDetectionMode string `default:"metadata" json:"change_detection_mode" yaml:"change_detection_mode"`

	// KeyFile is an optional client-side encryption key file path.
	KeyFile string `json:"keyfile" yaml:"keyfile"`

	// EncryptionPassword unlocks KeyFile when set (PBS_ENCRYPTION_PASSWORD).
	EncryptionPassword string `json:"encryption_password" yaml:"encryption_password"`
}

PBSBackups holds Proxmox Backup Client settings used by the "pbs" backup adapter.

type PanelAPI added in v1.4.0

type PanelAPI struct {
	BaseURL       string
	APIKey        string
	AllowInsecure bool
	HTTPClient    *http.Client
}

PanelAPI is a minimal FeatherPanel admin API client authenticated with an API key.

func NewPanelAPI added in v1.4.0

func NewPanelAPI(baseURL, apiKey string, allowInsecure bool) *PanelAPI

NewPanelAPI creates a panel API client with a normalized base URL.

func (*PanelAPI) CreateLocation added in v1.4.0

func (api *PanelAPI) CreateLocation(ctx context.Context, req CreatePanelLocationRequest) (*PanelLocation, error)

CreateLocation registers a game location via PUT /api/admin/locations.

func (*PanelAPI) CreateNode added in v1.4.0

func (api *PanelAPI) CreateNode(ctx context.Context, req CreatePanelNodeRequest) (*PanelNode, error)

CreateNode registers a new node via PUT /api/admin/nodes.

func (*PanelAPI) DeleteAPIClient added in v1.4.0

func (api *PanelAPI) DeleteAPIClient(ctx context.Context, id int) error

DeleteAPIClient removes an API key via DELETE /api/user/api-clients/{id}.

func (*PanelAPI) GetNodeJoinData added in v1.4.0

func (api *PanelAPI) GetNodeJoinData(ctx context.Context, nodeID int) (string, error)

GetNodeJoinData fetches base64 join-data from GET /api/admin/nodes/{id}/setup-command.

func (*PanelAPI) GetSystemSettings added in v1.4.0

func (api *PanelAPI) GetSystemSettings(ctx context.Context) (*PanelSystemInfo, error)

GetSystemSettings loads public panel settings from GET /api/system/settings.

func (*PanelAPI) ListGameLocations added in v1.4.0

func (api *PanelAPI) ListGameLocations(ctx context.Context) ([]PanelLocation, error)

ListGameLocations returns game locations from GET /api/admin/locations.

type PanelAPIClientInfo added in v1.4.0

type PanelAPIClientInfo struct {
	Valid     bool   `json:"valid"`
	ID        int    `json:"id"`
	Name      string `json:"name"`
	Username  string `json:"-"`
	UserEmail string `json:"-"`
}

PanelAPIClientInfo is returned by POST /api/user/api-clients/validate.

func ValidateAPIClient added in v1.4.0

func ValidateAPIClient(ctx context.Context, baseURL, publicKey string, allowInsecure bool) (*PanelAPIClientInfo, error)

ValidateAPIClient checks that an API key is valid via POST /api/user/api-clients/validate.

type PanelAPIError added in v1.4.0

type PanelAPIError struct {
	Message string
	Code    string
	Data    json.RawMessage
}

PanelAPIError is an API-level error returned by the panel envelope.

func (*PanelAPIError) Error added in v1.4.0

func (e *PanelAPIError) Error() string

type PanelConfiguration added in v1.4.3

type PanelConfiguration struct {
	Debug   bool   `json:"debug"`
	Uuid    string `json:"uuid"`
	TokenId string `json:"token_id"`
	Token   string `json:"token"`
	Api     struct {
		Host string `json:"host"`
		Port int    `json:"port"`
		Ssl  struct {
			Enabled         bool   `json:"enabled"`
			CertificateFile string `json:"cert"`
			KeyFile         string `json:"key"`
		} `json:"ssl"`
		UploadLimit int64 `json:"upload_limit"`
	} `json:"api"`
	System struct {
		Sftp struct {
			Port int `json:"bind_port"`
		} `json:"sftp"`
	} `json:"system"`
}

PanelConfiguration contains the only configuration values the Panel is allowed to set on a node. Everything else in the configuration controls how Wings itself runs on the host and must only be changed by the node operator.

type PanelLocation added in v1.4.0

type PanelLocation struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Short       string `json:"short"`
	Type        string `json:"type"`
	Description string `json:"description"`
	FlagCode    string `json:"flag_code"`
}

PanelLocation is a game server location from the panel.

type PanelNode added in v1.4.0

type PanelNode struct {
	ID            int    `json:"id"`
	UUID          string `json:"uuid"`
	Name          string `json:"name"`
	FQDN          string `json:"fqdn"`
	LocationID    int    `json:"location_id"`
	DaemonTokenID string `json:"daemon_token_id"`
	DaemonToken   string `json:"daemon_token"`
	DaemonListen  int    `json:"daemonListen"`
	DaemonType    string `json:"daemon_type"`
	PublicIPv4    string `json:"public_ip_v4"`
}

PanelNode is the node payload returned when creating a node.

type PanelSystemInfo added in v1.4.0

type PanelSystemInfo struct {
	AppName     string
	AppURL      string
	AppVersion  string
	CoreVersion string
	Hostname    string
}

PanelSystemInfo contains public panel metadata from GET /api/system/settings.

type RegistryConfiguration

type RegistryConfiguration struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

RegistryConfiguration defines the authentication credentials for a given Docker registry.

func (RegistryConfiguration) Base64

func (c RegistryConfiguration) Base64() (string, error)

Base64 returns the authentication for a given registry as a base64 encoded string value.

type RemoteQueryConfiguration

type RemoteQueryConfiguration struct {
	// The amount of time in seconds that Wings should allow for a request to the Panel API
	// to complete. If this time passes the request will be marked as failed. If your requests
	// are taking longer than 30 seconds to complete it is likely a performance issue that
	// should be resolved on the Panel, and not something that should be resolved by upping this
	// number.
	Timeout int `default:"30" yaml:"timeout"`

	// The number of servers to load in a single request to the Panel API when booting the
	// Wings instance. A single request is initially made to the Panel to get this number
	// of servers, and then the pagination status is checked and additional requests are
	// fired off in parallel to request the remaining pages.
	//
	// It is not recommended to change this from the default as you will likely encounter
	// memory limits on your Panel instance. In the grand scheme of things 4 requests for
	// 50 servers is likely just as quick as two for 100 or one for 400, and will certainly
	// be less likely to cause performance issues on the Panel.
	BootServersPerPage int `default:"50" yaml:"boot_servers_per_page"`

	// CustomHeaders is a map of custom headers that will be included in all requests
	// made to the Panel API. This is useful for authentication with services like
	// Cloudflare Access using service tokens (e.g., CF-Access-Client-Id and CF-Access-Client-Secret).
	CustomHeaders map[string]string `yaml:"custom_headers"`
}

RemoteQueryConfiguration defines the configuration settings for remote requests from Wings to the Panel.

type RuntimeReconciliationConfiguration added in v1.4.0

type RuntimeReconciliationConfiguration struct {
	// Enabled turns on the periodic runtime reconciliation cron. Defaults to true.
	Enabled bool `default:"true" json:"enabled" yaml:"enabled"`

	// IntervalSeconds is how often each server is checked. Defaults to 30s.
	IntervalSeconds int `default:"30" json:"interval_seconds" yaml:"interval_seconds"`

	// InspectTimeoutSeconds bounds ContainerInspect / IsRunning probes used by
	// reconciliation. If Docker hangs past this, the runtime is treated as unresponsive.
	InspectTimeoutSeconds int `default:"5" json:"inspect_timeout_seconds" yaml:"inspect_timeout_seconds"`

	// StuckStoppingSeconds is how long a server may remain in "stopping" before
	// Wings forces recovery. Should exceed the normal power stop wait (10m).
	StuckStoppingSeconds int `default:"720" json:"stuck_stopping_seconds" yaml:"stuck_stopping_seconds"`

	// StuckStartingSeconds is how long a server may remain in "starting" while
	// Docker is unresponsive before Wings marks it as a runtime error. Responsive
	// Docker with a long boot is ignored — slow games are normal.
	StuckStartingSeconds int `default:"300" json:"stuck_starting_seconds" yaml:"stuck_starting_seconds"`

	// UnresponsiveThreshold is consecutive inspect failures required before a
	// server is marked as a runtime error and recovered.
	UnresponsiveThreshold int `default:"2" json:"unresponsive_threshold" yaml:"unresponsive_threshold"`

	// RecoveryCooldownSeconds is the minimum time between automatic recoverRuntime
	// attempts for a server. Prevents terminate/destroy storms when Docker stays hung.
	// Force-reconcile ignores this. Defaults to 300s (5 minutes).
	RecoveryCooldownSeconds int `default:"300" json:"recovery_cooldown_seconds" yaml:"recovery_cooldown_seconds"`
}

RuntimeReconciliationConfiguration controls detection and recovery of Docker runtime desynchronization (FeatherPanel#199).

type SearchRecursion

type SearchRecursion struct {
	// BlacklistedDirs is a list of directory names that should be excluded from the recursion.
	BlacklistedDirs []string `` /* 139-byte string literal not displayed */

	// MaxRecursionDepth specifies the maximum depth for directory recursion.
	MaxRecursionDepth int `default:"8" yaml:"max_recursion_depth" json:"max_recursion_depth"`
}

SearchRecursion holds the configuration for directory search recursion settings.

type SentryConfiguration added in v1.4.0

type SentryConfiguration struct {
	// Enabled controls whether the SDK is initialized. When false, no events are sent.
	Enabled bool `default:"true" json:"enabled" yaml:"enabled"`

	// Dsn is the Sentry/GlitchTip project DSN. An empty value disables reporting
	// even when Enabled is true.
	Dsn string `default:"https://293bbc3bca1d4f7b92d27e04fdda3fa8@error.mythical.systems/4" json:"dsn" yaml:"dsn"`

	// Environment is attached to every event (for example production or staging).
	Environment string `default:"production" json:"environment" yaml:"environment"`

	// TracesSampleRate is the fraction of transactions sent (0.0–1.0).
	// Keep this low in production to limit storage on self-hosted GlitchTip.
	TracesSampleRate float64 `default:"0.01" json:"traces_sample_rate" yaml:"traces_sample_rate"`
}

SentryConfiguration configures error reporting to GlitchTip or any Sentry-compatible backend. Ships enabled with the FeatherPanel default DSN; operators can point dsn at their own project or set enabled: false.

type SftpConfiguration

type SftpConfiguration struct {
	// The bind address of the SFTP server.
	Address string `default:"0.0.0.0" json:"bind_address" yaml:"bind_address"`
	// The bind port of the SFTP server.
	Port int `default:"2022" json:"bind_port" yaml:"bind_port"`
	// If set to true, no write actions will be allowed on the SFTP server.
	ReadOnly bool `default:"false" yaml:"read_only"`
	// The maximum number of connections a single user may have open at once, or
	// zero to use the default of 32.
	MaxConnectionsPerUser int `json:"-" yaml:"max_connections_per_user"`
	// The maximum number of connections from a single IP address, or IPv6 /64
	// network, that may be authenticating at once, or zero to use the default of
	// 16. Raise this if clients connect through a proxy, since they then all
	// appear to come from the address of the proxy.
	MaxAuthenticatingConnectionsPerIP int `json:"-" yaml:"max_authenticating_connections_per_ip"`

	// If set to true users won't be able to login using their password.
	KeyOnly bool `default:"false" yaml:"key_only"`

	// AllowConsoleShell permits interactive SSH (shell/PTY) access to the game console for anyone
	// who successfully authenticates on this listener. When false, the panel must include
	// "control.console" in SFTP validation permissions (file-only subusers cannot open a shell).
	AllowConsoleShell bool `default:"false" yaml:"allow_console_shell"`
}

SftpConfiguration defines the configuration of the internal SFTP server.

type StoragePoolConfiguration added in v1.4.0

type StoragePoolConfiguration struct {
	// Enabled signals that this node shares a common data volume with other nodes.
	Enabled bool `default:"false" yaml:"enabled"`

	// PoolName is a per-node identifier used to compare shared storage pool membership across nodes.
	PoolName string `yaml:"pool_name"`
}

type SystemConfiguration

type SystemConfiguration struct {
	// CheckInstallExitCode marks a server installation as failed when the install
	// script exits with a non-zero code, or the container wait reports an error.
	// It is disabled by default to keep the historic behaviour, where every
	// installation that ran to completion was reported to the Panel as successful.
	CheckInstallExitCode bool `default:"false" json:"check_install_exit_code" yaml:"check_install_exit_code"`

	// The root directory where all of the featherpanel data is stored at.
	RootDirectory string `default:"/var/lib/featherpanel" json:"-" yaml:"root_directory"`

	// Directory where logs for server installations and other wings events are logged.
	LogDirectory string `default:"/var/log/featherpanel" json:"-" yaml:"log_directory"`

	// Directory where the server data is stored at.
	Data string `default:"/var/lib/featherpanel/volumes" json:"-" yaml:"data"`

	// Directory where server archives for transferring will be stored.
	ArchiveDirectory string `default:"/var/lib/featherpanel/archives" json:"-" yaml:"archive_directory"`

	// Directory where local backups will be stored on the machine.
	BackupDirectory string `default:"/var/lib/featherpanel/backups" json:"-" yaml:"backup_directory"`

	// Directory where whole-node Wings backups are stored (outside volumes so they
	// are not exposed over SFTP).
	NodeBackupDirectory string `default:"/var/lib/featherpanel/wings_backup" json:"-" yaml:"node_backup_directory"`

	// Directory where per-server file revision databases are stored.
	DiffsDirectory string `default:"/var/lib/featherpanel/diffs" json:"-" yaml:"diffs_directory"`

	// TmpDirectory specifies where temporary files for featherpanel installation processes
	// should be created. This supports environments running docker-in-docker.
	TmpDirectory string `default:"/tmp/featherpanel" json:"-" yaml:"tmp_directory"`

	// The user that should own all of the server files, and be used for containers.
	Username string `default:"featherpanel" yaml:"username"`

	// The timezone for this Wings instance. This is detected by Wings automatically if possible,
	// and falls back to UTC if not able to be detected. If you need to set this manually, that
	// can also be done.
	//
	// This timezone value is passed into all containers created by Wings.
	Timezone string `yaml:"timezone"`

	// Definitions for the user that gets created to ensure that we can quickly access
	// this information without constantly having to do a system lookup.
	User struct {
		// Rootless controls settings related to rootless container daemons.
		Rootless struct {
			// Enabled controls whether rootless containers are enabled.
			Enabled bool `yaml:"enabled" default:"false"`
			// ContainerUID controls the UID of the user inside the container.
			// This should likely be set to 0 so the container runs as the user
			// running Wings.
			ContainerUID int `yaml:"container_uid" default:"0"`
			// ContainerGID controls the GID of the user inside the container.
			// This should likely be set to 0 so the container runs as the user
			// running Wings.
			ContainerGID int `yaml:"container_gid" default:"0"`
		} `yaml:"rootless"`

		Uid int `yaml:"uid"`
		Gid int `yaml:"gid"`

		// Passwd controls weather a passwd file is mounted in the container
		// at /etc/passwd to resolve missing user issues
		Passwd     bool   `json:"mount_passwd" yaml:"mount_passwd" default:"true"`
		PasswdFile string `json:"passwd_file" yaml:"passwd_file" default:"/etc/featherpanel/passwd"`
	} `yaml:"user"`

	// MachineID controls the mounting of a generated `/etc/machine-id` file into containers started by Wings.
	MachineID struct {
		// Enable controls whether a generated machine-id file should be mounted
		// into containers.
		//
		// By default this option is enabled and Wings will mount an additional
		// machine-id file into containers.
		Enable bool `yaml:"enabled" default:"true"`

		// Directory is the directory on disk where the generated machine-id files will be stored.
		// This directory may be temporary as it will be re-created whenever Wings is started.
		//
		// This path **WILL** be both written to by Wings and mounted into containers created by
		// Wings. If you are running Wings itself in a container, this path will need to be mounted
		// into the Wings container as the exact path on the host, which should match the value
		// specified here. If you are using SELinux, you will need to make sure this file has the
		// correct SELinux context in order for containers to use it.
		Directory string `yaml:"directory" default:"/run/wings/machine-id"`
	} `yaml:"machine_id"`

	// The amount of time in seconds that can elapse before a server's disk space calculation is
	// considered stale and a re-check should occur. DANGER: setting this value too low can seriously
	// impact system performance and cause massive I/O bottlenecks and high CPU usage for the Wings
	// process.
	//
	// Set to 0 to disable disk checking entirely. This will always return 0 for the disk space used
	// by a server and should only be set in extreme scenarios where performance is critical and
	// disk usage is not a concern.
	DiskCheckInterval int64 `default:"150" yaml:"disk_check_interval"`

	// Quotas define is quota management is enabled on the Data directory
	Quotas struct {
		Enabled bool `json:"enabled" yaml:"enabled" default:"false"`
	} `json:"quotas" yaml:"quotas"`

	// ActivitySendInterval is the amount of time that should ellapse between aggregated server activity
	// being sent to the Panel. By default this will send activity collected over the last minute. Keep
	// in mind that only a fixed number of activity log entries, defined by ActivitySendCount, will be sent
	// in each run.
	ActivitySendInterval int `default:"60" yaml:"activity_send_interval"`

	// ActivitySendCount is the number of activity events to send per batch.
	ActivitySendCount int `default:"100" yaml:"activity_send_count"`

	// StatusSyncInterval is how often (in seconds) Wings re-reports each server's power state to the
	// Panel. This keeps the Panel database accurate if a transition push was missed (daemon restart,
	// temporary Panel outage, etc). Set to 0 to disable. Defaults to 300 (5 minutes).
	StatusSyncInterval int `default:"300" yaml:"status_sync_interval"`

	// If set to true, file ownership for a server will be synced to the Wings user when the
	// process is booted (recursive chown). On large trees this can still take noticeable time;
	// chown is skipped for files that already match the configured uid/gid. Set false if external
	// tools do not modify ownership, or use a dedicated repair action when needed.
	CheckPermissionsOnBoot bool `default:"true" yaml:"check_permissions_on_boot"`

	// If set to false Wings will not attempt to write a log rotate configuration to the disk
	// when it boots and one is not detected.
	EnableLogRotate bool `default:"true" yaml:"enable_log_rotate"`

	// The number of lines to send when a server connects to the websocket.
	WebsocketLogCount int `default:"150" yaml:"websocket_log_count"`

	// FileCollaboration controls real-time collaborative file editing over the
	// server websocket (Yjs CRDT), compatible with Calagopus-style clients.
	FileCollaboration FileCollaboration `yaml:"file_collaboration"`

	// FileHistory controls Calagopus-compatible file revision snapshots.
	FileHistory FileHistory `yaml:"file_history"`

	Sftp SftpConfiguration `yaml:"sftp"`

	FastDL FastDLConfiguration `yaml:"fastdl"`

	CrashDetection CrashDetection `yaml:"crash_detection"`

	// The ammount of lines the activity logs should log on server crash
	CrashActivityLogLines int `default:"2" yaml:"crash_detection_activity_lines"`

	// HostTerminal controls interactive shell access to the host over websockets.
	HostTerminal HostTerminalConfiguration `yaml:"host_terminal"`

	Backups Backups `yaml:"backups"`

	Transfers Transfers `yaml:"transfers"`

	OpenatMode string `default:"auto" yaml:"openat_mode"`

	// Updates controls runtime update capabilities.
	Updates UpdateConfiguration `yaml:"updates"`
}

SystemConfiguration defines basic system configuration settings.

func (*SystemConfiguration) GetStatesPath

func (sc *SystemConfiguration) GetStatesPath() string

GetStatesPath returns the location of the JSON file that tracks server states.

type Token

type Token struct {
	ID    string
	Token string
}

type Transfers

type Transfers struct {
	// DownloadLimit imposes a Network I/O read limit when downloading a transfer archive.
	//
	// If the value is less than 1, the write speed is unlimited,
	// if the value is greater than 0, the write speed is the value in MiB/s.
	//
	// Defaults to 0 (unlimited)
	DownloadLimit int `default:"0" yaml:"download_limit"`

	// PerformChecksumChecks controls whether incoming transfer archives are validated
	// against the provided SHA-256 checksum.
	//
	// If set to false, the destination node will not enforce checksum verification –
	// the archive will be extracted as received and the checksum part (if present)
	// is ignored. This can be useful for trusted networks or debugging, but reduces
	// protection against corrupted or tampered archives.
	//
	// Defaults to false; set to true to enforce checksum validation.
	PerformChecksumChecks bool `default:"false" yaml:"perform_checksum_checks"`

	// StoragePool configures whether this node participates in a shared storage pool.
	StoragePool StoragePoolConfiguration `yaml:"storage_pool"`
}

type UpdateConfiguration added in v1.0.4

type UpdateConfiguration struct {
	// EnableURL controls whether URL driven self-updates are permitted.
	EnableURL bool `default:"true" yaml:"enable_url"`

	// AllowAPI controls whether the HTTP API may invoke self-updates.
	AllowAPI bool `default:"true" yaml:"allow_api"`

	// DisableChecksum skips checksum verification for all self-updates.
	DisableChecksum bool `default:"false" yaml:"disable_checksum"`

	// RestartCommand, when set, is executed after a successful self-update.
	RestartCommand string `default:"systemctl restart featherwings" yaml:"restart_command"`

	// RepoOwner defines the default GitHub repository owner used for self-updates.
	RepoOwner string `default:"mythicalltd" yaml:"repo_owner"`

	// RepoName defines the default GitHub repository name used for self-updates.
	RepoName string `default:"featherwings" yaml:"repo_name"`

	// GitHubBinaryTemplate defines the asset name template (supports {arch} placeholder).
	GitHubBinaryTemplate string `default:"wings_linux_{arch}" yaml:"github_binary_template"`

	// DefaultURL, when set, is used as the fallback direct download source for URL based updates.
	DefaultURL string `yaml:"default_url"`

	// DefaultSHA256 optionally provides a checksum for DefaultURL.
	DefaultSHA256 string `yaml:"default_sha256"`
}

UpdateConfiguration controls how binary updates are handled.

Jump to

Keyboard shortcuts

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