Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support custom DNS resolvers for Let's Encrypt.
- Loading branch information
Showing
5 changed files
with
113 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package types | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
) | ||
|
||
// DNSResolvers is a list of DNSes that we will try to resolve the challenged FQDN against | ||
type DNSResolvers []string | ||
|
||
// String is the method to format the flag's value, part of the flag.Value interface. | ||
// The String method's output will be used in diagnostics. | ||
func (r *DNSResolvers) String() string { | ||
return strings.Join(*r, ",") | ||
} | ||
|
||
// Set is the method to set the flag value, part of the flag.Value interface. | ||
// Set's argument is a string to be parsed to set the flag. | ||
// It's a comma-separated list, so we split it. | ||
func (r *DNSResolvers) Set(value string) error { | ||
entryPoints := strings.Split(value, ",") | ||
if len(entryPoints) == 0 { | ||
return fmt.Errorf("wrong DNSResolvers format: %s", value) | ||
} | ||
for _, entryPoint := range entryPoints { | ||
*r = append(*r, entryPoint) | ||
} | ||
return nil | ||
} | ||
|
||
// Get return the DNSResolvers list | ||
func (r *DNSResolvers) Get() interface{} { | ||
return *r | ||
} | ||
|
||
// SetValue sets the DNSResolvers list | ||
func (r *DNSResolvers) SetValue(val interface{}) { | ||
*r = val.(DNSResolvers) | ||
} | ||
|
||
// Type is type of the struct | ||
func (r *DNSResolvers) Type() string { | ||
return "dnsresolvers" | ||
} |