HTTP timeouts to API, and self-validation mutex to nameserver ops
This commit is contained in:
@@ -24,6 +24,7 @@ type Nameserver struct {
|
||||
OwnDomain string
|
||||
NotifyStartedFunc func()
|
||||
SOA dns.RR
|
||||
mu sync.RWMutex
|
||||
personalAuthKey string
|
||||
Domains map[string]Records
|
||||
errChan chan error
|
||||
|
||||
@@ -4,11 +4,15 @@ import "github.com/miekg/dns"
|
||||
|
||||
// SetOwnAuthKey sets the ACME challenge token for completing dns validation for acme-dns server itself
|
||||
func (n *Nameserver) SetOwnAuthKey(key string) {
|
||||
n.mu.Lock()
|
||||
defer n.mu.Unlock()
|
||||
n.personalAuthKey = key
|
||||
}
|
||||
|
||||
// answerOwnChallenge answers to ACME challenge for acme-dns own certificate
|
||||
func (n *Nameserver) answerOwnChallenge(q dns.Question) ([]dns.RR, error) {
|
||||
n.mu.RLock()
|
||||
defer n.mu.RUnlock()
|
||||
r := new(dns.TXT)
|
||||
r.Hdr = dns.RR_Header{Name: q.Name, Rrtype: dns.TypeTXT, Class: dns.ClassINET, Ttl: 1}
|
||||
r.Txt = append(r.Txt, n.personalAuthKey)
|
||||
|
||||
Reference in New Issue
Block a user