profile

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// UDM profile for UniFi Dream Machine
	UDM = Profile{
		Name:          "udm",
		DataDir:       "/data/.dddns",
		ConfigPerm:    constants.ConfigFilePerm,
		SecurePerm:    constants.SecureConfigPerm,
		DirPerm:       constants.ConfigDirPerm,
		UseHardwareID: true,
		DeviceIDPath:  "/proc/ubnthal/system.info",
	}

	// Linux standard profile
	Linux = Profile{
		Name:          "linux",
		DataDir:       "$HOME/.dddns",
		ConfigPerm:    constants.ConfigFilePerm,
		SecurePerm:    constants.SecureConfigPerm,
		DirPerm:       constants.ConfigDirPerm,
		UseHardwareID: true,
		DeviceIDPath:  "/sys/class/net/eth0/address",
	}

	// MacOS profile
	MacOS = Profile{
		Name:          "macos",
		DataDir:       "$HOME/.dddns",
		ConfigPerm:    constants.ConfigFilePerm,
		SecurePerm:    constants.SecureConfigPerm,
		DirPerm:       constants.ConfigDirPerm,
		UseHardwareID: true,
		DeviceIDPath:  "system_profiler",
	}

	// Docker container profile
	Docker = Profile{
		Name:          "docker",
		DataDir:       "/config",
		ConfigPerm:    constants.ConfigFilePerm,
		SecurePerm:    constants.SecureConfigPerm,
		DirPerm:       constants.CacheDirPerm,
		UseHardwareID: true,
		DeviceIDPath:  "/proc/self/cgroup",
	}

	// Windows profile (AMD64 and ARM64)
	Windows = Profile{
		Name:          "windows",
		DataDir:       "$APPDATA/dddns",
		ConfigPerm:    0600,
		SecurePerm:    0400,
		DirPerm:       0700,
		UseHardwareID: true,
		DeviceIDPath:  "wmic",
	}
)

Functions

This section is empty.

Types

type Profile

type Profile struct {
	Name          string
	DataDir       string // Where to store config and cache
	ConfigPerm    os.FileMode
	SecurePerm    os.FileMode
	DirPerm       os.FileMode
	UseHardwareID bool   // Use device-specific encryption
	DeviceIDPath  string // Path to hardware identifier
}

Profile defines deployment-specific configuration

func Detect

func Detect() *Profile

Detect identifies the deployment environment and returns the matching Profile. It is cheap (a few os.Stat calls + runtime.GOOS) — callers that need the profile repeatedly should cache the returned pointer locally instead of re-invoking.

func (*Profile) GetCachePath

func (p *Profile) GetCachePath() (string, error)

GetCachePath returns the full cache file path.

func (*Profile) GetConfigPath

func (p *Profile) GetConfigPath() (string, error)

GetConfigPath returns the full config file path.

func (*Profile) GetDataDir

func (p *Profile) GetDataDir() (string, error)

GetDataDir returns the expanded data directory path. It fails loudly when $HOME/$APPDATA cannot be resolved — silently returning "/.dddns" would cause dddns to try to write under the filesystem root.

func (*Profile) GetSecurePath

func (p *Profile) GetSecurePath() (string, error)

GetSecurePath returns the full secure config path.

Jump to

Keyboard shortcuts

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