Documentation
¶
Index ¶
- Constants
- func AddWireguardInterface(ctx context.Context, logger chassis.Logger, def *v1.AddWireguardInterface) error
- func AddWireguardPeer(ctx context.Context, logger chassis.Logger, peer *v1.WireguardPeer) error
- func BootConfigFile() string
- func ChangeDaemonVersion(ctx context.Context, logger chassis.Logger, def *v1.ChangeDaemonVersionCommand) error
- func ChunkPath() string
- func ConfigFile() string
- func DaemonLogs(ctx context.Context, logger chassis.Logger, sinceSeconds uint32) ([]*v1.Log, error)
- func DaemonNixFile() string
- func DataPath() string
- func DraftManifestFile() string
- func FilePath(paths ...string) string
- func GetDaemonVersion(logger chassis.Logger) (*v1.CurrentDaemonVersion, error)
- func GetNixOSVersion(ctx context.Context, logger chassis.Logger) (string, error)
- func GetOSVersionDiff(ctx context.Context, logger chassis.Logger) (string, error)
- func LineByLineReplace(filename string, replacers []Replacer) error
- func MigrationsFile() string
- func NetworkingConfigFile() string
- func NixosConfigFile() string
- func NixosConfigsPath() string
- func NixosVarsFile() string
- func OperatorManifestFile() string
- func RebuildAndSwitchOS(ctx context.Context, logger chassis.Logger) error
- func RemoveWireguardInterface(ctx context.Context, logger chassis.Logger, def *v1.RemoveWireguardInterface) error
- func SaveSettings(ctx context.Context, logger chassis.Logger, def *v1.SaveSettingsCommand) error
- func SecurityConfigFile() string
- func ServerManifestFile() string
- func ServicesConfigFile() string
- func SetSystemImage(ctx context.Context, logger chassis.Logger, def *v1.SetSystemImageCommand) error
- func SystemStats(mounts []string) (*v1.SystemStats, error)
- func TimeConfigFile() string
- func UsersConfigFile() string
- func WireguardKeyPath() string
- func WriteJsonFile(path string, config any, perm fs.FileMode) error
- type BootConfig
- type BootConfigBCache
- type BootConfigLoader
- type BootConfigLoaderSystemdBoot
- type DNSPublisher
- type LocatorController
- type Migrator
- type NetworkingConfig
- type NetworkingConfigFirewall
- type NetworkingConfigNAT
- type NetworkingConfigNetworkManager
- type NetworkingConfigWireguard
- type NetworkingConfigWireless
- type Replacer
- type STUNClient
- type SecurityConfig
- type SecurityConfigSudo
- type ServicesConfig
- type ServicesConfigAvahi
- type ServicesConfigAvahiPublish
- type ServicesConfigK3s
- type ServicesConfigOpenSSH
- type ServicesConfigResolved
- type TimeConfig
- type User
- type UserOpenSSH
- type UserOpenSSHAuthorizedKeys
- type UsersConfig
- type WireGuardConfig
- type WireguardInterface
- type WireguardPeer
Constants ¶
const ( LocatorSettingsKey = "daemon.locatorSettings" WireguardConfigKey = "daemon.wireguard" )
const (
ComputeMeasurementDuration = 1 * time.Second
)
const (
DefaultFileMode = 0600
)
Variables ¶
This section is empty.
Functions ¶
func AddWireguardInterface ¶ added in v0.0.25
func AddWireguardPeer ¶ added in v0.0.28
func BootConfigFile ¶ added in v0.0.25
func BootConfigFile() string
func ChangeDaemonVersion ¶ added in v0.0.24
func ChangeDaemonVersion(ctx context.Context, logger chassis.Logger, def *v1.ChangeDaemonVersionCommand) error
TODO-RC2: There's a bit of a race condition with this right now. If you call GetOSVersionDiff and then call this method you'll accidentally upgrade the entire OS with any changes that were pulled in from the `nix-channel --update` that was run during GetOSVersionDiff. This can be avoided by running `nix-channel --rollback` but will require some stateful logic which checks if a rollback is really needed. It's out of scope for RC1 but should be revisited later.
func ConfigFile ¶ added in v0.0.24
func ConfigFile() string
func DaemonLogs ¶ added in v0.0.33
func DaemonNixFile ¶ added in v0.0.24
func DaemonNixFile() string
func DraftManifestFile ¶ added in v0.0.24
func DraftManifestFile() string
func FilePath ¶ added in v0.0.24
FilePath cleans the given path and makes it a local path by prefixing a "./tmp/" if the draft env is "test".
func GetDaemonVersion ¶ added in v0.0.24
func GetDaemonVersion(logger chassis.Logger) (*v1.CurrentDaemonVersion, error)
func GetNixOSVersion ¶ added in v0.0.30
func GetOSVersionDiff ¶ added in v0.0.24
func LineByLineReplace ¶ added in v0.0.24
LineByLineReplace will process all lines in the given file running all Replacers against each line.
NOTE: the Replacers will be run in the order they appear in the slice
func MigrationsFile ¶ added in v0.0.24
func MigrationsFile() string
func NetworkingConfigFile ¶ added in v0.0.25
func NetworkingConfigFile() string
func NixosConfigFile ¶ added in v0.0.24
func NixosConfigFile() string
func NixosConfigsPath ¶ added in v0.0.25
func NixosConfigsPath() string
func NixosVarsFile ¶ added in v0.0.25
func NixosVarsFile() string
func OperatorManifestFile ¶ added in v0.0.24
func OperatorManifestFile() string
func RebuildAndSwitchOS ¶ added in v0.0.24
NOTE: must call this after calling GetOSVersionDiff if you want to perform a channel update.
func RemoveWireguardInterface ¶ added in v0.0.25
func SaveSettings ¶ added in v0.0.24
func SecurityConfigFile ¶ added in v0.0.25
func SecurityConfigFile() string
func ServerManifestFile ¶ added in v0.0.24
func ServerManifestFile() string
func ServicesConfigFile ¶ added in v0.0.25
func ServicesConfigFile() string
func SetSystemImage ¶ added in v0.0.24
func SystemStats ¶ added in v0.0.10
func SystemStats(mounts []string) (*v1.SystemStats, error)
func TimeConfigFile ¶ added in v0.0.25
func TimeConfigFile() string
func UsersConfigFile ¶ added in v0.0.25
func UsersConfigFile() string
func WireguardKeyPath ¶ added in v0.0.25
func WireguardKeyPath() string
Types ¶
type BootConfig ¶ added in v0.0.25
type BootConfig struct { Loader BootConfigLoader `json:"loader"` BCache BootConfigBCache `json:"bcache"` }
type BootConfigBCache ¶ added in v0.0.25
type BootConfigBCache struct {
Enable bool `json:"enable"`
}
type BootConfigLoader ¶ added in v0.0.25
type BootConfigLoader struct {
SystemdBoot BootConfigLoaderSystemdBoot `json:"systemd-boot"`
}
type BootConfigLoaderSystemdBoot ¶ added in v0.0.25
type BootConfigLoaderSystemdBoot struct {
Enable bool `json:"enable"`
}
type DNSPublisher ¶ added in v0.0.16
type DNSPublisher interface { AddHost(ctx context.Context, hostname string) RemoveHost(hostname string) error Start() }
func NewDNSPublisher ¶ added in v0.0.16
func NewDNSPublisher(logger chassis.Logger) DNSPublisher
type LocatorController ¶ added in v0.0.28
type LocatorController interface { // Load will load all saved Locators from the config and create background connections to them. // Meant to be called at daemon startup. Load() // AddLocator will start a background connection to the given Locator and will serve up connection // information to locate requests from that Locator for all Wireguard interfaces. The Locator connection // can be killed by calling RemoveLocator or RemoveAll. AddLocator(ctx context.Context, locatorAddress string) (locator *dv1.Locator, err error) // RemoveLocator will remove a background Locator connection that was started through Load or // AddLocator and will delete it from the config. RemoveLocator(ctx context.Context, locatorAddress string) error // Disable will remove all background Locator connections and delete them from the config. Disable(ctx context.Context) error }
func NewLocatorController ¶ added in v0.0.28
func NewLocatorController(logger chassis.Logger, stun STUNClient) LocatorController
type Migrator ¶ added in v0.0.24
type Migrator interface {
Migrate()
}
func NewMigrator ¶ added in v0.0.24
type NetworkingConfig ¶ added in v0.0.25
type NetworkingConfig struct { Hostname string `json:"hostName"` Domain string `json:"domain"` NetworkManager NetworkingConfigNetworkManager `json:"networkmanager"` Wireless NetworkingConfigWireless `json:"wireless"` Firewall NetworkingConfigFirewall `json:"firewall"` NAT NetworkingConfigNAT `json:"nat"` Wireguard NetworkingConfigWireguard `json:"wireguard"` }
type NetworkingConfigFirewall ¶ added in v0.0.25
type NetworkingConfigFirewall struct {
Enable bool `json:"enable"`
}
type NetworkingConfigNAT ¶ added in v0.0.25
type NetworkingConfigNetworkManager ¶ added in v0.0.25
type NetworkingConfigNetworkManager struct {
Enable bool `json:"enable"`
}
type NetworkingConfigWireguard ¶ added in v0.0.25
type NetworkingConfigWireguard struct {
Interfaces map[string]WireguardInterface `json:"interfaces,omitempty"`
}
type NetworkingConfigWireless ¶ added in v0.0.25
type NetworkingConfigWireless struct {
Enable bool `json:"enable"`
}
type Replacer ¶ added in v0.0.24
Replacer take in a line in a file and outputs the replacement line (which could be the same if no change is needed)
type STUNClient ¶ added in v0.0.28
type STUNClient interface { // Bind restarts the STUN client using the given STUN server Bind(server string) (stun.XORMappedAddress, error) // Connect initializes a short period of connection attempts to the given STUN address of a peer. // This opens a hole in the NAT for inbound connection attempts from the peer. Connect(address net.Addr) }
func NewSTUNClient ¶ added in v0.0.28
func NewSTUNClient(logger chassis.Logger) STUNClient
type SecurityConfig ¶ added in v0.0.25
type SecurityConfig struct {
Sudo SecurityConfigSudo `json:"sudo"`
}
type SecurityConfigSudo ¶ added in v0.0.25
type SecurityConfigSudo struct {
WheelNeedsPassword bool `json:"wheelNeedsPassword"`
}
type ServicesConfig ¶ added in v0.0.25
type ServicesConfig struct { Resolved ServicesConfigResolved `json:"resolved"` K3s ServicesConfigK3s `json:"k3s"` OpenSSH ServicesConfigOpenSSH `json:"openssh"` Avahi ServicesConfigAvahi `json:"avahi"` }
type ServicesConfigAvahi ¶ added in v0.0.25
type ServicesConfigAvahi struct { Enable bool `json:"enable"` IPv4 bool `json:"ipv4"` IPv6 bool `json:"ipv6"` NSSmDNS4 bool `json:"nssmdns4"` Publish ServicesConfigAvahiPublish `json:"publish"` }
type ServicesConfigAvahiPublish ¶ added in v0.0.25
type ServicesConfigK3s ¶ added in v0.0.25
type ServicesConfigOpenSSH ¶ added in v0.0.25
type ServicesConfigOpenSSH struct {
Enable bool `json:"enable"`
}
type ServicesConfigResolved ¶ added in v0.0.25
type TimeConfig ¶ added in v0.0.25
type TimeConfig struct {
TimeZone string `json:"timeZone"`
}
type User ¶ added in v0.0.25
type User struct { IsNormalUser bool `json:"isNormalUser"` ExtraGroups []string `json:"extraGroups"` OpenSSH UserOpenSSH `json:"openssh"` }
type UserOpenSSH ¶ added in v0.0.25
type UserOpenSSH struct {
AuthorizedKeys UserOpenSSHAuthorizedKeys `json:"authorizedKeys"`
}
type UserOpenSSHAuthorizedKeys ¶ added in v0.0.25
type UserOpenSSHAuthorizedKeys struct {
Keys []string `json:"keys"`
}
type UsersConfig ¶ added in v0.0.25
type WireGuardConfig ¶ added in v0.0.28
type WireguardInterface ¶ added in v0.0.25
type WireguardInterface struct { IPs []string `json:"ips"` ListenPort uint32 `json:"listenPort"` PrivateKeyFile string `json:"privateKeyFile"` Peers []WireguardPeer `json:"peers"` }