From e9812b0947673b6d94fbf7be11690eac8e202ee6 Mon Sep 17 00:00:00 2001 From: Jordan Whited Date: Tue, 26 May 2020 15:37:38 -0700 Subject: [PATCH] add timeout to wgsd-client --- cmd/wgsd-client/main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/wgsd-client/main.go b/cmd/wgsd-client/main.go index 9a47c38..27e5f4a 100644 --- a/cmd/wgsd-client/main.go +++ b/cmd/wgsd-client/main.go @@ -11,6 +11,7 @@ import ( "os" "os/signal" "syscall" + "time" "github.com/miekg/dns" "golang.zx2c4.com/wireguard/wgctrl" @@ -60,7 +61,9 @@ func main() { done := make(chan struct{}) go func() { defer close(done) - dnsClient := &dns.Client{} + dnsClient := &dns.Client{ + Timeout: time.Second * 5, + } for _, peer := range wgDevice.Peers { select { case <-ctx.Done(): @@ -128,7 +131,7 @@ func main() { err = wgClient.ConfigureDevice(*deviceFlag, deviceConfig) if err != nil { log.Printf( - "failed to configure peer %s on %s, error: %v", + "[%s] failed to configure peer on %s, error: %v", pubKeyBase64, *deviceFlag, err) } }