doh

package
v0.0.0-...-8e9a908 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MimeType = "application/dns-message"

MimeType is the DoH mimetype that should be used.

View Source
const Path = "/dns-query"

Path is the URL path that should be used.

Variables

This section is empty.

Functions

func NewRequest

func NewRequest(method, url string, m *dns.Msg) (*http.Request, error)

NewRequest returns a new DoH request given a HTTP method, URL and dns.Msg.

The URL should not have a path, so please exclude /dns-query. The URL will be prefixed with https:// by default, unless it's already prefixed with either http:// or https://.

func RequestToMsg

func RequestToMsg(req *http.Request) (*dns.Msg, error)

RequestToMsg converts a http.Request to a dns message.

func ResponseToMsg

func ResponseToMsg(resp *http.Response) (*dns.Msg, error)

ResponseToMsg converts a http.Response to a dns message.

Types

type DoHWriter

type DoHWriter struct {
	// 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

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

	// Msg is a response to be written to the client.
	Msg *dns.Msg
}

DoHWriter is a dns.ResponseWriter that adds more specific LocalAddr and RemoteAddr methods.

func (*DoHWriter) Close

func (d *DoHWriter) Close() error

Close no-op implementation.

func (*DoHWriter) Hijack

func (d *DoHWriter) Hijack()

Hijack no-op implementation.

func (*DoHWriter) LocalAddr

func (d *DoHWriter) LocalAddr() net.Addr

LocalAddr returns the local address.

func (*DoHWriter) RemoteAddr

func (d *DoHWriter) RemoteAddr() net.Addr

RemoteAddr returns the remote address.

func (*DoHWriter) Request

func (d *DoHWriter) Request() *http.Request

Request returns the HTTP request.

func (*DoHWriter) TsigStatus

func (d *DoHWriter) TsigStatus() error

TsigStatus no-op implementation.

func (*DoHWriter) TsigTimersOnly

func (d *DoHWriter) TsigTimersOnly(_ bool)

TsigTimersOnly no-op implementation.

func (*DoHWriter) Write

func (d *DoHWriter) Write(b []byte) (int, error)

Write stores the message to be written to the client.

func (*DoHWriter) WriteMsg

func (d *DoHWriter) WriteMsg(m *dns.Msg) error

WriteMsg stores the message to be written to the client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL