Skip to content

Commit

Permalink
home: reduce allocs
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed May 31, 2021
1 parent 10a7678 commit c304a0b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.db
*.log
*.snap
/agh-backup/
/bin/
/build/*
/build2/*
Expand All @@ -20,7 +21,6 @@
/querylog.json*
/snapcraft_login
AdGuardHome*
/agh-backup/
coverage.txt
leases.db
node_modules/
Expand Down
6 changes: 4 additions & 2 deletions internal/home/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c304a0b

Please sign in to comment.