types.go 1.9 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package dns
  2. // DNSSettings represents router DNS forwarder, upstream and cache configuration.
  3. type DNSSettings struct {
  4. Servers []string `json:"servers"` // Configured static upstream DNS servers (e.g. 1.1.1.1, 8.8.8.8)
  5. DynamicServers []string `json:"dynamic_servers"` // Dynamic DNS servers learned from DHCP/PPP
  6. AllowRemoteRequests bool `json:"allow_remote_requests"` // Accept queries from LAN devices (port 53)
  7. CacheSize int `json:"cache_size"` // Dnsmasq cache size in entries (default 1000)
  8. Domain string `json:"domain"` // Local domain e.g. "home.lan"
  9. DoHServer string `json:"doh_server,omitempty"` // Optional DNS-over-HTTPS URL
  10. VerifyDoHCert bool `json:"verify_doh_cert"` // Validate DoH certificate
  11. StaticRecords []StaticRecord `json:"static_records"` // Local static DNS records
  12. }
  13. // StaticRecord represents a static DNS mapping (hostname -> IP / CNAME)
  14. type StaticRecord struct {
  15. ID string `json:"id"`
  16. Name string `json:"name"` // FQDN or hostname e.g. "myrouter.lan"
  17. Type string `json:"type"` // "A", "AAAA", "CNAME", "TXT"
  18. Address string `json:"address"` // Target IP address or target FQDN
  19. TTL int `json:"ttl,omitempty"` // TTL in seconds (default 3600)
  20. Comment string `json:"comment,omitempty"`
  21. Disabled bool `json:"disabled"`
  22. }
  23. // DNSStatus provides live status for the router DNS system.
  24. type DNSStatus struct {
  25. ActiveServers []string `json:"active_servers"`
  26. AllowRemoteRequests bool `json:"allow_remote_requests"`
  27. CacheSize int `json:"cache_size"`
  28. StaticCount int `json:"static_count"`
  29. Domain string `json:"domain"`
  30. ResolvConfContent string `json:"resolv_conf_content"`
  31. ServiceRunning bool `json:"service_running"`
  32. }