Documentation
¶
Index ¶
- func DhcpEnabled(db *gorm.DB) bool
- func NormalizeDNSName(name string) (string, error)
- func NormalizeMAC(v string) (string, error)
- func OptionalPolicyID(id *uint) *uint
- func ParseTemplateNameservers(hosts []string) ([]models.DnsTemplateNameserver, error)
- func ParseZoneRecords(reqs []models.DnsZoneRecordDTO) ([]models.DnsZoneRecord, error)
- func RenderDnsmgrConfig(cfg *Config) ([]byte, error)
- func ReplaceTemplateNameservers(tx *gorm.DB, templateID uint, ns []models.DnsTemplateNameserver) error
- func ReplaceZoneRecords(tx *gorm.DB, zoneID uint, recs []models.DnsZoneRecord) error
- func ZoneRecordsDTO(recs []models.DnsZoneRecord) []models.DnsZoneRecordDTO
- func ZonesEnabled(db *gorm.DB) bool
- type Config
- type ConfigDHCP
- type ConfigDHCPHost
- type ConfigDHCPPrefix
- type ConfigDHCPProto
- type ConfigDNSHost
- type ConfigDNSRecord
- type ConfigDNSSOA
- type ConfigDNSTemplate
- type ConfigDNSZone
- type DNSClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DhcpEnabled ¶ added in v1.0.6
DhcpEnabled reports Settings.DhcpEnabled (nil/false = off).
func NormalizeDNSName ¶ added in v1.1.0
NormalizeDNSName trims, strips a trailing dot, and checks the name is a valid DNS hostname (same rules dnsmgr2 uses for records). Empty input is valid and returns empty (Netbox dns_name is optional).
func NormalizeMAC ¶ added in v1.0.6
NormalizeMAC parses a MAC and returns canonical lowercase colon form (aa:bb:cc:dd:ee:ff). Accepted input: aa:bb:cc:dd:ee:ff, aa-bb-cc-dd-ee-ff, aabb.ccdd.eeff, aabbccddeeff — matching dnsmgr2.
func OptionalPolicyID ¶ added in v1.0.6
func ParseTemplateNameservers ¶ added in v1.0.6
func ParseTemplateNameservers(hosts []string) ([]models.DnsTemplateNameserver, error)
func ParseZoneRecords ¶ added in v1.0.6
func ParseZoneRecords(reqs []models.DnsZoneRecordDTO) ([]models.DnsZoneRecord, error)
func RenderDnsmgrConfig ¶ added in v1.0.6
RenderDnsmgrConfig builds a dnsmgr2.yaml document from the remote DNS config.
func ReplaceTemplateNameservers ¶ added in v1.0.6
func ReplaceZoneRecords ¶ added in v1.0.6
func ZoneRecordsDTO ¶ added in v1.0.6
func ZoneRecordsDTO(recs []models.DnsZoneRecord) []models.DnsZoneRecordDTO
func ZonesEnabled ¶ added in v1.0.6
ZonesEnabled reports Settings.DnsZonesEnabled (nil/false = off). Disabling the flag only hides the UI and 404s /api/dns/* zone routes — it does not touch rows.
Types ¶
type Config ¶ added in v1.0.6
type Config struct {
util.ConfigDNS
ZonesEnabled bool
DhcpEnabled bool
ConfigFile string
DbFile string
Host ConfigDNSHost
SOATemplates []ConfigDNSSOA
Templates []ConfigDNSTemplate
Zones []ConfigDNSZone
DHCP ConfigDHCP
}
Config is the runtime DNS config factum2-dns fetches from the primary. It extends util.ConfigDNS with the optional zone-editor payload used to generate dnsmgr2.yaml and extra JSON records-file sections.
func FetchRemoteConfig ¶
func FetchRemoteConfig(factumConfig *util.ConfigFactum) (*Config, error)
FetchRemoteConfig pulls the DNS sync settings from the primary, authenticated with factumConfig.Token (checked against the primary's Settings.FactumApiToken - see web.Controller.checkServiceToken).
type ConfigDHCP ¶ added in v1.0.6
type ConfigDHCP struct {
DnsServers []string `json:"dns_servers"`
Host ConfigDHCPHost `json:"host_template"`
Prefixes []ConfigDHCPPrefix `json:"prefixes"`
}
ConfigDHCP is the Kea payload written into dnsmgr2.yaml when DhcpEnabled.
type ConfigDHCPHost ¶ added in v1.0.6
type ConfigDHCPHost struct {
Name string `json:"name"`
Type string `json:"type"`
IPv4 ConfigDHCPProto `json:"ipv4"`
IPv6 ConfigDHCPProto `json:"ipv6"`
}
type ConfigDHCPPrefix ¶ added in v1.0.6
type ConfigDHCPProto ¶ added in v1.0.6
type ConfigDNSHost ¶ added in v1.0.6
type ConfigDNSHost struct {
Name string `json:"name"`
Type string `json:"type"`
ConfigDir string `json:"config_dir"`
IncludeFile string `json:"include_file"`
ZonesDir string `json:"zones_dir"`
ZonesFile string `json:"zones_file"`
TmpDir string `json:"tmp_dir"`
CmdReloadAll string `json:"cmd_reload_all"`
CmdReloadZone string `json:"cmd_reload_zone"`
CmdRestart string `json:"cmd_restart"`
}
ConfigDNSHost is the BIND host template written into dnsmgr2.yaml.
type ConfigDNSRecord ¶ added in v1.0.6
type ConfigDNSSOA ¶ added in v1.0.6
type ConfigDNSTemplate ¶ added in v1.0.6
type ConfigDNSZone ¶ added in v1.0.6
type ConfigDNSZone struct {
Name string `json:"name"`
Type string `json:"type"`
DnsTemplate string `json:"dns_template"`
Records []ConfigDNSRecord `json:"records"`
}
type DNSClient ¶
type DNSClient struct {
Config *util.ConfigAgentRoot
DNS *Config
// contains filtered or unexported fields
}
func NewDNSClient ¶
func NewDNSClient(config *util.ConfigAgentRoot) (*DNSClient, error)
NewDNSClient fetches the DNS sync settings from the primary over REST - factum2-dns typically runs on a different host than the primary, so unlike before, it no longer opens a direct connection to factum's Postgres just to read these (see util.ConfigDNS's doc comment).