mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
@@ -1,21 +1,22 @@
|
||||
//Package nameservers provides logic for dynamically finding nameservers for a domain, and configuring NS records for them.
|
||||
// Package nameservers provides logic for dynamically finding nameservers for a domain, and configuring NS records for them.
|
||||
package nameservers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"strconv"
|
||||
|
||||
"github.com/StackExchange/dnscontrol/models"
|
||||
"github.com/StackExchange/dnscontrol/providers"
|
||||
"github.com/miekg/dns/dnsutil"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
//DetermineNameservers will find all nameservers we should use for a domain. It follows the following rules:
|
||||
//1. All explicitly defined NAMESERVER records will be used.
|
||||
//2. Each DSP declares how many nameservers to use. Default is all. 0 indicates to use none.
|
||||
// DetermineNameservers will find all nameservers we should use for a domain. It follows the following rules:
|
||||
// 1. All explicitly defined NAMESERVER records will be used.
|
||||
// 2. Each DSP declares how many nameservers to use. Default is all. 0 indicates to use none.
|
||||
func DetermineNameservers(dc *models.DomainConfig, maxNS int, dsps map[string]providers.DNSServiceProvider) ([]*models.Nameserver, error) {
|
||||
//always take explicit
|
||||
// always take explicit
|
||||
ns := dc.Nameservers
|
||||
for dsp, n := range dc.DNSProviders {
|
||||
if n == 0 {
|
||||
@@ -41,7 +42,7 @@ func DetermineNameservers(dc *models.DomainConfig, maxNS int, dsps map[string]pr
|
||||
return ns, nil
|
||||
}
|
||||
|
||||
//AddNSRecords creates NS records on a domain corresponding to the nameservers specified.
|
||||
// AddNSRecords creates NS records on a domain corresponding to the nameservers specified.
|
||||
func AddNSRecords(dc *models.DomainConfig) {
|
||||
ttl := uint32(300)
|
||||
if ttls, ok := dc.Metadata["ns_ttl"]; ok {
|
||||
|
Reference in New Issue
Block a user