plugin/dnstap: support FQDN TCP endpoint (#5377)
* plugin/dnstap: support FQDN TCP endpoint Signed-off-by: lob <pengyu@pingcap.com> * plugin/dnstap: remove unused variable Signed-off-by: lob <pengyu@pingcap.com>
This commit is contained in:
parent
092c144491
commit
dbb8a12394
4 changed files with 12 additions and 5 deletions
|
@ -1,13 +1,13 @@
|
|||
package dnstap
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/coredns/caddy"
|
||||
"github.com/coredns/coredns/core/dnsserver"
|
||||
"github.com/coredns/coredns/plugin"
|
||||
clog "github.com/coredns/coredns/plugin/pkg/log"
|
||||
"github.com/coredns/coredns/plugin/pkg/parse"
|
||||
)
|
||||
|
||||
var log = clog.NewWithPlugin("dnstap")
|
||||
|
@ -24,12 +24,12 @@ func parseConfig(c *caddy.Controller) (Dnstap, error) {
|
|||
}
|
||||
|
||||
if strings.HasPrefix(endpoint, "tcp://") {
|
||||
// remote IP endpoint
|
||||
servers, err := parse.HostPortOrFile(endpoint[6:])
|
||||
// remote network endpoint
|
||||
endpointURL, err := url.Parse(endpoint)
|
||||
if err != nil {
|
||||
return d, c.ArgErr()
|
||||
}
|
||||
dio := newIO("tcp", servers[0])
|
||||
dio := newIO("tcp", endpointURL.Host)
|
||||
d = Dnstap{io: dio}
|
||||
} else {
|
||||
endpoint = strings.TrimPrefix(endpoint, "unix://")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue