forked from TrueCloudLab/lego
Allow to specify RFC2136_NAMESERVER without the port.
Append the default DNS port if the nameserver specification does not contain any.
This commit is contained in:
parent
b3d25a9a61
commit
f00f09f19c
1 changed files with 6 additions and 1 deletions
|
@ -2,6 +2,7 @@ package acme
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
|
@ -20,9 +21,13 @@ type DNSProviderRFC2136 struct {
|
||||||
|
|
||||||
// NewDNSProviderRFC2136 returns a new DNSProviderRFC2136 instance.
|
// NewDNSProviderRFC2136 returns a new DNSProviderRFC2136 instance.
|
||||||
// To disable TSIG authentication 'tsigAlgorithm, 'tsigKey' and 'tsigSecret' must be set to the empty string.
|
// To disable TSIG authentication 'tsigAlgorithm, 'tsigKey' and 'tsigSecret' must be set to the empty string.
|
||||||
// 'nameserver' must be a network address in the the form "host:port". 'zone' must be the fully
|
// 'nameserver' must be a network address in the the form "host" or "host:port". 'zone' must be the fully
|
||||||
// qualified name of the zone.
|
// qualified name of the zone.
|
||||||
func NewDNSProviderRFC2136(nameserver, zone, tsigAlgorithm, tsigKey, tsigSecret string) (*DNSProviderRFC2136, error) {
|
func NewDNSProviderRFC2136(nameserver, zone, tsigAlgorithm, tsigKey, tsigSecret string) (*DNSProviderRFC2136, error) {
|
||||||
|
// Append the default DNS port if none is specified.
|
||||||
|
if !strings.Contains(nameserver, ":") {
|
||||||
|
nameserver += ":53"
|
||||||
|
}
|
||||||
d := &DNSProviderRFC2136{
|
d := &DNSProviderRFC2136{
|
||||||
nameserver: nameserver,
|
nameserver: nameserver,
|
||||||
zone: zone,
|
zone: zone,
|
||||||
|
|
Loading…
Reference in a new issue