|
@@ -102,6 +102,16 @@ Requires **--insecure** flag.`,
|
|
|
|
|
|
|
|
var pidfile string
|
|
var pidfile string
|
|
|
|
|
|
|
|
|
|
+// resolverAddress returns the given DNS resolver address with the default DNS
|
|
|
|
|
+// port (53) added when no port is present. Bare and bracketed IPv6 addresses
|
|
|
|
|
+// are supported.
|
|
|
|
|
+func resolverAddress(addr string) string {
|
|
|
|
|
+ if _, _, err := net.SplitHostPort(addr); err == nil {
|
|
|
|
|
+ return addr
|
|
|
|
|
+ }
|
|
|
|
|
+ return net.JoinHostPort(strings.Trim(addr, "[]"), "53")
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// AppAction is the action used when the top command runs.
|
|
// AppAction is the action used when the top command runs.
|
|
|
func appAction(ctx *cli.Context) error {
|
|
func appAction(ctx *cli.Context) error {
|
|
|
passFile := ctx.String("password-file")
|
|
passFile := ctx.String("password-file")
|
|
@@ -247,6 +257,7 @@ To get a linked authority token:
|
|
|
|
|
|
|
|
// replace resolver if requested
|
|
// replace resolver if requested
|
|
|
if resolver != "" {
|
|
if resolver != "" {
|
|
|
|
|
+ resolver = resolverAddress(resolver)
|
|
|
net.DefaultResolver.PreferGo = true
|
|
net.DefaultResolver.PreferGo = true
|
|
|
net.DefaultResolver.Dial = func(_ context.Context, network, _ string) (net.Conn, error) {
|
|
net.DefaultResolver.Dial = func(_ context.Context, network, _ string) (net.Conn, error) {
|
|
|
return net.Dial(network, resolver)
|
|
return net.Dial(network, resolver)
|