From dbb94831025588af82a3f8b9f4308e862f30d73f Mon Sep 17 00:00:00 2001 From: m5r Date: Thu, 14 Dec 2023 01:04:01 +0100 Subject: [PATCH] works locally again --- xip/xip.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/xip/xip.go b/xip/xip.go index ae9ca45..ff7b01f 100644 --- a/xip/xip.go +++ b/xip/xip.go @@ -369,6 +369,18 @@ func (xip *Xip) StartServer() { err := xip.server.ListenAndServe() defer xip.server.Shutdown() if err != nil { + if strings.Contains(err.Error(), "fly-global-services: no such host") { + // we're not running on fly, bind to 0.0.0.0 instead + port := strings.Split(xip.server.Addr, ":")[1] + xip.server = dns.Server{ + Addr: fmt.Sprintf(":%s", port), + Net: "udp", + } + + xip.StartServer() + return + } + log.Fatalf("Failed to start server: %s\n ", err.Error()) } }