db/specs/models_heroledger/main/dnsrecord.v
2025-08-05 11:00:20 +02:00

70 lines
1.9 KiB
V

module circle
import freeflowuniverse.herolib.hero.models.core
pub struct DNSZone {
core.Base
pub mut:
domain string @[index] // The actual domain name
dnsrecords []DNSRecord
administrators []u32
status DNSZoneStatus // active, suspended, etc.
metadata map[string]string
soarecord []SOARecord //one soa record per zone, last one is valid, rest is for history
}
// Name represents a domain name configuration for a circle
pub struct DNSRecord {
pub mut:
subdomain string // Optional subdomain e.g. main, means mail.example.com, example.com would be the domain, here only 'mail'
record_type NameType // Type of DNS record
value string // DNS record value/target
priority u32 // Priority for MX records
ttl u32 // Time to live in seconds
is_active bool // Whether this record is currently active
cat NameCat // Category of the DNS record, e.g., ipv4, ipv6, mycelium
is_wildcard bool // Whether this is a wildcard record
}
// NameType defines the supported DNS record types
pub enum NameType {
a
aaaa
cname
mx
txt
srv
ptr
ns
}
pub enum NameCat {
ipv4
ipv6
mycelium
}
pub enum DNSZoneStatus {
active
suspended
archived
}
// SOA (Start of Authority) record for a DNS zone
pub struct SOARecord {
pub mut:
zone_id u32 // Reference to DNSZone
primary_ns string // Primary nameserver (e.g., ns1.example.com)
admin_email string // Responsible party's email (e.g., admin.example.com)
serial u64 // Serial number of the zone file, needs to be incremented on changes
refresh u32 = 3600 // Time before zone should be refreshed (in seconds)
retry u32 = 600 // Time before retry if refresh fails (in seconds)
expire u32 = 604800 // Time before zone is considered no longer authoritative
minimum_ttl u32 = 3600 // Default TTL for records without explicit TTL
is_active bool = true // Whether this SOA record is active
}