Versions in this module Expand all Collapse all v1 v1.0.39 Oct 28, 2026 Changes in this version + const LabelInstallation + var ErrNoClient = errors.New("docker: no client available") + var ErrTransitionInFlight = errors.New("server transition already in progress") + var ErrTransitionServerID = errors.New("server transition requires a server ID") + var ErrUnknownNode = errors.New("docker: unknown node") + func ApplyDiskQuota(hostConfig *container.HostConfig, diskMB int64) + func LoadOrCreateInstallationID(dataDir string) (string, error) + func SetTransitionWarner(fn func(format string, args ...any)) + func TransitionDebug(serverID string) string type Client + func (c *Client) IsRemote() bool + func (c *Client) SetRestartPolicy(ctx context.Context, containerID string, policy container.RestartPolicy) error type ClientConfig + InstallationID string + type Executor interface + ExecCommand func(ctx context.Context, containerID string, command string) (string, error) type HibernationManager + func (m *HibernationManager) SetFreezerResolver(resolver func(nodeID string) ContainerFreezer) + type Locator struct + func NewExecutorLocator(pool *ClientPool, local Executor, store NodeStore) *Locator + func NewLocator(pool *ClientPool, local *Client, store NodeStore) *Locator + func (l *Locator) ExecutorFor(ctx context.Context, nodeID string) (Executor, error) + func (l *Locator) For(ctx context.Context, nodeID string) (*Client, error) + func (l *Locator) IsLocal(ctx context.Context, nodeID string) (bool, error) + type ReconcileOptions struct + PurgeOrphans bool type SleepController + SetRestartPolicy func(ctx context.Context, containerID string, policy container.RestartPolicy) error + type Transition struct + func (t *Transition) Done() <-chan struct{} + func (t *Transition) Release() + func (t *Transition) ServerID() string v1.0.38 Oct 20, 2026 Changes in this version + const DefaultMinecraftPort + const DefaultRCONPort + const DefaultStopWindow + const MaxStopWindow + const RCONPortOffset + var DefaultRestartPolicy = container.RestartPolicy + var ErrContainerNotResolved = fmt.Errorf("no matching docker container found") + var ErrDockerDevicesNotAllowed = errors.New("docker overrides must not request host device mappings") + var ErrDockerNetworkModeNotAllowed = errors.New("docker network mode is not allowed") + var ErrDockerVolumeOutsideSafeRoot = errors.New("docker volume source is outside the allowed roots") + var ErrElevatedDockerPermissionRequired = errors.New(...) + func ApplyOverrides(overrides *v1.DockerOverrides, config *container.Config, ...) + func EndServerTransition(serverID string) + func FilterEligibleNodes(nodes []*models.Node, reqMemoryMB int64) []*models.Node + func GetOptimalDockerTag(mcVersion string, modLoader models.ModLoader, preferGraalVM bool) string + func GetRequiredJavaVersion(mcVersion string, modLoader models.ModLoader) string + func IsPrivilegedDockerOverride(overrides *v1.DockerOverrides) bool + func ModuleSafeRoots(serverDataPath, backupDir string) []string + func NewAPIClient(opts ...client.Opt) (*client.Client, error) + func PrivilegedOverrideFields(overrides *v1.DockerOverrides) map[string]any + func ReconcileAndCleanupContainers(ctx context.Context, store ReconcileStore, dockerClient *Client, ...) error + func SelectLeastMemory(eligible []*models.Node) *models.Node + func SelectLeastServers(eligible []*models.Node) *models.Node + func ServerOverrideSafeRoots(serverDataPath string) []string + func ServerTransitionInFlight(serverID string) bool + func StopTimeoutSeconds(window time.Duration) int + func StopWindow(cfg *models.ServerConfig) time.Duration + func TranslateToHostPath(path string) string + func TryBeginServerTransition(serverID string) bool + func ValidateDockerDevices(devices []string) error + func ValidateDockerNetworkMode(mode string) error + func ValidateDockerOverrides(overrides *v1.DockerOverrides, allowPrivileged bool) error + func ValidateDockerOverridesConfinement(overrides *v1.DockerOverrides, safeRoots ...string) error + func ValidateDockerVolumeOverrides(volumes []*v1.VolumeMount, safeRoots ...string) error + func ValidateJVMOptions(opts string) error + func ValidateModuleVolumeMounts(volumes []ModuleVolumeMount, safeRoots ...string) error + func ValidateVolumeSource(source, mountType string, safeRoots ...string) error + func WaitForServerTransition(ctx context.Context, serverID string) error + type Client struct + func NewClient(host string, log *logger.Logger, config ...ClientConfig) (*Client, error) + func NewClientForNode(node *models.Node, log *logger.Logger, baseConfig ClientConfig) (*Client, error) + func (c *Client) Close() error + func (c *Client) CreateContainer(ctx context.Context, server *models.Server, serverConfig *models.ServerConfig) (string, error) + func (c *Client) CreateModuleContainer(ctx context.Context, module *models.Module, template *models.ModuleTemplate, ...) (string, error) + func (c *Client) DetectContainerJavaVersion(ctx context.Context, containerID string) (int, error) + func (c *Client) EnsureNetwork() error + func (c *Client) Exec(ctx context.Context, containerID string, execCmd []string) (string, error) + func (c *Client) ExecCommand(ctx context.Context, containerID string, command string) (string, error) + func (c *Client) GetAllocatedHostPorts(ctx context.Context) (map[int]bool, error) + func (c *Client) GetConfig() ClientConfig + func (c *Client) GetContainerStats(ctx context.Context, containerID string) (*ContainerStats, error) + func (c *Client) GetContainerStatus(ctx context.Context, containerID string) (models.ServerStatus, error) + func (c *Client) GetDockerClient() *client.Client + func (c *Client) GetDockerImages() []DockerImageTag + func (c *Client) GetFirewallManager() *FirewallManager + func (c *Client) GetModuleContainerIP(ctx context.Context, containerID string) (string, error) + func (c *Client) HostMemoryMB(ctx context.Context) (int64, error) + func (c *Client) ObserveContainer(ctx context.Context, containerID string) (*ContainerState, error) + func (c *Client) PauseContainer(ctx context.Context, containerID string) error + func (c *Client) Ping(ctx context.Context) (client.PingResult, error) + func (c *Client) RecreateContainer(ctx context.Context, oldContainerID string, server *models.Server, ...) (*RecreateContainerResult, error) + func (c *Client) RemoveContainer(ctx context.Context, containerID string) error + func (c *Client) ResolveContainer(ctx context.Context, serverID string) (*container.Summary, error) + func (c *Client) ResolveModuleContainer(ctx context.Context, moduleID string) (*container.Summary, error) + func (c *Client) RestartContainer(ctx context.Context, containerID string, delay time.Duration) error + func (c *Client) SetLogStreamer(ls ContainerLogStreamer) + func (c *Client) SetProxyEnabled(enabled bool) + func (c *Client) StartContainer(ctx context.Context, containerID string) error + func (c *Client) StopContainer(ctx context.Context, containerID string) (bool, error) + func (c *Client) StopContainerWithin(ctx context.Context, containerID string, window time.Duration) (bool, error) + func (c *Client) UnpauseContainer(ctx context.Context, containerID string) error + type ClientConfig struct + APIVersion string + DNS string + EnableRateLimit bool + Labels map[string]string + NetworkMTU int + NetworkName string + ProxyEnabled bool + RateLimitBurst int + RateLimitPerMin int + RegistryURL string + type ClientPool struct + func NewClientPool(store NodeStore, defaultClient *Client, log *logger.Logger, ...) *ClientPool + func (p *ClientPool) Close() error + func (p *ClientPool) GetClient(nodeID string) (*Client, error) + func (p *ClientPool) GetClientStrict(nodeID string) (*Client, error) + func (p *ClientPool) GetDefaultClient() *Client + func (p *ClientPool) GetDefaultNodeID() string + func (p *ClientPool) GetHostMemoryMB(ctx context.Context, nodeID string) (int64, error) + func (p *ClientPool) IsFallbackEnabled() bool + func (p *ClientPool) PingNode(ctx context.Context, nodeID string) (bool, error) + func (p *ClientPool) RegisterClient(nodeID string, cli *Client) + func (p *ClientPool) RemoveNode(nodeID string) error + func (p *ClientPool) SetFallbackEnabled(enabled bool) + func (p *ClientPool) SetProxyEnabled(enabled bool) + func (p *ClientPool) StartHealthChecker(interval time.Duration) + func (p *ClientPool) Stats() PoolStats + func (p *ClientPool) StopHealthChecker() + type ContainerFreezer interface + GetContainerStatus func(ctx context.Context, containerID string) (db.ServerStatus, error) + PauseContainer func(ctx context.Context, containerID string) error + UnpauseContainer func(ctx context.Context, containerID string) error + type ContainerLogClientResolver struct + func NewContainerLogClientResolver(store ContainerLookup, pool *ClientPool) *ContainerLogClientResolver + func (r *ContainerLogClientResolver) ResolveLogClient(ctx context.Context, containerID string) (*client.Client, error) + type ContainerLogStreamer interface + MigrateSubscribers func(oldContainerID, newContainerID string) + RemoveContainer func(containerID string) + StartStreaming func(containerID string) error + StopStreaming func(containerID string) + type ContainerLookup interface + GetServerByContainerID func(ctx context.Context, containerID string) (*models.Server, error) + type ContainerState struct + ContainerID string + ExitCode int + HasExited bool + OOMKilled bool + Running bool + Status models.ServerStatus + type ContainerStats struct + CPUPercent float64 + MemoryLimit float64 + MemoryUsage float64 + type DeepSleepManager struct + func NewDeepSleepManager(controller SleepController, store SleeperStore, commander SleepCommander, ...) *DeepSleepManager + func (m *DeepSleepManager) CheckIdleServers(ctx context.Context) error + func (m *DeepSleepManager) IsAsleep(ctx context.Context, serverID string) bool + func (m *DeepSleepManager) IsTransitioning(serverID string) bool + func (m *DeepSleepManager) RecordActivity(serverID string) + func (m *DeepSleepManager) SetControllerResolver(resolver SleepControllerResolver) + func (m *DeepSleepManager) SetPlayerCountProvider(provider func(serverID string) int) + func (m *DeepSleepManager) SetWakePreparer(preparer WakePreparer) + func (m *DeepSleepManager) SleepServer(ctx context.Context, serverID string) error + func (m *DeepSleepManager) Start(ctx context.Context, checkInterval time.Duration) + func (m *DeepSleepManager) Stop() + func (m *DeepSleepManager) WakeServer(ctx context.Context, serverID string) error + type DockerCandidate struct + Host string + LatencyMs int64 + Port int + Reachable bool + Source string + func DetectDockerDaemons(ctx context.Context) []DockerCandidate + type DockerImageTag struct + Architectures []string + Deprecated bool + Distribution string + JDK bool + JVM string + Java string + LTS bool + Notes string + Tag string + type FirewallManager struct + func NewFirewallManager(log *logger.Logger, enabled bool, rateMin, burst int) *FirewallManager + func (f *FirewallManager) ApplyPortRateLimiting(ctx context.Context, port int, ratePerMin, burst int) error + func (f *FirewallManager) ApplyProxyPortIsolation(ctx context.Context, port int) error + func (f *FirewallManager) BuildIsolationRules(port int) [][]string + func (f *FirewallManager) BuildPortRules(port int, ratePerMin, burst int) [][]string + func (f *FirewallManager) RemovePortRateLimiting(ctx context.Context, port, ratePerMin, burst int) error + func (f *FirewallManager) RemoveProxyPortIsolation(ctx context.Context, port int) error + type FreezerStore interface + GetServer func(ctx context.Context, id string) (*db.Server, error) + ListServers func(ctx context.Context) ([]*db.Server, error) + UpdateServer func(ctx context.Context, server *db.Server) error + UpdateServerStatus func(ctx context.Context, id string, status db.ServerStatus) error + type HibernationManager struct + func NewHibernationManager(freezer ContainerFreezer, store FreezerStore, log *logger.Logger) *HibernationManager + func (m *HibernationManager) CheckIdleServers(ctx context.Context) error + func (m *HibernationManager) HibernateServer(ctx context.Context, serverID string) error + func (m *HibernationManager) IsHibernated(ctx context.Context, serverID string) bool + func (m *HibernationManager) RecordActivity(serverID string) + func (m *HibernationManager) RegisterWakeCallback(cb func(serverID string)) + func (m *HibernationManager) SetPlayerCountProvider(provider func(serverID string) int) + func (m *HibernationManager) Start(ctx context.Context, checkInterval time.Duration) + func (m *HibernationManager) Stop() + func (m *HibernationManager) TotalHibernated() uint64 + func (m *HibernationManager) TotalWoken() uint64 + func (m *HibernationManager) WakeServer(ctx context.Context, serverID string) error + type ModuleVolumeMount struct + CreateDir bool + ReadOnly bool + Source string + Target string + Type string + type NodeStore interface + GetNode func(ctx context.Context, id string) (*models.Node, error) + ListNodes func(ctx context.Context) ([]*models.Node, error) + UpdateNode func(ctx context.Context, node *models.Node) error + type PlacementEngine struct + func NewPlacementEngine(store PlacementStore) *PlacementEngine + func (e *PlacementEngine) SelectNode(ctx context.Context, strategy PlacementStrategy, reqMemoryMB int64) (*models.Node, error) + func (e *PlacementEngine) SelectRoundRobin(eligible []*models.Node) *models.Node + type PlacementStore interface + GetNodeStats func(ctx context.Context, nodeID string) (allocatedMemMB int64, serverCount int, runningCount int, err error) + ListNodes func(ctx context.Context) ([]*models.Node, error) + ListNodesWithStats func(ctx context.Context) ([]*models.Node, error) + type PlacementStrategy string + const StrategyLeastMemory + const StrategyLeastServers + const StrategyRoundRobin + type PoolStats struct + CacheHits uint64 + CacheMisses uint64 + CreateErrors uint64 + Fallbacks uint64 + TotalRequests uint64 + type ReconcileStore interface + ListModules func(ctx context.Context) ([]*db.Module, error) + ListServers func(ctx context.Context) ([]*db.Server, error) + UpdateModule func(ctx context.Context, module *db.Module) error + UpdateServer func(ctx context.Context, server *db.Server) error + type RecreateContainerResult struct + NewContainerID string + WasRunning bool + type RouteRefresher func(serverID string) + type SleepCommander interface + SendCommand func(ctx context.Context, serverID string, command string) (string, error) + type SleepController interface + GetContainerStatus func(ctx context.Context, containerID string) (db.ServerStatus, error) + StartContainer func(ctx context.Context, containerID string) error + StopContainer func(ctx context.Context, containerID string) (bool, error) + type SleepControllerResolver func(nodeID string) SleepController + type SleeperStore interface + GetServer func(ctx context.Context, id string) (*db.Server, error) + ListServers func(ctx context.Context) ([]*db.Server, error) + UpdateServer func(ctx context.Context, server *db.Server) error + UpdateServerStatus func(ctx context.Context, id string, status db.ServerStatus) error + type WakePreparer func(ctx context.Context, server *db.Server) error