Documentation
¶
Index ¶
- Constants
- Variables
- func AddPadding(msg *dns.Msg, blockLength int)
- func CheckAndSetEdns(req, resp *dns.Msg) error
- func EqualsAsciiIgnoreCase(s, t string) bool
- func GetMaxUdpSize(req *dns.Msg) int
- func GetProtocol(w dns.ResponseWriter) string
- func HasPadding(msg *dns.Msg) bool
- func MsgAcceptFunc(dh dns.Header) dns.MsgAcceptAction
- func ResizeForTransport(req, resp *dns.Msg, proto string)
- func SplitForTxt(s string) []string
- func ToLowerAscii(s string) string
- func ToPrintableAscii(s string) string
- type DnssecProvider
- func (p *DnssecProvider) DS() (*dns.DS, error)
- func (p *DnssecProvider) PrivKeyBytes() ([]byte, error)
- func (p *DnssecProvider) Prove(req, resp *dns.Msg, validFrom, validTo uint32) error
- func (p *DnssecProvider) ProvideKeys(req, resp *dns.Msg) bool
- func (p *DnssecProvider) SetPrivKeyBytes(b []byte) error
- func (p *DnssecProvider) Sign(rrs []dns.RR, validFrom, validTo uint32) (sigs []dns.RR, err error)
- type IPCollection
- type LoggingHandler
- type LoggingResponseWriter
- type RecordGenerator
- type SimpleHandler
- type StaticRecords
- type UpdateHandler
Constants ¶
View Source
const ( MaxUdpMsgSize = 1400 // rfc9715 ResponsePaddingBlockLength = 468 // rfc8467 )
View Source
const ( ProtoUDP = "UDP" ProtoTCP = "TCP" ProtoTLS = "TLS" )
View Source
const MaxTxtStringSize = 255
Variables ¶
View Source
var DefaultNsecTypes = []uint16{ dns.TypeA, dns.TypeNS, dns.TypeSOA, dns.TypeMX, dns.TypeTXT, dns.TypeAAAA, dns.TypeRRSIG, dns.TypeNSEC, dns.TypeDNSKEY, dns.TypeHTTPS, }
View Source
var PrintableAscii = &unicode.RangeTable{ R16: []unicode.Range16{ {0x0020, 0x007e, 1}, }, LatinOffset: 1, }
Functions ¶
func AddPadding ¶
adds edns0 padding to msg so that the padded length is a multiple of blockLength
func CheckAndSetEdns ¶
checks for edns0 in req, sets edns0 in resp
func EqualsAsciiIgnoreCase ¶
fast, ascii-only, case-insensitive string equality check
func GetProtocol ¶
func GetProtocol(w dns.ResponseWriter) string
func MsgAcceptFunc ¶
func MsgAcceptFunc(dh dns.Header) dns.MsgAcceptAction
func ResizeForTransport ¶
truncates and/or pads if necessary
func SplitForTxt ¶
splits the given string into a slice of strings of suitable lengths for dns.TXT(https://pkg.go.dev/github.com/miekg/dns#TXT) data
func ToPrintableAscii ¶
attempts to replace all non-ascii characters with ascii approximations, then removes all non-ascii characters and ascii control characters
Types ¶
type DnssecProvider ¶
type DnssecProvider struct {
Ksk *dns.DNSKEY
Zsk *dns.DNSKEY
ZskPrivKey crypto.Signer
KeySig *dns.RRSIG
NsecTypes []uint16
}
func GenerateDnssecProvider ¶
func GenerateDnssecProvider(name string, algo uint8, rrTtl, validFrom, validTo uint32) (*DnssecProvider, error)
func (*DnssecProvider) PrivKeyBytes ¶
func (p *DnssecProvider) PrivKeyBytes() ([]byte, error)
func (*DnssecProvider) Prove ¶
func (p *DnssecProvider) Prove(req, resp *dns.Msg, validFrom, validTo uint32) error
adds DNSSEC signatures to resp
func (*DnssecProvider) ProvideKeys ¶
func (p *DnssecProvider) ProvideKeys(req, resp *dns.Msg) bool
adds DNSSEC keys (and keysig) to resp if requested by req, returns true iff keys were added
func (*DnssecProvider) SetPrivKeyBytes ¶
func (p *DnssecProvider) SetPrivKeyBytes(b []byte) error
type IPCollection ¶
func (*IPCollection) Add ¶
func (c *IPCollection) Add(ip net.IP)
func (*IPCollection) MarshalJSON ¶
func (c *IPCollection) MarshalJSON() ([]byte, error)
func (*IPCollection) UnmarshalJSON ¶
func (c *IPCollection) UnmarshalJSON(data []byte) error
type LoggingHandler ¶
type LoggingHandler struct {
Logger *log.Logger
Next dns.Handler
// contains filtered or unexported fields
}
func (*LoggingHandler) RequestCount ¶
func (h *LoggingHandler) RequestCount() uint64
func (*LoggingHandler) ServeDNS ¶
func (h *LoggingHandler) ServeDNS(w dns.ResponseWriter, req *dns.Msg)
type LoggingResponseWriter ¶
type LoggingResponseWriter struct {
dns.ResponseWriter
Start time.Time
Rcode int
AnCount int
NsCount int
ExCount int
// contains filtered or unexported fields
}
func (*LoggingResponseWriter) ConnectionState ¶
func (w *LoggingResponseWriter) ConnectionState() *tls.ConnectionState
type RecordGenerator ¶
type SimpleHandler ¶
type SimpleHandler struct {
RecordGenerator
UpdateHandler
*DnssecProvider
Zone string
Ns []string
HostMasterMbox string
StaticRecords StaticRecords
// contains filtered or unexported fields
}
func (*SimpleHandler) Init ¶
func (h *SimpleHandler) Init(privKeyBytes []byte) *SimpleHandler
func (*SimpleHandler) ServeDNS ¶
func (h *SimpleHandler) ServeDNS(w dns.ResponseWriter, req *dns.Msg)
type StaticRecords ¶
func (StaticRecords) MarshalJSON ¶
func (s StaticRecords) MarshalJSON() ([]byte, error)
func (*StaticRecords) UnmarshalJSON ¶
func (p *StaticRecords) UnmarshalJSON(data []byte) error
type UpdateHandler ¶
type UpdateHandler interface {
HandleUpdate(w dns.ResponseWriter, req *dns.Msg, zone string)
}
Click to show internal directories.
Click to hide internal directories.