aboutsummaryrefslogtreecommitdiff
path: root/plugin/pkg
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2018-05-21 19:40:46 +0100
committerGravatar GitHub <noreply@github.com> 2018-05-21 19:40:46 +0100
commit18b92e1117b67d27f98b14b46b19385c2dd23645 (patch)
tree6be110117ef16181a3a2d6a4703ac781037deabb /plugin/pkg
parent67c9075331b3c32f55e32836ab261d9364aefeb5 (diff)
downloadcoredns-18b92e1117b67d27f98b14b46b19385c2dd23645.tar.gz
coredns-18b92e1117b67d27f98b14b46b19385c2dd23645.tar.zst
coredns-18b92e1117b67d27f98b14b46b19385c2dd23645.zip
make CoreDNS DoH Server (#1619)
* WIP: make CoreDNS DoH Server * It works * Fix tests * Review from Tom - on diff. PR * correct mime type * Cleanups and use the pkg/nonwriter * rename and updates * implement get * implement GET * Code review comments * correct context * tweaks * code review
Diffstat (limited to 'plugin/pkg')
-rw-r--r--plugin/pkg/nonwriter/nonwriter.go13
1 files changed, 12 insertions, 1 deletions
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 }