Documentation ¶
Index ¶
- func LoadCert(tlsCfg *tls.Config, cert, key string) error
- func ReadMsgFromReq(req *http.Request) (*dns.Msg, error)
- func ServeDoQ(l *quic.Listener, h Handler, opts DoQServerOpts) error
- func ServeTCP(l net.Listener, h Handler, opts TCPServerOpts) error
- func ServeUDP(c *net.UDPConn, h Handler, opts UDPServerOpts) error
- type DoQServerOpts
- type Handler
- type HttpHandler
- type HttpHandlerOpts
- type QueryMeta
- type TCPServerOpts
- type UDPServerOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServeDoQ ¶ added in v5.2.0
func ServeDoQ(l *quic.Listener, h Handler, opts DoQServerOpts) error
ServeDoQ starts a server at l. It returns if l had an Accept() error. It always returns a non-nil error.
Types ¶
type DoQServerOpts ¶ added in v5.2.0
type Handler ¶ added in v5.2.0
type Handler interface {
Handle(ctx context.Context, q *dns.Msg, meta QueryMeta, packMsgPayload func(m *dns.Msg) (*[]byte, error)) (respPayload *[]byte)
}
Handler handles incoming request q and MUST ALWAYS return a response. Handler MUST handle dns errors by itself and return a proper error responses. e.g. Return a SERVFAIL if something goes wrong. If Handle() returns a nil resp, caller will udp: do nothing. tcp/dot: close the connection immediately. doh: send a 500 response. doq: close the stream immediately.
type HttpHandler ¶ added in v5.2.0
type HttpHandler struct {
// contains filtered or unexported fields
}
func NewHttpHandler ¶ added in v5.2.0
func NewHttpHandler(h Handler, opts HttpHandlerOpts) *HttpHandler
func (*HttpHandler) ServeHTTP ¶ added in v5.2.0
func (h *HttpHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
type HttpHandlerOpts ¶ added in v5.2.0
type TCPServerOpts ¶
type UDPServerOpts ¶
Click to show internal directories.
Click to hide internal directories.