router

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: 79 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ReadHeaderTimeout is the time a client has to send the request headers.
	ReadHeaderTimeout = 10 * time.Second
	// IdleTimeout is the time an idle keep-alive connection is kept open.
	IdleTimeout = 2 * time.Minute
)

Timeouts for the HTTP server.

Functions

func Configure

func Configure(m *wserver.Manager, client remote.Client) *gin.Engine

Configure configures the routing infrastructure for this daemon instance.

func ExtractServer

func ExtractServer(c *gin.Context) *server.Server

ExtractServer returns the server instance from the gin context. If there is no server set in the context (e.g. calling from a controller not protected by ServerExists) this function will panic.

This function is deprecated. Use middleware.ExtractServer.

func NewServer added in v1.4.3

func NewServer(addr string, handler http.Handler, tlsConfig *tls.Config) *http.Server

NewServer returns an HTTP server for the handler with the timeouts used by Wings.

Types

type ConfigPatchRequest added in v1.0.7

type ConfigPatchRequest struct {
	Updates map[string]interface{} `json:"updates" binding:"required"` // Map of dot-notation paths to values, e.g. {"api.port": 8080, "system.root_directory": "/var/lib/featherpanel"}
	Restart bool                   `json:"restart,omitempty"`          // Whether to restart wings after update
}

ConfigPatchRequest defines the payload for patching specific config values using dot notation.

type ConfigPutRequest added in v1.0.7

type ConfigPutRequest struct {
	Content string `json:"content" binding:"required"` // Raw YAML content - the entire config file
	Restart bool   `json:"restart,omitempty"`          // Whether to restart wings after update
}

ConfigPutRequest defines the payload for replacing the entire configuration file.

type ConfigSchemaField added in v1.0.7

type ConfigSchemaField struct {
	Key         string              `json:"key"`
	Type        string              `json:"type"`
	Description string              `json:"description,omitempty"`
	Default     interface{}         `json:"default,omitempty"`
	Required    bool                `json:"required,omitempty"`
	Fields      []ConfigSchemaField `json:"fields,omitempty"` // For nested structures
}

ConfigSchemaField describes a single configuration field.

type ConfigSchemaResponse added in v1.0.7

type ConfigSchemaResponse struct {
	Fields []ConfigSchemaField `json:"fields"`
}

ConfigSchemaResponse provides a schema describing all configurable fields.

type ConfigUpdateResponse added in v1.0.7

type ConfigUpdateResponse struct {
	Applied      bool   `json:"applied"`
	Restarted    bool   `json:"restarted,omitempty"`
	ErrorMessage string `json:"error_message,omitempty"`
}

ConfigUpdateResponse conveys the outcome of a configuration update.

type DiagnosticsUploadResponse added in v1.0.4

type DiagnosticsUploadResponse struct {
	URL string `json:"url"`
}

DiagnosticsUploadResponse contains the URL to an uploaded diagnostics bundle.

type DockerPruneReport added in v1.0.4

type DockerPruneReport = image.PruneReport

DockerPruneReport mirrors the response from Docker image prune operations.

type ErrorResponse added in v1.0.4

type ErrorResponse struct {
	Error     string `json:"error"`
	RequestID string `json:"request_id,omitempty"`
}

ErrorResponse represents the common error payload returned by the API.

type FastDLConfigResponse added in v1.2.4

type FastDLConfigResponse struct {
	Enabled   bool   `json:"enabled"`
	Directory string `json:"directory"`
	URL       string `json:"url,omitempty"`
	// Command is a helper string showing how to use the FastDL URL
	// in a typical Source-engine based game (e.g. CS:GO, CS2, TF2).
	// Panels can display this directly to the user.
	Command string `json:"command,omitempty"`
}

FastDLConfigResponse represents the FastDL configuration for a server

type FileOperationAcceptedResponse added in v1.4.0

type FileOperationAcceptedResponse struct {
	Identifier string `json:"identifier"`
}

FileOperationAcceptedResponse identifies an asynchronous filesystem operation.

type FirewallRuleRequest added in v1.1.0

type FirewallRuleRequest struct {
	RemoteIP   string                  `json:"remote_ip" binding:"required"`
	ServerPort int                     `json:"server_port" binding:"required,min=1,max=65535"`
	Priority   int                     `json:"priority" binding:"min=0,max=10000"`
	Type       models.FirewallRuleType `json:"type" binding:"required,oneof=allow block"`
	Protocol   string                  `json:"protocol" binding:"omitempty,oneof=tcp udp"`
}

