core: remove HostAddresses() (#1728)

* core: remove HostAddresses()

config.HostAddresses() is a weird function that gathers
some data from the server and returns a string.

It is *only* used the trace plugin, to figure out what
server starts the trace.

Looks to be better to fit in the with metrics.WithServer label
on the trace itself to show which server handled the trace.

Remove HostAddresses() and cleanup trace a small bit.:w

* lint
This commit is contained in:
Miek Gieben
2018-04-25 15:27:25 +01:00
committed by GitHub
parent 7a507e34ca
commit d3f2d4a291
3 changed files with 7 additions and 24 deletions

View File

@@ -3,7 +3,6 @@ package dnsserver
import (
"crypto/tls"
"fmt"
"net"
"github.com/coredns/coredns/plugin"
@@ -53,22 +52,6 @@ type Config struct {
registry map[string]plugin.Handler
}
//HostAddresses builds a representation of the addresses of this Config
//after server is started ONLY, can be used as a Key for identifing that config
// :53 or 127.0.0.1:53 or 127.0.0.1:53/::1:53
func (c *Config) HostAddresses() string {
all := ""
for _, h := range c.ListenHosts {
addr := net.JoinHostPort(h, c.Port)
if all == "" {
all = addr
continue
}
all = all + "/" + addr
}
return all
}
// keyForConfig build a key for identifying the configs during setup time
func keyForConfig(blocIndex int, blocKeyIndex int) string {
return fmt.Sprintf("%d:%d", blocIndex, blocKeyIndex)