aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-rw-r--r--plugin/normalize.go9
-rw-r--r--plugin/pkg/nonwriter/nonwriter.go13
2 files changed, 18 insertions, 4 deletions
diff --git a/plugin/normalize.go b/plugin/normalize.go
index ef6f2eaa0..fbbe5c826 100644
--- a/plugin/normalize.go
+++ b/plugin/normalize.go
@@ -71,6 +71,8 @@ func (h Host) Normalize() string {
s = s[len(TransportDNS+"://"):]
case strings.HasPrefix(s, TransportGRPC+"://"):
s = s[len(TransportGRPC+"://"):]
+ case strings.HasPrefix(s, TransportHTTPS+"://"):
+ s = s[len(TransportHTTPS+"://"):]
}
// The error can be ignore here, because this function is called after the corefile
@@ -138,7 +140,8 @@ func SplitHostPort(s string) (host, port string, ipnet *net.IPNet, err error) {
// Duplicated from core/dnsserver/address.go !
const (
- TransportDNS = "dns"
- TransportTLS = "tls"
- TransportGRPC = "grpc"
+ TransportDNS = "dns"
+ TransportTLS = "tls"
+ TransportGRPC = "grpc"
+ TransportHTTPS = "https"
)
diff --git a/plugin/pkg/nonwriter/nonwriter.go b/plugin/pkg/nonwriter/nonwriter.go
index 7819a320f..b157e4242 100644
--- a/plugin/pkg/nonwriter/nonwriter.go
+++ b/plugin/pkg/nonwriter/nonwriter.go
@@ -2,6 +2,8 @@
package nonwriter
import (
+ "net"
+
"github.com/miekg/dns"
)
@@ -9,6 +11,11 @@ import (
type Writer struct {
dns.ResponseWriter
Msg *dns.Msg
+
+ // Raddr is the remote's address. This can be optionally set.
+ Raddr net.Addr
+ // Laddr is our address. This can be optionally set.
+ Laddr net.Addr
}
// New makes and returns a new NonWriter.
@@ -20,4 +27,8 @@ func (w *Writer) WriteMsg(res *dns.Msg) error {
return nil
}
-func (w *Writer) Write(buf []byte) (int, error) { return len(buf), nil }
+// RemoteAddr returns the remote address.
+func (w *Writer) RemoteAddr() net.Addr { return w.Raddr }
+
+// LocalAddr returns the local address.
+func (w *Writer) LocalAddr() net.Addr { return w.Laddr }