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:
Philipp Kern 2016-02-07 00:12:48 +01:00
parent b3d25a9a61
commit f00f09f19c

View file

@ -2,6 +2,7 @@ package acme
import (
"fmt"
"strings"
"time"
"github.com/miekg/dns"
@ -20,9 +21,13 @@ type DNSProviderRFC2136 struct {
// NewDNSProviderRFC2136 returns a new DNSProviderRFC2136 instance.
// 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.
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{
nameserver: nameserver,
zone: zone,