Documentation ¶
Index ¶
Constants ¶
View Source
const ( ErrFailedToBuildSeedGetRequest = "failed to build get request for seed" // Currently only a single interface is supported and defaults to this value. In the future we // will probably want to support multiple interfaces (e.g. one for trusted mobile clients and another for federated servers) DefaultWireguardInterface = "wg0" )
View Source
const ( ErrDeviceAlreadySetup = "device already setup" ErrFailedToCreateSettings = "failed to create device settings" ErrFailedToGetSettings = "failed to get device settings" ErrFailedToSetSettings = "failed to save device settings" )
View Source
const ( RANDOM_BYTES_LENGTH = 16 ErrFailedToStoreSeed = "failed to create set request" )
Variables ¶
View Source
var CurrentStats *v1.SystemStats
View Source
var (
ErrNoStream = fmt.Errorf("no stream")
)
Functions ¶
func InitSecretSeed ¶
Types ¶
type Commander ¶
type Commander interface { SetStream(stream *connect.BidiStream[dv1.DaemonMessage, dv1.ServerMessage]) error CloseStream() }
type Containers ¶
type Containers interface { // SetSystemImage will update the image for a system container. SetSystemImage(cmd *dv1.SetSystemImageCommand) error // CheckForContainerUpdates will compare current system container images against the latest ones // available and return the result. CheckForContainerUpdates(ctx context.Context, logger chassis.Logger) ([]*v1.ImageVersion, error) // AutoUpdateContainers will check for and install any container updates on a schedule. It is // designed to be called at bootup. AutoUpdateContainers(logger chassis.Logger) // UpdateContainers will check for and install any container updates one time. UpdateContainers(ctx context.Context, logger chassis.Logger) error }
type Controller ¶
type Controller interface { Daemon OS Containers Device }
func NewController ¶
func NewController(logger chassis.Logger, broadcaster async.Broadcaster) Controller
type Daemon ¶
type Daemon interface { // ShutdownHost will shutdown the host machine running Home Cloud. ShutdownHost() error // RestartHost will restart the host machine running Home Cloud RestartHost() error // ChangeDaemonVersion will update the NixOS config with a new Daemon version // and switch to it. ChangeDaemonVersion(cmd *dv1.ChangeDaemonVersionCommand) error // AddMdnsHost adds a host to the avahi mDNS server managed by the daemon AddMdnsHost(hostname string) error // RemoveMdnsHost removes a host to the avahi mDNS server managed by the daemon RemoveMdnsHost(hostname string) error // UploadFileStream will stream a file in chunks as an upload to the daemon UploadFileStream(ctx context.Context, logger chassis.Logger, buf io.Reader, fileId, fileName string) (string, error) }
type Device ¶
type Device interface { // GetServerSettings returns the current server settings after filtering out the // admin username and password. GetServerSettings(ctx context.Context) (*v1.DeviceSettings, error) // SetServerSettings updates the settings on the server with the given values SetServerSettings(ctx context.Context, logger chassis.Logger, settings *v1.DeviceSettings) error // IsDeviceSetup checks if the device is already setup by checking if the DEFAULT_DEVICE_SETTINGS_KEY key exists in the key-value store // with the default settings model IsDeviceSetup(ctx context.Context) (bool, error) // InitializeDevice initializes the device with the given settings. It first checks if the device is already setup // Uses the user-provided password to set the password for the "admin" user on the device // and save the remaining settings in the key-value store InitializeDevice(ctx context.Context, logger chassis.Logger, settings *v1.DeviceSettings) error // Login receives a username and password and returns a token. // // NOTE: the token is unimplemented so this only checks the validity of the password for now Login(ctx context.Context, username, password string) (string, error) }
type OS ¶
type OS interface { // CheckForOSUpdates will run the Nix commands to check for any NixOS updates to install. CheckForOSUpdates(ctx context.Context, logger chassis.Logger) (*v1.CheckForSystemUpdatesResponse, error) // InstallOSUpdate will install the update (if any) generated by CheckForOSUpdates. InstallOSUpdate() error // AutoUpdateOS will check for and install any OS (including Daemon) updates on a schedule. It is // designed to be called at bootup. AutoUpdateOS(logger chassis.Logger) // UpdateOS will check for and install any OS (including Daemon) updates one time. UpdateOS(ctx context.Context, logger chassis.Logger) error // EnableWireguard will initialize the Wireguard server on the host and save the configuration to Blueprint EnableWireguard(ctx context.Context, logger chassis.Logger) error // DisableWireguard will disable the Wireguard server on the host and delete the configuration from Blueprint DisableWireguard(ctx context.Context, logger chassis.Logger) error }
type Server ¶
type Server interface { chassis.RPCRegistrar sdConnect.DaemonStreamServiceHandler }
Click to show internal directories.
Click to hide internal directories.