Merge pull request #273 from porjo/recursor

Allow custom DNS resolvers
This commit is contained in:
xenolf 2016-08-23 08:46:22 +02:00 committed by GitHub
commit 89caa84ad0
2 changed files with 15 additions and 0 deletions

4
cli.go
View file

@ -158,6 +158,10 @@ func main() {
Name: "dns-timeout", Name: "dns-timeout",
Usage: "Set the DNS timeout value to a specific value in seconds. The default is 10 seconds.", Usage: "Set the DNS timeout value to a specific value in seconds. The default is 10 seconds.",
}, },
cli.StringSliceFlag{
Name: "dns-resolvers",
Usage: "Set the resolvers to use for performing recursive DNS queries. Supported: host:port. The default is to use Google's DNS resolvers.",
},
cli.BoolFlag{ cli.BoolFlag{
Name: "pem", Name: "pem",
Usage: "Generate a .pem file by concatanating the .key and .crt files together.", Usage: "Generate a .pem file by concatanating the .key and .crt files together.",

View file

@ -47,6 +47,17 @@ func setup(c *cli.Context) (*Configuration, *Account, *acme.Client) {
acme.DNSTimeout = time.Duration(c.GlobalInt("dns-timeout")) * time.Second acme.DNSTimeout = time.Duration(c.GlobalInt("dns-timeout")) * time.Second
} }
if len(c.GlobalStringSlice("dns-resolvers")) > 0 {
resolvers := []string{}
for _, resolver := range c.GlobalStringSlice("dns-resolvers") {
if !strings.Contains(resolver, ":") {
resolver += ":53"
}
resolvers = append(resolvers, resolver)
}
acme.RecursiveNameservers = resolvers
}
err := checkFolder(c.GlobalString("path")) err := checkFolder(c.GlobalString("path"))
if err != nil { if err != nil {
logger().Fatalf("Could not check/create path: %s", err.Error()) logger().Fatalf("Could not check/create path: %s", err.Error())