FirewallRuleRequest represents a request to create or update a firewall rule

type FirewallRuleResponse added in v1.1.0

type FirewallRuleResponse struct {
	Data models.FirewallRule `json:"data"`
}

FirewallRuleResponse represents a firewall rule in API responses

type FirewallRulesListResponse added in v1.1.0

type FirewallRulesListResponse struct {
	Data []models.FirewallRule `json:"data"`
}

FirewallRulesListResponse represents a list of firewall rules

type LetsEncryptUser added in v1.1.0

type LetsEncryptUser struct {
	Email        string
	Registration *registration.Resource
	// contains filtered or unexported fields
}

func (*LetsEncryptUser) GetEmail added in v1.1.0

func (u *LetsEncryptUser) GetEmail() string

func (*LetsEncryptUser) GetPrivateKey added in v1.1.0

func (u *LetsEncryptUser) GetPrivateKey() crypto.PrivateKey

func (LetsEncryptUser) GetRegistration added in v1.1.0

func (u LetsEncryptUser) GetRegistration() *registration.Resource

type ModuleConfigRequest added in v1.1.0

type ModuleConfigRequest struct {
	Config interface{} `json:"config" binding:"required"`
}

ModuleConfigRequest represents a configuration update request

type ModuleInfo added in v1.1.0

type ModuleInfo struct {
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Enabled     bool        `json:"enabled"`
	Config      interface{} `json:"config,omitempty"`
}

ModuleInfo represents module information in API responses

type ModuleListResponse added in v1.1.0

type ModuleListResponse struct {
	Data []ModuleInfo `json:"data"`
}

ModuleListResponse contains a list of modules

type RemoteDownloadAcceptedResponse added in v1.0.4

type RemoteDownloadAcceptedResponse struct {
	Identifier string `json:"identifier"`
}

RemoteDownloadAcceptedResponse returns the identifier for background downloads.

type RemoteShareAcceptedResponse added in v1.4.0

type RemoteShareAcceptedResponse struct {
	Identifier string `json:"identifier"`
}

RemoteShareAcceptedResponse returns the identifier for background shares.

type SelfUpdateRequest added in v1.0.4

type SelfUpdateRequest struct {
	Source          string `json:"source,omitempty"`
	RepoOwner       string `json:"repo_owner,omitempty"`
	RepoName        string `json:"repo_name,omitempty"`
	Version         string `json:"version,omitempty"`
	Force           bool   `json:"force,omitempty"`
	URL             string `json:"url,omitempty"`
	SHA256          string `json:"sha256,omitempty"`
	DisableChecksum bool   `json:"disable_checksum,omitempty"`
}

SelfUpdateRequest defines the payload for triggering a self-update through the API.

type SelfUpdateResponse added in v1.0.4

type SelfUpdateResponse struct {
	Message          string `json:"message"`
	Source           string `json:"source"`
	CurrentVersion   string `json:"current_version"`
	TargetVersion    string `json:"target_version,omitempty"`
	ChecksumSkipped  bool   `json:"checksum_skipped"`
	RestartTriggered bool   `json:"restart_triggered"`
}

SelfUpdateResponse conveys the outcome of a self-update attempt.

type ServerArchiveExtractRequest added in v1.4.0

type ServerArchiveExtractRequest struct {
	Root        string   `json:"root"`
	File        string   `json:"file"`
	Destination string   `json:"destination"`
	Entries     []string `json:"entries"`
}

ServerArchiveExtractRequest selects files/directories inside an archive to extract without unpacking the whole archive.

type ServerArchiveRequest added in v1.0.4

type ServerArchiveRequest struct {
	RootPath   string   `json:"root"`
	Files      []string `json:"files"`
	Name       string   `json:"name"`
	Extension  string   `json:"extension"`
	Format     string   `json:"format"`
	Foreground *bool    `json:"foreground"`
}

ServerArchiveRequest holds compression options.

type ServerArchiveResponse added in v1.0.4

type ServerArchiveResponse struct {
	filesystem.Stat
}

ServerArchiveResponse returns metadata for generated archives.

type ServerBackupCreateRequest added in v1.0.4

type ServerBackupCreateRequest struct {
	Adapter backup.AdapterType `json:"adapter" binding:"required,oneof=wings s3 pbs resumable"`
	UUID    string             `json:"uuid" binding:"required"`
	Ignore  string             `json:"ignore"`
}

ServerBackupCreateRequest defines the payload for creating a backup.

type ServerBackupDescriptor added in v1.0.4

type ServerBackupDescriptor struct {
	UUID      string `json:"uuid"`
	Name      string `json:"name"`
	Size      int64  `json:"size"`
	CreatedAt string `json:"created_at"`
	Path      string `json:"path"`
}

ServerBackupDescriptor describes a backup entry.

type ServerBackupListResponse added in v1.0.4

type ServerBackupListResponse struct {
	Data []ServerBackupDescriptor `json:"data"`
}

ServerBackupListResponse captures backups listed for a server.

type ServerBackupRestoreRequest added in v1.0.4

type ServerBackupRestoreRequest struct {
	Adapter           backup.AdapterType `json:"adapter" binding:"required,oneof=wings s3 pbs resumable"`
	TruncateDirectory bool               `json:"truncate_directory"`
	DownloadURL       string             `json:"download_url"`
	// Headers are optional request headers (e.g. a short-lived bearer token)
	// sent when fetching download_url.
	Headers map[string]string `json:"headers,omitempty"`
}

ServerBackupRestoreRequest configures restore operations.

type ServerChmodFile added in v1.0.4

type ServerChmodFile struct {
	File string `json:"file"`
	Mode string `json:"mode"`
}

ServerChmodFile describes a chmod action.

type ServerChmodRequest added in v1.0.4

type ServerChmodRequest struct {
	Root  string            `json:"root"`
	Files []ServerChmodFile `json:"files"`
}

ServerChmodRequest aggregates chmod actions.

type ServerCommandsRequest added in v1.0.4

type ServerCommandsRequest struct {
	Commands []string `json:"commands"`
}

ServerCommandsRequest contains commands to execute on a server.

type ServerCopyRequest added in v1.0.4

type ServerCopyRequest struct {
	Location string `json:"location"`
}

ServerCopyRequest describes a copy operation.

type ServerCreateDirectoryRequest added in v1.0.4

type ServerCreateDirectoryRequest struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

ServerCreateDirectoryRequest includes folder data.

type ServerDecompressRequest added in v1.0.4

type ServerDecompressRequest struct {
	RootPath   string `json:"root"`
	File       string `json:"file"`
	Foreground *bool  `json:"foreground"`
}

ServerDecompressRequest carries decompression data.

type ServerDeleteRequest added in v1.0.4

type ServerDeleteRequest struct {
	Root      string       `json:"root"`
	Files     []string     `json:"files"`
	UseTrash  bool         `json:"use_trash"`
	Permanent bool         `json:"permanent"`
	Trash     *TrashLimits `json:"trash,omitempty"`
}

ServerDeleteRequest describes deleted file targets.

type ServerDenyTokenRequest added in v1.0.4

type ServerDenyTokenRequest struct {
	JTIs []string `json:"jtis"`
}

ServerDenyTokenRequest lists websocket tokens.

type ServerExecRequest added in v1.4.0

type ServerExecRequest struct {
	Command        string `json:"command"`
	TimeoutSeconds int    `json:"timeout_seconds"`
}

ServerExecRequest runs a shell command inside the server Docker container.

type ServerExecResponse added in v1.4.0

type ServerExecResponse struct {
	ExitCode   int    `json:"exit_code"`
	Stdout     string `json:"stdout"`
	Stderr     string `json:"stderr"`
	DurationMs int64  `json:"duration_ms"`
	TimedOut   bool   `json:"timed_out"`
}

ServerExecResponse is the result of a container shell exec.

type ServerInstallLogResponse added in v1.0.4

type ServerInstallLogResponse struct {
	Data string `json:"data"`
}

ServerInstallLogResponse contains the installation log output.

type ServerLogResponse added in v1.0.4

type ServerLogResponse struct {
	Data []string `json:"data"`
}

ServerLogResponse encapsulates log lines.

type ServerPowerRequest added in v1.0.4

type ServerPowerRequest struct {
	Action      server.PowerAction `json:"action"`
	WaitSeconds int                `json:"wait_seconds"`
}

