Documentation ¶
Overview ¶
Package dns provides dns server implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTCPListener ¶
NewTCPListener creates a new TCP listener.
func NewUDPPacketConn ¶
func NewUDPPacketConn(network, addr string) (net.PacketConn, error)
NewUDPPacketConn creates a new UDP packet connection.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a dns.Handler to plugin.Handler adapter.
func (*Cache) ServeDNS ¶
func (c *Cache) ServeDNS(wr dns.ResponseWriter, msg *dns.Msg)
ServeDNS implements dns.Handler.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is a dns proxy selector.
type HostMapper ¶
type HostMapper interface {
ResolveAddr(ctx context.Context, qType uint16, name string) []netip.Addr
}
HostMapper is a name to node mapper.
type NodeHandler ¶
type NodeHandler struct {
// contains filtered or unexported fields
}
NodeHandler try to resolve dns request to a node. If required node is not found, it will move to the next handler.
func NewNodeHandler ¶
func NewNodeHandler(next plugin.Handler, hostMapper HostMapper, logger *zap.Logger) *NodeHandler
NewNodeHandler creates a new NodeHandler.
func (*NodeHandler) ServeDNS ¶
func (h *NodeHandler) ServeDNS(ctx context.Context, wrt dns.ResponseWriter, msg *dns.Msg) (int, error)
ServeDNS implements plugin.Handler.
func (*NodeHandler) SetEnabled ¶
func (h *NodeHandler) SetEnabled(enabled bool)
SetEnabled sets the handler enabled state.
Click to show internal directories.
Click to hide internal directories.