From c304a0bacdca6f8b5ffd21f3d00c8244ea9e4e36 Mon Sep 17 00:00:00 2001 From: Eugene Burkov Date: Mon, 31 May 2021 18:19:46 +0300 Subject: [PATCH] home: reduce allocs --- .gitignore | 2 +- internal/home/control.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index da1e8c54a6c..2d3d46fc73f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ *.db *.log *.snap +/agh-backup/ /bin/ /build/* /build2/* @@ -20,7 +21,6 @@ /querylog.json* /snapcraft_login AdGuardHome* -/agh-backup/ coverage.txt leases.db node_modules/ diff --git a/internal/home/control.go b/internal/home/control.go index 57aed935fce..06682b465de 100644 --- a/internal/home/control.go +++ b/internal/home/control.go @@ -37,9 +37,11 @@ func httpError(w http.ResponseWriter, code int, format string, args ...interface // addresses to a slice of strings. func appendDNSAddrs(dst []string, addrs ...net.IP) (res []string) { for _, addr := range addrs { - hostport := addr.String() + var hostport string if config.DNS.Port != 53 { - hostport = aghnet.JoinHostPort(hostport, config.DNS.Port) + hostport = aghnet.JoinHostPort(addr.String(), config.DNS.Port) + } else { + hostport = addr.String() } dst = append(dst, hostport)