ServerPowerRequest defines a power action request body.

type ServerPullRemoteRequest added in v1.0.4

type ServerPullRemoteRequest struct {
	Directory  string `json:"directory,omitempty" binding:"required_without=RootPath"`
	RootPath   string `json:"root" binding:"required_without=Directory"`
	URL        string `json:"url" binding:"required"`
	FileName   string `json:"file_name"`
	UseHeader  bool   `json:"use_header"`
	Foreground bool   `json:"foreground"`
}

ServerPullRemoteRequest defines a remote transfer.

type ServerPullStatusResponse added in v1.0.4

type ServerPullStatusResponse struct {
	Downloads []*downloader.Download `json:"downloads"`
}

ServerPullStatusResponse returns active remote downloads.

type ServerRenameEntry added in v1.0.4

type ServerRenameEntry struct {
	To   string `json:"to"`
	From string `json:"from"`
}

ServerRenameEntry represents a rename operation payload.

type ServerRenameRequest added in v1.0.4

type ServerRenameRequest struct {
	Root  string              `json:"root"`
	Files []ServerRenameEntry `json:"files"`
}

ServerRenameRequest holds rename operations.

type ServerShareFileRequest added in v1.4.0

type ServerShareFileRequest struct {
	File       string `json:"file" binding:"required"`
	TTLDays    int    `json:"ttl_days" binding:"required"`
	Password   string `json:"password,omitempty"`
	DeleteKey  string `json:"delete_key,omitempty"`
	Token      string `json:"token,omitempty"`
	Foreground bool   `json:"foreground,omitempty"`
	Background bool   `json:"background,omitempty"`
}

ServerShareFileRequest shares a server file via temp uploads.

type ServerShareStatusResponse added in v1.4.0

type ServerShareStatusResponse struct {
	Shares []*sharer.Job `json:"shares"`
}

ServerShareStatusResponse returns active temp upload share jobs.

type ServerTransferRequest added in v1.0.4

type ServerTransferRequest struct {
	URL     string                  `json:"url" binding:"required"`
	Token   string                  `json:"token" binding:"required"`
	Backups []string                `json:"backups"`
	Server  installer.ServerDetails `json:"server"`
}

ServerTransferRequest defines the payload for initiating a server transfer.

type ServerTrashDeleteRequest added in v1.4.0

type ServerTrashDeleteRequest struct {
	IDs []string `json:"ids" binding:"required"`
}

ServerTrashDeleteRequest lists trash entry IDs to permanently delete.

type ServerTrashRestoreRequest added in v1.4.0

type ServerTrashRestoreRequest struct {
	IDs       []string `json:"ids" binding:"required"`
	Overwrite bool     `json:"overwrite"`
}

ServerTrashRestoreRequest lists trash entry IDs to restore.

type SystemBackupDestinationsResponse added in v1.4.0

type SystemBackupDestinationsResponse struct {
	DefaultAdapter string                `json:"default_adapter"`
	PBS            SystemPBSBackupStatus `json:"pbs"`
	// Resumable is true when the "resumable" adapter (Drive, OneDrive,
	// Dropbox sessions opened by the panel) is supported.
	Resumable bool `json:"resumable"`
}

SystemBackupDestinationsResponse reports available backup adapters on this node.

type SystemPBSBackupStatus added in v1.4.0

type SystemPBSBackupStatus struct {
	Enabled    bool   `json:"enabled"`
	Namespace  string `json:"namespace"`
	Configured bool   `json:"configured"`
}

SystemPBSBackupStatus is a sanitized PBS config summary (no secrets).

type SystemSummaryResponse added in v1.0.4

type SystemSummaryResponse struct {
	Architecture  string `json:"architecture"`
	CPUCount      int    `json:"cpu_count"`
	KernelVersion string `json:"kernel_version"`
	OS            string `json:"os"`
	Version       string `json:"version"`
	// Features lists optional capabilities, e.g. resumable_backup_upload.
	Features map[string]bool `json:"features"`
}

SystemSummaryResponse describes the short system response used for legacy clients.

type TrashLimits added in v1.4.0

type TrashLimits struct {
	MaxSizeBytes  int64 `json:"max_size_bytes"`
	RetentionDays int   `json:"retention_days"`
}

TrashLimits configures trash retention enforced by Wings.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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