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 ¶
GetCachePath returns the full cache file path.
func (*Profile) GetConfigPath ¶
GetConfigPath returns the full config file path.
func (*Profile) GetDataDir ¶
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 ¶
GetSecurePath returns the full secure config path.
Click to show internal directories.
Click to hide internal directories.