aboutsummaryrefslogtreecommitdiff
path: root/core/dnsserver/https.go
blob: 382e06efea213fcc6014d24ad834a06dbc6c83ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package dnsserver

import (
	"net"
	"net/http"

	"github.com/coredns/coredns/plugin/pkg/nonwriter"
)

// DoHWriter is a nonwriter.Writer that adds more specific LocalAddr and RemoteAddr methods.
type DoHWriter struct {
	nonwriter.Writer

	// 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

	// request is the HTTP request we're currently handling.
	request *http.Request
}

// RemoteAddr returns the remote address.
func (d *DoHWriter) RemoteAddr() net.Addr { return d.raddr }

// LocalAddr returns the local address.
func (d *DoHWriter) LocalAddr() net.Addr { return d.laddr }

// Request returns the HTTP request
func (d *DoHWriter) Request() *http.Request { return d.request }