Skip to content

Commit

Permalink
Allow .local hosts to be offline or slow
Browse files Browse the repository at this point in the history
Signed-off-by: Anders F Björklund <[email protected]>
  • Loading branch information
afbjorklund committed Aug 31, 2024
1 parent 19469eb commit 86ea0de
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions pkg/limayaml/validate.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package limayaml

import (
"context"
"errors"
"fmt"
"net"
Expand All @@ -11,7 +10,6 @@ import (
"regexp"
"runtime"
"strings"
"time"

"github.com/docker/go-units"
"github.com/lima-vm/lima/pkg/localpathutil"
Expand Down Expand Up @@ -439,16 +437,11 @@ func ValidateParamIsUsed(y *LimaYAML) error {
}

func lookupIP(host string) error {
var err error
if strings.HasSuffix(host, ".local") {
var r net.Resolver
const timeout = 500 * time.Millisecond // timeout for .local
ctx, cancel := context.WithTimeout(context.TODO(), timeout)
defer cancel()
_, err = r.LookupIP(ctx, "ip", host)
} else {
_, err = net.LookupIP(host)
// allow offline or slow mDNS
return nil
}
_, err := net.LookupIP(host)
return err
}

Expand Down

0 comments on commit 86ea0de

Please sign in to comment.