interfaces

package module
v0.4.27 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

README

CasaOS-Common

Not affiliated with IceWhale. An independent, community-maintained distribution of CasaOS, not produced or endorsed by Shanghai IceWhale Technology Limited. CASAOS is their trademark, used here only to say what this is a release of. The original project is IceWhaleTech/CasaOS; report problems with this distribution at ReCasaOS/CasaOS/issues.

Common structs and functions shared by the components of the ReCasaOS: the JWT helpers the services authenticate each other with, the logger, the shared error codes and models, the systemd and command helpers, and the small clients each component uses to reach the others.

Why this fork exists

Every other component of this distribution was already forked; this library was not. Its six consumers each pinned a different IceWhale alpha — from v0.4.4-alpha2 to v0.4.11-alpha4 — of a module nobody here could patch. Nothing was broken: those versions are immutable on proxy.golang.org and would keep building even if the upstream repository disappeared. What was missing was the ability to fix a bug in shared authentication code, which is most of what this library contains.

This fork starts at upstream v0.4.21, unchanged apart from the module path, which is now github.com/ReCasaOS/CasaOS-Common. The six components are unified on it, where before each carried its own version.

Install

Components are not installed individually. The whole distribution is installed and upgraded with one command:

curl -fsSL https://github.com/ReCasaOS/CasaOS-Install/releases/latest/download/install.sh | sudo bash

What a release contains, and how it is built, is described in CasaOS-Install.

Development

go build ./...
go test ./...

No code generation, no network access at build time, no build tags. The module targets Go 1.21.

Licence

Apache License 2.0 — see LICENSE, which is the stock text; the per-file IceWhale copyright notices in the source are kept, as the licence requires.

CasaOS is the work of IceWhale and its contributors. CasaOS is a mark of IceWhale; this distribution uses the name to say what it is a release of, and nothing more. This fork is not affiliated with IceWhale and claims no endorsement by it.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MigrationTool

type MigrationTool interface {
	IsMigrationNeeded() (bool, error)
	PreMigrate() error
	Migrate() error
	PostMigrate() error
}

Any logic to migrate data from previous version to current can implement this interface.

The model for migrating from v0.n to v0.m is an execution chain of each version of this migration tool:

START -> migration-tool-v0.n -> migration-tool-v0.n+1 -> ... -> migration-tool-v0.m -> END

Therefore, each migration tool in the chain SHOULD ONLY work on data such as config files and databases. It is responsibility of any install/setup script to control the services because it knows when migration starts and ends.

!!!IMPORTANT!!! DO NOT stop, start, enable or disable services, because the whole execution chain might not have been completed.

Directories

Path Synopsis
codegen
mod_management
Package mod_management provides primitives to interact with the openapi HTTP API.
Package mod_management provides primitives to interact with the openapi HTTP API.
The commmon package provides structs and functions for external code to interact with this gateway service.
The commmon package provides structs and functions for external code to interact with this gateway service.
notify
@Author: LinkLeong link@icewhale.com
@Author: LinkLeong link@icewhale.com
pkg
http
methods in this package automatically include a context with a timeout, in order to solve the problem of hanging requests and to avoid goroutine leaks
methods in this package automatically include a context with a timeout, in order to solve the problem of hanging requests and to avoid goroutine leaks
jwt
ssh

Jump to

Keyboard shortcuts

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