package model import "time" // Settings are global to the single-admin installation. type Settings struct { UpdateIntervalSeconds int UpdaterEnabled bool IPv6Enabled bool IPv4Endpoints []string IPv6Endpoints []string LastIPv4 string LastIPv6 string LastRunAt time.Time LastRunStatus string UpdatedAt time.Time } // Credential is a reusable, encrypted Hetzner project token. type Credential struct { ID int64 Label string Ciphertext []byte Nonce []byte Fingerprint string CreatedAt time.Time } // Zone is one Hetzner DNS zone selected by the administrator. type Zone struct { ID int64 CredentialID int64 ProviderID string Name string CreatedAt time.Time LastSyncAt time.Time LastError string } // Target is the desired state for one host name and its dynamic address families. type Target struct { ID int64 ZoneID int64 RecordName string FQDN string UpdateIPv4 bool UpdateIPv6 bool Active bool StaticIPv4 string StaticIPv6 string Description string TTL int LastUpdatedAt time.Time LastStatus string LastError string CreatedAt time.Time ArchivedAt time.Time } // CNAMERecord is a static DNS alias managed directly in a zone. It is kept // separate from Target because the DynDNS worker must never overwrite it. type CNAMERecord struct { ID int64 ZoneID int64 Active bool RecordName string FQDN string Destination string Description string TTL int CreatedAt time.Time UpdatedAt time.Time } type User struct { ID int64 Username string DisplayName string Role string Active bool CreatedAt time.Time UpdatedAt time.Time LastLoginAt time.Time } func (u User) IsAdmin() bool { return u.Role == "admin" } type AccessGrant struct { ID int64 UserID int64 ZoneID int64 TargetID *int64 CanManageTargets bool CanCreateTargets bool } // Session deliberately contains only hashes/random CSRF material, never a password. type Session struct { ID int64 UserID int64 Username string DisplayName string Role string TokenHash string CSRFToken string CreatedAt time.Time ExpiresAt time.Time ReauthUntil time.Time } type AuditEvent struct { ID int64 CreatedAt time.Time Kind string Message string } type UpdateRun struct { ID int64 StartedAt time.Time FinishedAt time.Time Status string IPv4 string IPv6 string Summary string } type Dashboard struct { Settings Settings Zones []Zone ActiveTargets int RecentRuns []UpdateRun RecentEvents []AuditEvent NextRunAt time.Time SchedulerRunning bool ErrorCount int }