mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 23:09:58 +00:00
TUN-9467: bump coredns to solve CVE
* TUN-9467: bump coredns to solve CVE
This commit is contained in:

committed by
João "Pisco" Fernandes

parent
f8d12c9d39
commit
a408612f26
13
vendor/github.com/miekg/dns/README.md
generated
vendored
13
vendor/github.com/miekg/dns/README.md
generated
vendored
@@ -83,7 +83,10 @@ A not-so-up-to-date-list-that-may-be-actually-current:
|
||||
* https://github.com/egbakou/domainverifier
|
||||
* https://github.com/semihalev/sdns
|
||||
* https://github.com/wintbiit/NineDNS
|
||||
|
||||
* https://linuxcontainers.org/incus/
|
||||
* https://ifconfig.es
|
||||
* https://github.com/zmap/zdns
|
||||
* https://framagit.org/bortzmeyer/check-soa
|
||||
|
||||
Send pull request if you want to be listed here.
|
||||
|
||||
@@ -146,6 +149,7 @@ Example programs can be found in the `github.com/miekg/exdns` repository.
|
||||
* 3225 - DO bit (DNSSEC OK)
|
||||
* 340{1,2,3} - NAPTR record
|
||||
* 3445 - Limiting the scope of (DNS)KEY
|
||||
* 3596 - AAAA record
|
||||
* 3597 - Unknown RRs
|
||||
* 4025 - A Method for Storing IPsec Keying Material in DNS
|
||||
* 403{3,4,5} - DNSSEC + validation functions
|
||||
@@ -181,11 +185,18 @@ Example programs can be found in the `github.com/miekg/exdns` repository.
|
||||
* 7871 - EDNS0 Client Subnet
|
||||
* 7873 - Domain Name System (DNS) Cookies
|
||||
* 8080 - EdDSA for DNSSEC
|
||||
* 8490 - DNS Stateful Operations
|
||||
* 8499 - DNS Terminology
|
||||
* 8659 - DNS Certification Authority Authorization (CAA) Resource Record
|
||||
* 8777 - DNS Reverse IP Automatic Multicast Tunneling (AMT) Discovery
|
||||
* 8914 - Extended DNS Errors
|
||||
* 8976 - Message Digest for DNS Zones (ZONEMD RR)
|
||||
* 9460 - Service Binding and Parameter Specification via the DNS
|
||||
* 9461 - Service Binding Mapping for DNS Servers
|
||||
* 9462 - Discovery of Designated Resolvers
|
||||
* 9460 - SVCB and HTTPS Records
|
||||
* 9606 - DNS Resolver Information
|
||||
* Draft - Compact Denial of Existence in DNSSEC
|
||||
|
||||
## Loosely Based Upon
|
||||
|
||||
|
8
vendor/github.com/miekg/dns/defaults.go
generated
vendored
8
vendor/github.com/miekg/dns/defaults.go
generated
vendored
@@ -198,10 +198,12 @@ func IsDomainName(s string) (labels int, ok bool) {
|
||||
off int
|
||||
begin int
|
||||
wasDot bool
|
||||
escape bool
|
||||
)
|
||||
for i := 0; i < len(s); i++ {
|
||||
switch s[i] {
|
||||
case '\\':
|
||||
escape = !escape
|
||||
if off+1 > lenmsg {
|
||||
return labels, false
|
||||
}
|
||||
@@ -217,6 +219,7 @@ func IsDomainName(s string) (labels int, ok bool) {
|
||||
|
||||
wasDot = false
|
||||
case '.':
|
||||
escape = false
|
||||
if i == 0 && len(s) > 1 {
|
||||
// leading dots are not legal except for the root zone
|
||||
return labels, false
|
||||
@@ -243,10 +246,13 @@ func IsDomainName(s string) (labels int, ok bool) {
|
||||
labels++
|
||||
begin = i + 1
|
||||
default:
|
||||
escape = false
|
||||
wasDot = false
|
||||
}
|
||||
}
|
||||
|
||||
if escape {
|
||||
return labels, false
|
||||
}
|
||||
return labels, true
|
||||
}
|
||||
|
||||
|
42
vendor/github.com/miekg/dns/dnssec.go
generated
vendored
42
vendor/github.com/miekg/dns/dnssec.go
generated
vendored
@@ -250,14 +250,6 @@ func (d *DS) ToCDS() *CDS {
|
||||
// zero, it is used as-is, otherwise the TTL of the RRset is used as the
|
||||
// OrigTTL.
|
||||
func (rr *RRSIG) Sign(k crypto.Signer, rrset []RR) error {
|
||||
if k == nil {
|
||||
return ErrPrivKey
|
||||
}
|
||||
// s.Inception and s.Expiration may be 0 (rollover etc.), the rest must be set
|
||||
if rr.KeyTag == 0 || len(rr.SignerName) == 0 || rr.Algorithm == 0 {
|
||||
return ErrKey
|
||||
}
|
||||
|
||||
h0 := rrset[0].Header()
|
||||
rr.Hdr.Rrtype = TypeRRSIG
|
||||
rr.Hdr.Name = h0.Name
|
||||
@@ -272,6 +264,18 @@ func (rr *RRSIG) Sign(k crypto.Signer, rrset []RR) error {
|
||||
rr.Labels-- // wildcard, remove from label count
|
||||
}
|
||||
|
||||
return rr.signAsIs(k, rrset)
|
||||
}
|
||||
|
||||
func (rr *RRSIG) signAsIs(k crypto.Signer, rrset []RR) error {
|
||||
if k == nil {
|
||||
return ErrPrivKey
|
||||
}
|
||||
// s.Inception and s.Expiration may be 0 (rollover etc.), the rest must be set
|
||||
if rr.KeyTag == 0 || len(rr.SignerName) == 0 || rr.Algorithm == 0 {
|
||||
return ErrKey
|
||||
}
|
||||
|
||||
sigwire := new(rrsigWireFmt)
|
||||
sigwire.TypeCovered = rr.TypeCovered
|
||||
sigwire.Algorithm = rr.Algorithm
|
||||
@@ -370,9 +374,12 @@ func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error {
|
||||
if rr.Algorithm != k.Algorithm {
|
||||
return ErrKey
|
||||
}
|
||||
if !strings.EqualFold(rr.SignerName, k.Hdr.Name) {
|
||||
|
||||
signerName := CanonicalName(rr.SignerName)
|
||||
if !equal(signerName, k.Hdr.Name) {
|
||||
return ErrKey
|
||||
}
|
||||
|
||||
if k.Protocol != 3 {
|
||||
return ErrKey
|
||||
}
|
||||
@@ -384,9 +391,18 @@ func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error {
|
||||
}
|
||||
|
||||
// IsRRset checked that we have at least one RR and that the RRs in
|
||||
// the set have consistent type, class, and name. Also check that type and
|
||||
// class matches the RRSIG record.
|
||||
if h0 := rrset[0].Header(); h0.Class != rr.Hdr.Class || h0.Rrtype != rr.TypeCovered {
|
||||
// the set have consistent type, class, and name. Also check that type,
|
||||
// class and name matches the RRSIG record.
|
||||
// Also checks RFC 4035 5.3.1 the number of labels in the RRset owner
|
||||
// name MUST be greater than or equal to the value in the RRSIG RR's Labels field.
|
||||
// RFC 4035 5.3.1 Signer's Name MUST be the name of the zone that [contains the RRset].
|
||||
// Since we don't have SOA info, checking suffix may be the best we can do...?
|
||||
if h0 := rrset[0].Header(); h0.Class != rr.Hdr.Class ||
|
||||
h0.Rrtype != rr.TypeCovered ||
|
||||
uint8(CountLabel(h0.Name)) < rr.Labels ||
|
||||
!equal(h0.Name, rr.Hdr.Name) ||
|
||||
!strings.HasSuffix(CanonicalName(h0.Name), signerName) {
|
||||
|
||||
return ErrRRset
|
||||
}
|
||||
|
||||
@@ -400,7 +416,7 @@ func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error {
|
||||
sigwire.Expiration = rr.Expiration
|
||||
sigwire.Inception = rr.Inception
|
||||
sigwire.KeyTag = rr.KeyTag
|
||||
sigwire.SignerName = CanonicalName(rr.SignerName)
|
||||
sigwire.SignerName = signerName
|
||||
// Create the desired binary blob
|
||||
signeddata := make([]byte, DefaultMsgSize)
|
||||
n, err := packSigWire(sigwire, signeddata)
|
||||
|
135
vendor/github.com/miekg/dns/edns.go
generated
vendored
135
vendor/github.com/miekg/dns/edns.go
generated
vendored
@@ -27,6 +27,7 @@ const (
|
||||
EDNS0LOCALSTART = 0xFDE9 // Beginning of range reserved for local/experimental use (See RFC 6891)
|
||||
EDNS0LOCALEND = 0xFFFE // End of range reserved for local/experimental use (See RFC 6891)
|
||||
_DO = 1 << 15 // DNSSEC OK
|
||||
_CO = 1 << 14 // Compact Answers OK
|
||||
)
|
||||
|
||||
// makeDataOpt is used to unpack the EDNS0 option(s) from a message.
|
||||
@@ -58,7 +59,7 @@ func makeDataOpt(code uint16) EDNS0 {
|
||||
case EDNS0EDE:
|
||||
return new(EDNS0_EDE)
|
||||
case EDNS0ESU:
|
||||
return &EDNS0_ESU{Code: EDNS0ESU}
|
||||
return new(EDNS0_ESU)
|
||||
default:
|
||||
e := new(EDNS0_LOCAL)
|
||||
e.Code = code
|
||||
@@ -66,8 +67,7 @@ func makeDataOpt(code uint16) EDNS0 {
|
||||
}
|
||||
}
|
||||
|
||||
// OPT is the EDNS0 RR appended to messages to convey extra (meta) information.
|
||||
// See RFC 6891.
|
||||
// OPT is the EDNS0 RR appended to messages to convey extra (meta) information. See RFC 6891.
|
||||
type OPT struct {
|
||||
Hdr RR_Header
|
||||
Option []EDNS0 `dns:"opt"`
|
||||
@@ -76,7 +76,11 @@ type OPT struct {
|
||||
func (rr *OPT) String() string {
|
||||
s := "\n;; OPT PSEUDOSECTION:\n; EDNS: version " + strconv.Itoa(int(rr.Version())) + "; "
|
||||
if rr.Do() {
|
||||
s += "flags: do; "
|
||||
if rr.Co() {
|
||||
s += "flags: do, co; "
|
||||
} else {
|
||||
s += "flags: do; "
|
||||
}
|
||||
} else {
|
||||
s += "flags:; "
|
||||
}
|
||||
@@ -144,8 +148,6 @@ func (*OPT) parse(c *zlexer, origin string) *ParseError {
|
||||
|
||||
func (rr *OPT) isDuplicate(r2 RR) bool { return false }
|
||||
|
||||
// return the old value -> delete SetVersion?
|
||||
|
||||
// Version returns the EDNS version used. Only zero is defined.
|
||||
func (rr *OPT) Version() uint8 {
|
||||
return uint8(rr.Hdr.Ttl & 0x00FF0000 >> 16)
|
||||
@@ -198,14 +200,34 @@ func (rr *OPT) SetDo(do ...bool) {
|
||||
}
|
||||
}
|
||||
|
||||
// Z returns the Z part of the OPT RR as a uint16 with only the 15 least significant bits used.
|
||||
func (rr *OPT) Z() uint16 {
|
||||
return uint16(rr.Hdr.Ttl & 0x7FFF)
|
||||
// Co returns the value of the CO (Compact Answers OK) bit.
|
||||
func (rr *OPT) Co() bool {
|
||||
return rr.Hdr.Ttl&_CO == _CO
|
||||
}
|
||||
|
||||
// SetZ sets the Z part of the OPT RR, note only the 15 least significant bits of z are used.
|
||||
// SetCo sets the CO (Compact Answers OK) bit.
|
||||
// If we pass an argument, set the CO bit to that value.
|
||||
// It is possible to pass 2 or more arguments, but they will be ignored.
|
||||
func (rr *OPT) SetCo(co ...bool) {
|
||||
if len(co) == 1 {
|
||||
if co[0] {
|
||||
rr.Hdr.Ttl |= _CO
|
||||
} else {
|
||||
rr.Hdr.Ttl &^= _CO
|
||||
}
|
||||
} else {
|
||||
rr.Hdr.Ttl |= _CO
|
||||
}
|
||||
}
|
||||
|
||||
// Z returns the Z part of the OPT RR as a uint16 with only the 14 least significant bits used.
|
||||
func (rr *OPT) Z() uint16 {
|
||||
return uint16(rr.Hdr.Ttl & 0x3FFF)
|
||||
}
|
||||
|
||||
// SetZ sets the Z part of the OPT RR, note only the 14 least significant bits of z are used.
|
||||
func (rr *OPT) SetZ(z uint16) {
|
||||
rr.Hdr.Ttl = rr.Hdr.Ttl&^0x7FFF | uint32(z&0x7FFF)
|
||||
rr.Hdr.Ttl = rr.Hdr.Ttl&^0x3FFF | uint32(z&0x3FFF)
|
||||
}
|
||||
|
||||
// EDNS0 defines an EDNS0 Option. An OPT RR can have multiple options appended to it.
|
||||
@@ -236,8 +258,8 @@ type EDNS0 interface {
|
||||
// e.Nsid = "AA"
|
||||
// o.Option = append(o.Option, e)
|
||||
type EDNS0_NSID struct {
|
||||
Code uint16 // Always EDNS0NSID
|
||||
Nsid string // This string needs to be hex encoded
|
||||
Code uint16 // always EDNS0NSID
|
||||
Nsid string // string needs to be hex encoded
|
||||
}
|
||||
|
||||
func (e *EDNS0_NSID) pack() ([]byte, error) {
|
||||
@@ -275,7 +297,7 @@ func (e *EDNS0_NSID) copy() EDNS0 { return &EDNS0_NSID{e.Code, e.Nsid}
|
||||
// When packing it will apply SourceNetmask. If you need more advanced logic,
|
||||
// patches welcome and good luck.
|
||||
type EDNS0_SUBNET struct {
|
||||
Code uint16 // Always EDNS0SUBNET
|
||||
Code uint16 // always EDNS0SUBNET
|
||||
Family uint16 // 1 for IP, 2 for IP6
|
||||
SourceNetmask uint8
|
||||
SourceScope uint8
|
||||
@@ -399,8 +421,8 @@ func (e *EDNS0_SUBNET) copy() EDNS0 {
|
||||
//
|
||||
// There is no guarantee that the Cookie string has a specific length.
|
||||
type EDNS0_COOKIE struct {
|
||||
Code uint16 // Always EDNS0COOKIE
|
||||
Cookie string // Hex-encoded cookie data
|
||||
Code uint16 // always EDNS0COOKIE
|
||||
Cookie string // hex encoded cookie data
|
||||
}
|
||||
|
||||
func (e *EDNS0_COOKIE) pack() ([]byte, error) {
|
||||
@@ -430,7 +452,7 @@ func (e *EDNS0_COOKIE) copy() EDNS0 { return &EDNS0_COOKIE{e.Code, e.C
|
||||
// e.Lease = 120 // in seconds
|
||||
// o.Option = append(o.Option, e)
|
||||
type EDNS0_UL struct {
|
||||
Code uint16 // Always EDNS0UL
|
||||
Code uint16 // always EDNS0UL
|
||||
Lease uint32
|
||||
KeyLease uint32
|
||||
}
|
||||
@@ -469,7 +491,7 @@ func (e *EDNS0_UL) unpack(b []byte) error {
|
||||
// EDNS0_LLQ stands for Long Lived Queries: http://tools.ietf.org/html/draft-sekar-dns-llq-01
|
||||
// Implemented for completeness, as the EDNS0 type code is assigned.
|
||||
type EDNS0_LLQ struct {
|
||||
Code uint16 // Always EDNS0LLQ
|
||||
Code uint16 // always EDNS0LLQ
|
||||
Version uint16
|
||||
Opcode uint16
|
||||
Error uint16
|
||||
@@ -515,7 +537,7 @@ func (e *EDNS0_LLQ) copy() EDNS0 {
|
||||
|
||||
// EDNS0_DAU implements the EDNS0 "DNSSEC Algorithm Understood" option. See RFC 6975.
|
||||
type EDNS0_DAU struct {
|
||||
Code uint16 // Always EDNS0DAU
|
||||
Code uint16 // always EDNS0DAU
|
||||
AlgCode []uint8
|
||||
}
|
||||
|
||||
@@ -539,7 +561,7 @@ func (e *EDNS0_DAU) copy() EDNS0 { return &EDNS0_DAU{e.Code, e.AlgCode} }
|
||||
|
||||
// EDNS0_DHU implements the EDNS0 "DS Hash Understood" option. See RFC 6975.
|
||||
type EDNS0_DHU struct {
|
||||
Code uint16 // Always EDNS0DHU
|
||||
Code uint16 // always EDNS0DHU
|
||||
AlgCode []uint8
|
||||
}
|
||||
|
||||
@@ -563,7 +585,7 @@ func (e *EDNS0_DHU) copy() EDNS0 { return &EDNS0_DHU{e.Code, e.AlgCode} }
|
||||
|
||||
// EDNS0_N3U implements the EDNS0 "NSEC3 Hash Understood" option. See RFC 6975.
|
||||
type EDNS0_N3U struct {
|
||||
Code uint16 // Always EDNS0N3U
|
||||
Code uint16 // always EDNS0N3U
|
||||
AlgCode []uint8
|
||||
}
|
||||
|
||||
@@ -588,7 +610,7 @@ func (e *EDNS0_N3U) copy() EDNS0 { return &EDNS0_N3U{e.Code, e.AlgCode} }
|
||||
|
||||
// EDNS0_EXPIRE implements the EDNS0 option as described in RFC 7314.
|
||||
type EDNS0_EXPIRE struct {
|
||||
Code uint16 // Always EDNS0EXPIRE
|
||||
Code uint16 // always EDNS0EXPIRE
|
||||
Expire uint32
|
||||
Empty bool // Empty is used to signal an empty Expire option in a backwards compatible way, it's not used on the wire.
|
||||
}
|
||||
@@ -668,7 +690,7 @@ func (e *EDNS0_LOCAL) unpack(b []byte) error {
|
||||
// EDNS0_TCP_KEEPALIVE is an EDNS0 option that instructs the server to keep
|
||||
// the TCP connection alive. See RFC 7828.
|
||||
type EDNS0_TCP_KEEPALIVE struct {
|
||||
Code uint16 // Always EDNSTCPKEEPALIVE
|
||||
Code uint16 // always EDNSTCPKEEPALIVE
|
||||
|
||||
// Timeout is an idle timeout value for the TCP connection, specified in
|
||||
// units of 100 milliseconds, encoded in network byte order. If set to 0,
|
||||
@@ -756,36 +778,48 @@ const (
|
||||
ExtendedErrorCodeNoReachableAuthority
|
||||
ExtendedErrorCodeNetworkError
|
||||
ExtendedErrorCodeInvalidData
|
||||
ExtendedErrorCodeSignatureExpiredBeforeValid
|
||||
ExtendedErrorCodeTooEarly
|
||||
ExtendedErrorCodeUnsupportedNSEC3IterValue
|
||||
ExtendedErrorCodeUnableToConformToPolicy
|
||||
ExtendedErrorCodeSynthesized
|
||||
ExtendedErrorCodeInvalidQueryType
|
||||
)
|
||||
|
||||
// ExtendedErrorCodeToString maps extended error info codes to a human readable
|
||||
// description.
|
||||
var ExtendedErrorCodeToString = map[uint16]string{
|
||||
ExtendedErrorCodeOther: "Other",
|
||||
ExtendedErrorCodeUnsupportedDNSKEYAlgorithm: "Unsupported DNSKEY Algorithm",
|
||||
ExtendedErrorCodeUnsupportedDSDigestType: "Unsupported DS Digest Type",
|
||||
ExtendedErrorCodeStaleAnswer: "Stale Answer",
|
||||
ExtendedErrorCodeForgedAnswer: "Forged Answer",
|
||||
ExtendedErrorCodeDNSSECIndeterminate: "DNSSEC Indeterminate",
|
||||
ExtendedErrorCodeDNSBogus: "DNSSEC Bogus",
|
||||
ExtendedErrorCodeSignatureExpired: "Signature Expired",
|
||||
ExtendedErrorCodeSignatureNotYetValid: "Signature Not Yet Valid",
|
||||
ExtendedErrorCodeDNSKEYMissing: "DNSKEY Missing",
|
||||
ExtendedErrorCodeRRSIGsMissing: "RRSIGs Missing",
|
||||
ExtendedErrorCodeNoZoneKeyBitSet: "No Zone Key Bit Set",
|
||||
ExtendedErrorCodeNSECMissing: "NSEC Missing",
|
||||
ExtendedErrorCodeCachedError: "Cached Error",
|
||||
ExtendedErrorCodeNotReady: "Not Ready",
|
||||
ExtendedErrorCodeBlocked: "Blocked",
|
||||
ExtendedErrorCodeCensored: "Censored",
|
||||
ExtendedErrorCodeFiltered: "Filtered",
|
||||
ExtendedErrorCodeProhibited: "Prohibited",
|
||||
ExtendedErrorCodeStaleNXDOMAINAnswer: "Stale NXDOMAIN Answer",
|
||||
ExtendedErrorCodeNotAuthoritative: "Not Authoritative",
|
||||
ExtendedErrorCodeNotSupported: "Not Supported",
|
||||
ExtendedErrorCodeNoReachableAuthority: "No Reachable Authority",
|
||||
ExtendedErrorCodeNetworkError: "Network Error",
|
||||
ExtendedErrorCodeInvalidData: "Invalid Data",
|
||||
ExtendedErrorCodeOther: "Other",
|
||||
ExtendedErrorCodeUnsupportedDNSKEYAlgorithm: "Unsupported DNSKEY Algorithm",
|
||||
ExtendedErrorCodeUnsupportedDSDigestType: "Unsupported DS Digest Type",
|
||||
ExtendedErrorCodeStaleAnswer: "Stale Answer",
|
||||
ExtendedErrorCodeForgedAnswer: "Forged Answer",
|
||||
ExtendedErrorCodeDNSSECIndeterminate: "DNSSEC Indeterminate",
|
||||
ExtendedErrorCodeDNSBogus: "DNSSEC Bogus",
|
||||
ExtendedErrorCodeSignatureExpired: "Signature Expired",
|
||||
ExtendedErrorCodeSignatureNotYetValid: "Signature Not Yet Valid",
|
||||
ExtendedErrorCodeDNSKEYMissing: "DNSKEY Missing",
|
||||
ExtendedErrorCodeRRSIGsMissing: "RRSIGs Missing",
|
||||
ExtendedErrorCodeNoZoneKeyBitSet: "No Zone Key Bit Set",
|
||||
ExtendedErrorCodeNSECMissing: "NSEC Missing",
|
||||
ExtendedErrorCodeCachedError: "Cached Error",
|
||||
ExtendedErrorCodeNotReady: "Not Ready",
|
||||
ExtendedErrorCodeBlocked: "Blocked",
|
||||
ExtendedErrorCodeCensored: "Censored",
|
||||
ExtendedErrorCodeFiltered: "Filtered",
|
||||
ExtendedErrorCodeProhibited: "Prohibited",
|
||||
ExtendedErrorCodeStaleNXDOMAINAnswer: "Stale NXDOMAIN Answer",
|
||||
ExtendedErrorCodeNotAuthoritative: "Not Authoritative",
|
||||
ExtendedErrorCodeNotSupported: "Not Supported",
|
||||
ExtendedErrorCodeNoReachableAuthority: "No Reachable Authority",
|
||||
ExtendedErrorCodeNetworkError: "Network Error",
|
||||
ExtendedErrorCodeInvalidData: "Invalid Data",
|
||||
ExtendedErrorCodeSignatureExpiredBeforeValid: "Signature Expired Before Valid",
|
||||
ExtendedErrorCodeTooEarly: "Too Early",
|
||||
ExtendedErrorCodeUnsupportedNSEC3IterValue: "Unsupported NSEC3 Iterations Value",
|
||||
ExtendedErrorCodeUnableToConformToPolicy: "Unable To Conform To Policy",
|
||||
ExtendedErrorCodeSynthesized: "Synthesized",
|
||||
ExtendedErrorCodeInvalidQueryType: "Invalid Query Type",
|
||||
}
|
||||
|
||||
// StringToExtendedErrorCode is a map from human readable descriptions to
|
||||
@@ -827,13 +861,12 @@ func (e *EDNS0_EDE) unpack(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// The EDNS0_ESU option for ENUM Source-URI Extension
|
||||
// The EDNS0_ESU option for ENUM Source-URI Extension.
|
||||
type EDNS0_ESU struct {
|
||||
Code uint16
|
||||
Code uint16 // always EDNS0ESU
|
||||
Uri string
|
||||
}
|
||||
|
||||
// Option implements the EDNS0 interface.
|
||||
func (e *EDNS0_ESU) Option() uint16 { return EDNS0ESU }
|
||||
func (e *EDNS0_ESU) String() string { return e.Uri }
|
||||
func (e *EDNS0_ESU) copy() EDNS0 { return &EDNS0_ESU{e.Code, e.Uri} }
|
||||
|
@@ -3,9 +3,15 @@
|
||||
|
||||
package dns
|
||||
|
||||
import "net"
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
)
|
||||
|
||||
const supportsReusePort = false
|
||||
const (
|
||||
supportsReusePort = false
|
||||
supportsReuseAddr = false
|
||||
)
|
||||
|
||||
func listenTCP(network, addr string, reuseport, reuseaddr bool) (net.Listener, error) {
|
||||
if reuseport || reuseaddr {
|
||||
@@ -15,8 +21,6 @@ func listenTCP(network, addr string, reuseport, reuseaddr bool) (net.Listener, e
|
||||
return net.Listen(network, addr)
|
||||
}
|
||||
|
||||
const supportsReuseAddr = false
|
||||
|
||||
func listenUDP(network, addr string, reuseport, reuseaddr bool) (net.PacketConn, error) {
|
||||
if reuseport || reuseaddr {
|
||||
// TODO(tmthrgd): return an error?
|
||||
@@ -24,3 +28,13 @@ func listenUDP(network, addr string, reuseport, reuseaddr bool) (net.PacketConn,
|
||||
|
||||
return net.ListenPacket(network, addr)
|
||||
}
|
||||
|
||||
// this is just for test compatibility
|
||||
func checkReuseport(fd uintptr) (bool, error) {
|
||||
return false, fmt.Errorf("not supported")
|
||||
}
|
||||
|
||||
// this is just for test compatibility
|
||||
func checkReuseaddr(fd uintptr) (bool, error) {
|
||||
return false, fmt.Errorf("not supported")
|
||||
}
|
@@ -39,10 +39,40 @@ func reuseaddrControl(network, address string, c syscall.RawConn) error {
|
||||
return opErr
|
||||
}
|
||||
|
||||
func reuseaddrandportControl(network, address string, c syscall.RawConn) error {
|
||||
err := reuseaddrControl(network, address, c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return reuseportControl(network, address, c)
|
||||
}
|
||||
|
||||
// this is just for test compatibility
|
||||
func checkReuseport(fd uintptr) (bool, error) {
|
||||
v, err := unix.GetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return v == 1, nil
|
||||
}
|
||||
|
||||
// this is just for test compatibility
|
||||
func checkReuseaddr(fd uintptr) (bool, error) {
|
||||
v, err := unix.GetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return v == 1, nil
|
||||
}
|
||||
|
||||
func listenTCP(network, addr string, reuseport, reuseaddr bool) (net.Listener, error) {
|
||||
var lc net.ListenConfig
|
||||
switch {
|
||||
case reuseaddr && reuseport:
|
||||
lc.Control = reuseaddrandportControl
|
||||
case reuseport:
|
||||
lc.Control = reuseportControl
|
||||
case reuseaddr:
|
||||
@@ -56,6 +86,7 @@ func listenUDP(network, addr string, reuseport, reuseaddr bool) (net.PacketConn,
|
||||
var lc net.ListenConfig
|
||||
switch {
|
||||
case reuseaddr && reuseport:
|
||||
lc.Control = reuseaddrandportControl
|
||||
case reuseport:
|
||||
lc.Control = reuseportControl
|
||||
case reuseaddr:
|
28
vendor/github.com/miekg/dns/msg.go
generated
vendored
28
vendor/github.com/miekg/dns/msg.go
generated
vendored
@@ -136,18 +136,19 @@ var OpcodeToString = map[int]string{
|
||||
|
||||
// RcodeToString maps Rcodes to strings.
|
||||
var RcodeToString = map[int]string{
|
||||
RcodeSuccess: "NOERROR",
|
||||
RcodeFormatError: "FORMERR",
|
||||
RcodeServerFailure: "SERVFAIL",
|
||||
RcodeNameError: "NXDOMAIN",
|
||||
RcodeNotImplemented: "NOTIMP",
|
||||
RcodeRefused: "REFUSED",
|
||||
RcodeYXDomain: "YXDOMAIN", // See RFC 2136
|
||||
RcodeYXRrset: "YXRRSET",
|
||||
RcodeNXRrset: "NXRRSET",
|
||||
RcodeNotAuth: "NOTAUTH",
|
||||
RcodeNotZone: "NOTZONE",
|
||||
RcodeBadSig: "BADSIG", // Also known as RcodeBadVers, see RFC 6891
|
||||
RcodeSuccess: "NOERROR",
|
||||
RcodeFormatError: "FORMERR",
|
||||
RcodeServerFailure: "SERVFAIL",
|
||||
RcodeNameError: "NXDOMAIN",
|
||||
RcodeNotImplemented: "NOTIMP",
|
||||
RcodeRefused: "REFUSED",
|
||||
RcodeYXDomain: "YXDOMAIN", // See RFC 2136
|
||||
RcodeYXRrset: "YXRRSET",
|
||||
RcodeNXRrset: "NXRRSET",
|
||||
RcodeNotAuth: "NOTAUTH",
|
||||
RcodeNotZone: "NOTZONE",
|
||||
RcodeStatefulTypeNotImplemented: "DSOTYPENI",
|
||||
RcodeBadSig: "BADSIG", // Also known as RcodeBadVers, see RFC 6891
|
||||
// RcodeBadVers: "BADVERS",
|
||||
RcodeBadKey: "BADKEY",
|
||||
RcodeBadTime: "BADTIME",
|
||||
@@ -714,7 +715,7 @@ func (h *MsgHdr) String() string {
|
||||
return s
|
||||
}
|
||||
|
||||
// Pack packs a Msg: it is converted to to wire format.
|
||||
// Pack packs a Msg: it is converted to wire format.
|
||||
// If the dns.Compress is true the message will be in compressed wire format.
|
||||
func (dns *Msg) Pack() (msg []byte, err error) {
|
||||
return dns.PackBuffer(nil)
|
||||
@@ -874,7 +875,6 @@ func (dns *Msg) unpack(dh Header, msg []byte, off int) (err error) {
|
||||
// // println("dns: extra bytes in dns packet", off, "<", len(msg))
|
||||
// }
|
||||
return err
|
||||
|
||||
}
|
||||
|
||||
// Unpack unpacks a binary message to a Msg structure.
|
||||
|
5
vendor/github.com/miekg/dns/reverse.go
generated
vendored
5
vendor/github.com/miekg/dns/reverse.go
generated
vendored
@@ -23,9 +23,12 @@ var StringToAlgorithm = reverseInt8(AlgorithmToString)
|
||||
// StringToHash is a map of names to hash IDs.
|
||||
var StringToHash = reverseInt8(HashToString)
|
||||
|
||||
// StringToCertType is the reverseof CertTypeToString.
|
||||
// StringToCertType is the reverse of CertTypeToString.
|
||||
var StringToCertType = reverseInt16(CertTypeToString)
|
||||
|
||||
// StringToStatefulType is the reverse of StatefulTypeToString.
|
||||
var StringToStatefulType = reverseInt16(StatefulTypeToString)
|
||||
|
||||
// Reverse a map
|
||||
func reverseInt8(m map[uint8]string) map[string]uint8 {
|
||||
n := make(map[string]uint8, len(m))
|
||||
|
20
vendor/github.com/miekg/dns/scan.go
generated
vendored
20
vendor/github.com/miekg/dns/scan.go
generated
vendored
@@ -101,12 +101,15 @@ type ttlState struct {
|
||||
isByDirective bool // isByDirective indicates whether ttl was set by a $TTL directive
|
||||
}
|
||||
|
||||
// NewRR reads the RR contained in the string s. Only the first RR is returned.
|
||||
// NewRR reads a string s and returns the first RR.
|
||||
// If s contains no records, NewRR will return nil with no error.
|
||||
//
|
||||
// The class defaults to IN and TTL defaults to 3600. The full zone file syntax
|
||||
// like $TTL, $ORIGIN, etc. is supported. All fields of the returned RR are
|
||||
// set, except RR.Header().Rdlength which is set to 0.
|
||||
// The class defaults to IN, TTL defaults to 3600, and
|
||||
// origin for resolving relative domain names defaults to the DNS root (.).
|
||||
// Full zone file syntax is supported, including directives like $TTL and $ORIGIN.
|
||||
// All fields of the returned RR are set from the read data, except RR.Header().Rdlength which is set to 0.
|
||||
// Is you need a partial resource record with no rdata - for instance - for dynamic updates, see the [ANY]
|
||||
// documentation.
|
||||
func NewRR(s string) (RR, error) {
|
||||
if len(s) > 0 && s[len(s)-1] != '\n' { // We need a closing newline
|
||||
return ReadRR(strings.NewReader(s+"\n"), "")
|
||||
@@ -1282,7 +1285,7 @@ func stringToCm(token string) (e, m uint8, ok bool) {
|
||||
cmeters *= 10
|
||||
}
|
||||
}
|
||||
// This slighly ugly condition will allow omitting the 'meter' part, like .01 (meaning 0.01m = 1cm).
|
||||
// This slightly ugly condition will allow omitting the 'meter' part, like .01 (meaning 0.01m = 1cm).
|
||||
if !hasCM || mStr != "" {
|
||||
meters, err = strconv.Atoi(mStr)
|
||||
// RFC1876 states the max value is 90000000.00. The latter two conditions enforce it.
|
||||
@@ -1315,6 +1318,13 @@ func toAbsoluteName(name, origin string) (absolute string, ok bool) {
|
||||
return origin, true
|
||||
}
|
||||
|
||||
// this can happen when we have a comment after a RR that has a domain, '... MX 20 ; this is wrong'.
|
||||
// technically a newline can be in a domain name, but this is clearly an error and the newline only shows
|
||||
// because of the scanning and the comment.
|
||||
if name == "\n" {
|
||||
return "", false
|
||||
}
|
||||
|
||||
// require a valid domain name
|
||||
_, ok = IsDomainName(name)
|
||||
if !ok || name == "" {
|
||||
|
79
vendor/github.com/miekg/dns/scan_rr.go
generated
vendored
79
vendor/github.com/miekg/dns/scan_rr.go
generated
vendored
@@ -51,25 +51,24 @@ func endingToTxtSlice(c *zlexer, errstr string) ([]string, *ParseError) {
|
||||
switch l.value {
|
||||
case zString:
|
||||
empty = false
|
||||
if len(l.token) > 255 {
|
||||
// split up tokens that are larger than 255 into 255-chunks
|
||||
sx := []string{}
|
||||
p, i := 0, 255
|
||||
for {
|
||||
if i <= len(l.token) {
|
||||
sx = append(sx, l.token[p:i])
|
||||
} else {
|
||||
sx = append(sx, l.token[p:])
|
||||
break
|
||||
|
||||
}
|
||||
p, i = p+255, i+255
|
||||
// split up tokens that are larger than 255 into 255-chunks
|
||||
sx := []string{}
|
||||
p := 0
|
||||
for {
|
||||
i, ok := escapedStringOffset(l.token[p:], 255)
|
||||
if !ok {
|
||||
return nil, &ParseError{err: errstr, lex: l}
|
||||
}
|
||||
s = append(s, sx...)
|
||||
break
|
||||
}
|
||||
if i != -1 && p+i != len(l.token) {
|
||||
sx = append(sx, l.token[p:p+i])
|
||||
} else {
|
||||
sx = append(sx, l.token[p:])
|
||||
break
|
||||
|
||||
s = append(s, l.token)
|
||||
}
|
||||
p += i
|
||||
}
|
||||
s = append(s, sx...)
|
||||
case zBlank:
|
||||
if quote {
|
||||
// zBlank can only be seen in between txt parts.
|
||||
@@ -1621,6 +1620,16 @@ func (rr *NINFO) parse(c *zlexer, o string) *ParseError {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Uses the same format as TXT
|
||||
func (rr *RESINFO) parse(c *zlexer, o string) *ParseError {
|
||||
s, e := endingToTxtSlice(c, "bad RESINFO Resinfo")
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
rr.Txt = s
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rr *URI) parse(c *zlexer, o string) *ParseError {
|
||||
l, _ := c.Next()
|
||||
i, e := strconv.ParseUint(l.token, 10, 16)
|
||||
@@ -1920,3 +1929,39 @@ func (rr *APL) parse(c *zlexer, o string) *ParseError {
|
||||
rr.Prefixes = prefixes
|
||||
return nil
|
||||
}
|
||||
|
||||
// escapedStringOffset finds the offset within a string (which may contain escape
|
||||
// sequences) that corresponds to a certain byte offset. If the input offset is
|
||||
// out of bounds, -1 is returned (which is *not* considered an error).
|
||||
func escapedStringOffset(s string, desiredByteOffset int) (int, bool) {
|
||||
if desiredByteOffset == 0 {
|
||||
return 0, true
|
||||
}
|
||||
|
||||
currentByteOffset, i := 0, 0
|
||||
|
||||
for i < len(s) {
|
||||
currentByteOffset += 1
|
||||
|
||||
// Skip escape sequences
|
||||
if s[i] != '\\' {
|
||||
// Single plain byte, not an escape sequence.
|
||||
i++
|
||||
} else if isDDD(s[i+1:]) {
|
||||
// Skip backslash and DDD.
|
||||
i += 4
|
||||
} else if len(s[i+1:]) < 1 {
|
||||
// No character following the backslash; that's an error.
|
||||
return 0, false
|
||||
} else {
|
||||
// Skip backslash and following byte.
|
||||
i += 2
|
||||
}
|
||||
|
||||
if currentByteOffset >= desiredByteOffset {
|
||||
return i, true
|
||||
}
|
||||
}
|
||||
|
||||
return -1, true
|
||||
}
|
||||
|
20
vendor/github.com/miekg/dns/server.go
generated
vendored
20
vendor/github.com/miekg/dns/server.go
generated
vendored
@@ -188,6 +188,14 @@ type DecorateReader func(Reader) Reader
|
||||
// Implementations should never return a nil Writer.
|
||||
type DecorateWriter func(Writer) Writer
|
||||
|
||||
// MsgInvalidFunc is a listener hook for observing incoming messages that were discarded
|
||||
// because they could not be parsed.
|
||||
// Every message that is read by a Reader will eventually be provided to the Handler,
|
||||
// rejected (or ignored) by the MsgAcceptFunc, or passed to this function.
|
||||
type MsgInvalidFunc func(m []byte, err error)
|
||||
|
||||
func DefaultMsgInvalidFunc(m []byte, err error) {}
|
||||
|
||||
// A Server defines parameters for running an DNS server.
|
||||
type Server struct {
|
||||
// Address to listen on, ":dns" if empty.
|
||||
@@ -218,6 +226,7 @@ type Server struct {
|
||||
// If NotifyStartedFunc is set it is called once the server has started listening.
|
||||
NotifyStartedFunc func()
|
||||
// DecorateReader is optional, allows customization of the process that reads raw DNS messages.
|
||||
// The decorated reader must not mutate the data read from the conn.
|
||||
DecorateReader DecorateReader
|
||||
// DecorateWriter is optional, allows customization of the process that writes raw DNS messages.
|
||||
DecorateWriter DecorateWriter
|
||||
@@ -233,6 +242,8 @@ type Server struct {
|
||||
// AcceptMsgFunc will check the incoming message and will reject it early in the process.
|
||||
// By default DefaultMsgAcceptFunc will be used.
|
||||
MsgAcceptFunc MsgAcceptFunc
|
||||
// MsgInvalidFunc is optional, will be called if a message is received but cannot be parsed.
|
||||
MsgInvalidFunc MsgInvalidFunc
|
||||
|
||||
// Shutdown handling
|
||||
lock sync.RWMutex
|
||||
@@ -277,6 +288,9 @@ func (srv *Server) init() {
|
||||
if srv.MsgAcceptFunc == nil {
|
||||
srv.MsgAcceptFunc = DefaultMsgAcceptFunc
|
||||
}
|
||||
if srv.MsgInvalidFunc == nil {
|
||||
srv.MsgInvalidFunc = DefaultMsgInvalidFunc
|
||||
}
|
||||
if srv.Handler == nil {
|
||||
srv.Handler = DefaultServeMux
|
||||
}
|
||||
@@ -531,6 +545,7 @@ func (srv *Server) serveUDP(l net.PacketConn) error {
|
||||
if cap(m) == srv.UDPSize {
|
||||
srv.udpPool.Put(m[:srv.UDPSize])
|
||||
}
|
||||
srv.MsgInvalidFunc(m, ErrShortRead)
|
||||
continue
|
||||
}
|
||||
wg.Add(1)
|
||||
@@ -611,6 +626,7 @@ func (srv *Server) serveUDPPacket(wg *sync.WaitGroup, m []byte, u net.PacketConn
|
||||
func (srv *Server) serveDNS(m []byte, w *response) {
|
||||
dh, off, err := unpackMsgHdr(m, 0)
|
||||
if err != nil {
|
||||
srv.MsgInvalidFunc(m, err)
|
||||
// Let client hang, they are sending crap; any reply can be used to amplify.
|
||||
return
|
||||
}
|
||||
@@ -620,10 +636,12 @@ func (srv *Server) serveDNS(m []byte, w *response) {
|
||||
|
||||
switch action := srv.MsgAcceptFunc(dh); action {
|
||||
case MsgAccept:
|
||||
if req.unpack(dh, m, off) == nil {
|
||||
err := req.unpack(dh, m, off)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
|
||||
srv.MsgInvalidFunc(m, err)
|
||||
fallthrough
|
||||
case MsgReject, MsgRejectNotImplemented:
|
||||
opcode := req.Opcode
|
||||
|
3
vendor/github.com/miekg/dns/sig0.go
generated
vendored
3
vendor/github.com/miekg/dns/sig0.go
generated
vendored
@@ -7,7 +7,6 @@ import (
|
||||
"crypto/rsa"
|
||||
"encoding/binary"
|
||||
"math/big"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -151,7 +150,7 @@ func (rr *SIG) Verify(k *KEY, buf []byte) error {
|
||||
}
|
||||
// If key has come from the DNS name compression might
|
||||
// have mangled the case of the name
|
||||
if !strings.EqualFold(signername, k.Header().Name) {
|
||||
if !equal(signername, k.Header().Name) {
|
||||
return &Error{err: "signer name doesn't match key name"}
|
||||
}
|
||||
sigend := offset
|
||||
|
62
vendor/github.com/miekg/dns/svcb.go
generated
vendored
62
vendor/github.com/miekg/dns/svcb.go
generated
vendored
@@ -14,7 +14,7 @@ import (
|
||||
// SVCBKey is the type of the keys used in the SVCB RR.
|
||||
type SVCBKey uint16
|
||||
|
||||
// Keys defined in draft-ietf-dnsop-svcb-https-08 Section 14.3.2.
|
||||
// Keys defined in rfc9460
|
||||
const (
|
||||
SVCB_MANDATORY SVCBKey = iota
|
||||
SVCB_ALPN
|
||||
@@ -23,7 +23,8 @@ const (
|
||||
SVCB_IPV4HINT
|
||||
SVCB_ECHCONFIG
|
||||
SVCB_IPV6HINT
|
||||
SVCB_DOHPATH // draft-ietf-add-svcb-dns-02 Section 9
|
||||
SVCB_DOHPATH // rfc9461 Section 5
|
||||
SVCB_OHTTP // rfc9540 Section 8
|
||||
|
||||
svcb_RESERVED SVCBKey = 65535
|
||||
)
|
||||
@@ -37,6 +38,7 @@ var svcbKeyToStringMap = map[SVCBKey]string{
|
||||
SVCB_ECHCONFIG: "ech",
|
||||
SVCB_IPV6HINT: "ipv6hint",
|
||||
SVCB_DOHPATH: "dohpath",
|
||||
SVCB_OHTTP: "ohttp",
|
||||
}
|
||||
|
||||
var svcbStringToKeyMap = reverseSVCBKeyMap(svcbKeyToStringMap)
|
||||
@@ -201,6 +203,8 @@ func makeSVCBKeyValue(key SVCBKey) SVCBKeyValue {
|
||||
return new(SVCBIPv6Hint)
|
||||
case SVCB_DOHPATH:
|
||||
return new(SVCBDoHPath)
|
||||
case SVCB_OHTTP:
|
||||
return new(SVCBOhttp)
|
||||
case svcb_RESERVED:
|
||||
return nil
|
||||
default:
|
||||
@@ -210,11 +214,7 @@ func makeSVCBKeyValue(key SVCBKey) SVCBKeyValue {
|
||||
}
|
||||
}
|
||||
|
||||
// SVCB RR. See RFC xxxx (https://tools.ietf.org/html/draft-ietf-dnsop-svcb-https-08).
|
||||
//
|
||||
// NOTE: The HTTPS/SVCB RFCs are in the draft stage.
|
||||
// The API, including constants and types related to SVCBKeyValues, may
|
||||
// change in future versions in accordance with the latest drafts.
|
||||
// SVCB RR. See RFC 9460.
|
||||
type SVCB struct {
|
||||
Hdr RR_Header
|
||||
Priority uint16 // If zero, Value must be empty or discarded by the user of this library
|
||||
@@ -222,12 +222,8 @@ type SVCB struct {
|
||||
Value []SVCBKeyValue `dns:"pairs"`
|
||||
}
|
||||
|
||||
// HTTPS RR. Everything valid for SVCB applies to HTTPS as well.
|
||||
// HTTPS RR. See RFC 9460. Everything valid for SVCB applies to HTTPS as well.
|
||||
// Except that the HTTPS record is intended for use with the HTTP and HTTPS protocols.
|
||||
//
|
||||
// NOTE: The HTTPS/SVCB RFCs are in the draft stage.
|
||||
// The API, including constants and types related to SVCBKeyValues, may
|
||||
// change in future versions in accordance with the latest drafts.
|
||||
type HTTPS struct {
|
||||
SVCB
|
||||
}
|
||||
@@ -771,8 +767,8 @@ func (s *SVCBIPv6Hint) copy() SVCBKeyValue {
|
||||
// SVCBDoHPath pair is used to indicate the URI template that the
|
||||
// clients may use to construct a DNS over HTTPS URI.
|
||||
//
|
||||
// See RFC xxxx (https://datatracker.ietf.org/doc/html/draft-ietf-add-svcb-dns-02)
|
||||
// and RFC yyyy (https://datatracker.ietf.org/doc/html/draft-ietf-add-ddr-06).
|
||||
// See RFC 9461 (https://datatracker.ietf.org/doc/html/rfc9461)
|
||||
// and RFC 9462 (https://datatracker.ietf.org/doc/html/rfc9462).
|
||||
//
|
||||
// A basic example of using the dohpath option together with the alpn
|
||||
// option to indicate support for DNS over HTTPS on a certain path:
|
||||
@@ -816,6 +812,44 @@ func (s *SVCBDoHPath) copy() SVCBKeyValue {
|
||||
}
|
||||
}
|
||||
|
||||
// The "ohttp" SvcParamKey is used to indicate that a service described in a SVCB RR
|
||||
// can be accessed as a target using an associated gateway.
|
||||
// Both the presentation and wire-format values for the "ohttp" parameter MUST be empty.
|
||||
//
|
||||
// See RFC 9460 (https://datatracker.ietf.org/doc/html/rfc9460/)
|
||||
// and RFC 9230 (https://datatracker.ietf.org/doc/html/rfc9230/)
|
||||
//
|
||||
// A basic example of using the dohpath option together with the alpn
|
||||
// option to indicate support for DNS over HTTPS on a certain path:
|
||||
//
|
||||
// s := new(dns.SVCB)
|
||||
// s.Hdr = dns.RR_Header{Name: ".", Rrtype: dns.TypeSVCB, Class: dns.ClassINET}
|
||||
// e := new(dns.SVCBAlpn)
|
||||
// e.Alpn = []string{"h2", "h3"}
|
||||
// p := new(dns.SVCBOhttp)
|
||||
// s.Value = append(s.Value, e, p)
|
||||
type SVCBOhttp struct{}
|
||||
|
||||
func (*SVCBOhttp) Key() SVCBKey { return SVCB_OHTTP }
|
||||
func (*SVCBOhttp) copy() SVCBKeyValue { return &SVCBOhttp{} }
|
||||
func (*SVCBOhttp) pack() ([]byte, error) { return []byte{}, nil }
|
||||
func (*SVCBOhttp) String() string { return "" }
|
||||
func (*SVCBOhttp) len() int { return 0 }
|
||||
|
||||
func (*SVCBOhttp) unpack(b []byte) error {
|
||||
if len(b) != 0 {
|
||||
return errors.New("dns: svcbotthp: svcbotthp must have no value")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (*SVCBOhttp) parse(b string) error {
|
||||
if b != "" {
|
||||
return errors.New("dns: svcbotthp: svcbotthp must have no value")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SVCBLocal pair is intended for experimental/private use. The key is recommended
|
||||
// to be in the range [SVCB_PRIVATE_LOWER, SVCB_PRIVATE_UPPER].
|
||||
// Basic use pattern for creating a keyNNNNN option:
|
||||
|
106
vendor/github.com/miekg/dns/types.go
generated
vendored
106
vendor/github.com/miekg/dns/types.go
generated
vendored
@@ -96,10 +96,12 @@ const (
|
||||
TypeLP uint16 = 107
|
||||
TypeEUI48 uint16 = 108
|
||||
TypeEUI64 uint16 = 109
|
||||
TypeNXNAME uint16 = 128
|
||||
TypeURI uint16 = 256
|
||||
TypeCAA uint16 = 257
|
||||
TypeAVC uint16 = 258
|
||||
TypeAMTRELAY uint16 = 260
|
||||
TypeRESINFO uint16 = 261
|
||||
|
||||
TypeTKEY uint16 = 249
|
||||
TypeTSIG uint16 = 250
|
||||
@@ -124,33 +126,35 @@ const (
|
||||
ClassANY = 255
|
||||
|
||||
// Message Response Codes, see https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml
|
||||
RcodeSuccess = 0 // NoError - No Error [DNS]
|
||||
RcodeFormatError = 1 // FormErr - Format Error [DNS]
|
||||
RcodeServerFailure = 2 // ServFail - Server Failure [DNS]
|
||||
RcodeNameError = 3 // NXDomain - Non-Existent Domain [DNS]
|
||||
RcodeNotImplemented = 4 // NotImp - Not Implemented [DNS]
|
||||
RcodeRefused = 5 // Refused - Query Refused [DNS]
|
||||
RcodeYXDomain = 6 // YXDomain - Name Exists when it should not [DNS Update]
|
||||
RcodeYXRrset = 7 // YXRRSet - RR Set Exists when it should not [DNS Update]
|
||||
RcodeNXRrset = 8 // NXRRSet - RR Set that should exist does not [DNS Update]
|
||||
RcodeNotAuth = 9 // NotAuth - Server Not Authoritative for zone [DNS Update]
|
||||
RcodeNotZone = 10 // NotZone - Name not contained in zone [DNS Update/TSIG]
|
||||
RcodeBadSig = 16 // BADSIG - TSIG Signature Failure [TSIG] https://www.rfc-editor.org/rfc/rfc6895.html#section-2.3
|
||||
RcodeBadVers = 16 // BADVERS - Bad OPT Version [EDNS0] https://www.rfc-editor.org/rfc/rfc6895.html#section-2.3
|
||||
RcodeBadKey = 17 // BADKEY - Key not recognized [TSIG]
|
||||
RcodeBadTime = 18 // BADTIME - Signature out of time window [TSIG]
|
||||
RcodeBadMode = 19 // BADMODE - Bad TKEY Mode [TKEY]
|
||||
RcodeBadName = 20 // BADNAME - Duplicate key name [TKEY]
|
||||
RcodeBadAlg = 21 // BADALG - Algorithm not supported [TKEY]
|
||||
RcodeBadTrunc = 22 // BADTRUNC - Bad Truncation [TSIG]
|
||||
RcodeBadCookie = 23 // BADCOOKIE - Bad/missing Server Cookie [DNS Cookies]
|
||||
RcodeSuccess = 0 // NoError - No Error [DNS]
|
||||
RcodeFormatError = 1 // FormErr - Format Error [DNS]
|
||||
RcodeServerFailure = 2 // ServFail - Server Failure [DNS]
|
||||
RcodeNameError = 3 // NXDomain - Non-Existent Domain [DNS]
|
||||
RcodeNotImplemented = 4 // NotImp - Not Implemented [DNS]
|
||||
RcodeRefused = 5 // Refused - Query Refused [DNS]
|
||||
RcodeYXDomain = 6 // YXDomain - Name Exists when it should not [DNS Update]
|
||||
RcodeYXRrset = 7 // YXRRSet - RR Set Exists when it should not [DNS Update]
|
||||
RcodeNXRrset = 8 // NXRRSet - RR Set that should exist does not [DNS Update]
|
||||
RcodeNotAuth = 9 // NotAuth - Server Not Authoritative for zone [DNS Update]
|
||||
RcodeNotZone = 10 // NotZone - Name not contained in zone [DNS Update/TSIG]
|
||||
RcodeStatefulTypeNotImplemented = 11 // DSOTypeNI - DSO-TYPE not implemented [DNS Stateful Operations] https://www.rfc-editor.org/rfc/rfc8490.html#section-10.2
|
||||
RcodeBadSig = 16 // BADSIG - TSIG Signature Failure [TSIG] https://www.rfc-editor.org/rfc/rfc6895.html#section-2.3
|
||||
RcodeBadVers = 16 // BADVERS - Bad OPT Version [EDNS0] https://www.rfc-editor.org/rfc/rfc6895.html#section-2.3
|
||||
RcodeBadKey = 17 // BADKEY - Key not recognized [TSIG]
|
||||
RcodeBadTime = 18 // BADTIME - Signature out of time window [TSIG]
|
||||
RcodeBadMode = 19 // BADMODE - Bad TKEY Mode [TKEY]
|
||||
RcodeBadName = 20 // BADNAME - Duplicate key name [TKEY]
|
||||
RcodeBadAlg = 21 // BADALG - Algorithm not supported [TKEY]
|
||||
RcodeBadTrunc = 22 // BADTRUNC - Bad Truncation [TSIG]
|
||||
RcodeBadCookie = 23 // BADCOOKIE - Bad/missing Server Cookie [DNS Cookies]
|
||||
|
||||
// Message Opcodes. There is no 3.
|
||||
OpcodeQuery = 0
|
||||
OpcodeIQuery = 1
|
||||
OpcodeStatus = 2
|
||||
OpcodeNotify = 4
|
||||
OpcodeUpdate = 5
|
||||
OpcodeQuery = 0
|
||||
OpcodeIQuery = 1
|
||||
OpcodeStatus = 2
|
||||
OpcodeNotify = 4
|
||||
OpcodeUpdate = 5
|
||||
OpcodeStateful = 6
|
||||
)
|
||||
|
||||
// Used in ZONEMD https://tools.ietf.org/html/rfc8976
|
||||
@@ -177,6 +181,19 @@ const (
|
||||
AMTRELAYHost = IPSECGatewayHost
|
||||
)
|
||||
|
||||
// Stateful types as defined in RFC 8490.
|
||||
const (
|
||||
StatefulTypeKeepAlive uint16 = iota + 1
|
||||
StatefulTypeRetryDelay
|
||||
StatefulTypeEncryptionPadding
|
||||
)
|
||||
|
||||
var StatefulTypeToString = map[uint16]string{
|
||||
StatefulTypeKeepAlive: "KeepAlive",
|
||||
StatefulTypeRetryDelay: "RetryDelay",
|
||||
StatefulTypeEncryptionPadding: "EncryptionPadding",
|
||||
}
|
||||
|
||||
// Header is the wire format for the DNS packet header.
|
||||
type Header struct {
|
||||
Id uint16
|
||||
@@ -266,11 +283,20 @@ func (q *Question) String() (s string) {
|
||||
return s
|
||||
}
|
||||
|
||||
// ANY is a wild card record. See RFC 1035, Section 3.2.3. ANY
|
||||
// is named "*" there.
|
||||
// ANY is a wild card record. See RFC 1035, Section 3.2.3. ANY is named "*" there.
|
||||
// The ANY records can be (ab)used to create resource records without any rdata, that
|
||||
// can be used in dynamic update requests. Basic use pattern:
|
||||
//
|
||||
// a := &ANY{RR_Header{
|
||||
// Name: "example.org.",
|
||||
// Rrtype: TypeA,
|
||||
// Class: ClassINET,
|
||||
// }}
|
||||
//
|
||||
// Results in an A record without rdata.
|
||||
type ANY struct {
|
||||
Hdr RR_Header
|
||||
// Does not have any rdata
|
||||
// Does not have any rdata.
|
||||
}
|
||||
|
||||
func (rr *ANY) String() string { return rr.Hdr.String() }
|
||||
@@ -294,6 +320,19 @@ func (*NULL) parse(c *zlexer, origin string) *ParseError {
|
||||
return &ParseError{err: "NULL records do not have a presentation format"}
|
||||
}
|
||||
|
||||
// NXNAME is a meta record. See https://www.iana.org/go/draft-ietf-dnsop-compact-denial-of-existence-04
|
||||
// Reference: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml
|
||||
type NXNAME struct {
|
||||
Hdr RR_Header
|
||||
// Does not have any rdata
|
||||
}
|
||||
|
||||
func (rr *NXNAME) String() string { return rr.Hdr.String() }
|
||||
|
||||
func (*NXNAME) parse(c *zlexer, origin string) *ParseError {
|
||||
return &ParseError{err: "NXNAME records do not have a presentation format"}
|
||||
}
|
||||
|
||||
// CNAME RR. See RFC 1034.
|
||||
type CNAME struct {
|
||||
Hdr RR_Header
|
||||
@@ -862,7 +901,7 @@ func (rr *LOC) String() string {
|
||||
lon = lon % LOC_HOURS
|
||||
s += fmt.Sprintf("%02d %02d %0.3f %s ", h, m, float64(lon)/1000, ew)
|
||||
|
||||
var alt = float64(rr.Altitude) / 100
|
||||
alt := float64(rr.Altitude) / 100
|
||||
alt -= LOC_ALTITUDEBASE
|
||||
if rr.Altitude%100 != 0 {
|
||||
s += fmt.Sprintf("%.2fm ", alt)
|
||||
@@ -1494,6 +1533,15 @@ func (rr *ZONEMD) String() string {
|
||||
" " + rr.Digest
|
||||
}
|
||||
|
||||
// RESINFO RR. See RFC 9606.
|
||||
|
||||
type RESINFO struct {
|
||||
Hdr RR_Header
|
||||
Txt []string `dns:"txt"`
|
||||
}
|
||||
|
||||
func (rr *RESINFO) String() string { return rr.Hdr.String() + sprintTxt(rr.Txt) }
|
||||
|
||||
// APL RR. See RFC 3123.
|
||||
type APL struct {
|
||||
Hdr RR_Header
|
||||
|
4
vendor/github.com/miekg/dns/udp.go
generated
vendored
4
vendor/github.com/miekg/dns/udp.go
generated
vendored
@@ -1,5 +1,5 @@
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
//go:build !windows && !darwin
|
||||
// +build !windows,!darwin
|
||||
|
||||
package dns
|
||||
|
||||
|
@@ -1,9 +1,11 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
//go:build windows || darwin
|
||||
// +build windows darwin
|
||||
|
||||
// TODO(tmthrgd): Remove this Windows-specific code if go.dev/issue/7175 and
|
||||
// go.dev/issue/7174 are ever fixed.
|
||||
|
||||
// NOTICE(stek29): darwin supports PKTINFO in sendmsg, but it unbinds sockets, see https://github.com/miekg/dns/issues/724
|
||||
|
||||
package dns
|
||||
|
||||
import "net"
|
7
vendor/github.com/miekg/dns/update.go
generated
vendored
7
vendor/github.com/miekg/dns/update.go
generated
vendored
@@ -2,6 +2,7 @@ package dns
|
||||
|
||||
// NameUsed sets the RRs in the prereq section to
|
||||
// "Name is in use" RRs. RFC 2136 section 2.4.4.
|
||||
// See [ANY] on how to make RRs without rdata.
|
||||
func (u *Msg) NameUsed(rr []RR) {
|
||||
if u.Answer == nil {
|
||||
u.Answer = make([]RR, 0, len(rr))
|
||||
@@ -41,6 +42,7 @@ func (u *Msg) Used(rr []RR) {
|
||||
|
||||
// RRsetUsed sets the RRs in the prereq section to
|
||||
// "RRset exists (value independent -- no rdata)" RRs. RFC 2136 section 2.4.1.
|
||||
// See [ANY] on how to make RRs without rdata.
|
||||
func (u *Msg) RRsetUsed(rr []RR) {
|
||||
if u.Answer == nil {
|
||||
u.Answer = make([]RR, 0, len(rr))
|
||||
@@ -53,6 +55,7 @@ func (u *Msg) RRsetUsed(rr []RR) {
|
||||
|
||||
// RRsetNotUsed sets the RRs in the prereq section to
|
||||
// "RRset does not exist" RRs. RFC 2136 section 2.4.3.
|
||||
// See [ANY] on how to make RRs without rdata.
|
||||
func (u *Msg) RRsetNotUsed(rr []RR) {
|
||||
if u.Answer == nil {
|
||||
u.Answer = make([]RR, 0, len(rr))
|
||||
@@ -64,6 +67,7 @@ func (u *Msg) RRsetNotUsed(rr []RR) {
|
||||
}
|
||||
|
||||
// Insert creates a dynamic update packet that adds an complete RRset, see RFC 2136 section 2.5.1.
|
||||
// See [ANY] on how to make RRs without rdata.
|
||||
func (u *Msg) Insert(rr []RR) {
|
||||
if len(u.Question) == 0 {
|
||||
panic("dns: empty question section")
|
||||
@@ -78,6 +82,7 @@ func (u *Msg) Insert(rr []RR) {
|
||||
}
|
||||
|
||||
// RemoveRRset creates a dynamic update packet that deletes an RRset, see RFC 2136 section 2.5.2.
|
||||
// See [ANY] on how to make RRs without rdata.
|
||||
func (u *Msg) RemoveRRset(rr []RR) {
|
||||
if u.Ns == nil {
|
||||
u.Ns = make([]RR, 0, len(rr))
|
||||
@@ -89,6 +94,7 @@ func (u *Msg) RemoveRRset(rr []RR) {
|
||||
}
|
||||
|
||||
// RemoveName creates a dynamic update packet that deletes all RRsets of a name, see RFC 2136 section 2.5.3
|
||||
// See [ANY] on how to make RRs without rdata.
|
||||
func (u *Msg) RemoveName(rr []RR) {
|
||||
if u.Ns == nil {
|
||||
u.Ns = make([]RR, 0, len(rr))
|
||||
@@ -99,6 +105,7 @@ func (u *Msg) RemoveName(rr []RR) {
|
||||
}
|
||||
|
||||
// Remove creates a dynamic update packet deletes RR from a RRSset, see RFC 2136 section 2.5.4
|
||||
// See [ANY] on how to make RRs without rdata.
|
||||
func (u *Msg) Remove(rr []RR) {
|
||||
if u.Ns == nil {
|
||||
u.Ns = make([]RR, 0, len(rr))
|
||||
|
2
vendor/github.com/miekg/dns/version.go
generated
vendored
2
vendor/github.com/miekg/dns/version.go
generated
vendored
@@ -3,7 +3,7 @@ package dns
|
||||
import "fmt"
|
||||
|
||||
// Version is current version of this library.
|
||||
var Version = v{1, 1, 58}
|
||||
var Version = v{1, 1, 66}
|
||||
|
||||
// v holds the version of this library.
|
||||
type v struct {
|
||||
|
18
vendor/github.com/miekg/dns/xfr.go
generated
vendored
18
vendor/github.com/miekg/dns/xfr.go
generated
vendored
@@ -1,6 +1,7 @@
|
||||
package dns
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
@@ -20,6 +21,7 @@ type Transfer struct {
|
||||
TsigProvider TsigProvider // An implementation of the TsigProvider interface. If defined it replaces TsigSecret and is used for all TSIG operations.
|
||||
TsigSecret map[string]string // Secret(s) for Tsig map[<zonename>]<base64 secret>, zonename must be in canonical form (lowercase, fqdn, see RFC 4034 Section 6.2)
|
||||
tsigTimersOnly bool
|
||||
TLS *tls.Config // TLS config. If Xfr over TLS will be attempted
|
||||
}
|
||||
|
||||
func (t *Transfer) tsigProvider() TsigProvider {
|
||||
@@ -57,7 +59,11 @@ func (t *Transfer) In(q *Msg, a string) (env chan *Envelope, err error) {
|
||||
}
|
||||
|
||||
if t.Conn == nil {
|
||||
t.Conn, err = DialTimeout("tcp", a, timeout)
|
||||
if t.TLS != nil {
|
||||
t.Conn, err = DialTimeoutWithTLS("tcp-tls", a, t.TLS, timeout)
|
||||
} else {
|
||||
t.Conn, err = DialTimeout("tcp", a, timeout)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -182,7 +188,7 @@ func (t *Transfer) inIxfr(q *Msg, c chan *Envelope) {
|
||||
if v, ok := rr.(*SOA); ok {
|
||||
if v.Serial == serial {
|
||||
n++
|
||||
// quit if it's a full axfr or the the servers' SOA is repeated the third time
|
||||
// quit if it's a full axfr or the servers' SOA is repeated the third time
|
||||
if axfr && n == 2 || n == 3 {
|
||||
c <- &Envelope{in.Answer, nil}
|
||||
return
|
||||
@@ -203,6 +209,7 @@ func (t *Transfer) inIxfr(q *Msg, c chan *Envelope) {
|
||||
// ch := make(chan *dns.Envelope)
|
||||
// tr := new(dns.Transfer)
|
||||
// var wg sync.WaitGroup
|
||||
// wg.Add(1)
|
||||
// go func() {
|
||||
// tr.Out(w, r, ch)
|
||||
// wg.Done()
|
||||
@@ -244,10 +251,13 @@ func (t *Transfer) ReadMsg() (*Msg, error) {
|
||||
if err := m.Unpack(p); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if ts, tp := m.IsTsig(), t.tsigProvider(); ts != nil && tp != nil {
|
||||
|
||||
if tp := t.tsigProvider(); tp != nil {
|
||||
// Need to work on the original message p, as that was used to calculate the tsig.
|
||||
err = TsigVerifyWithProvider(p, tp, t.tsigRequestMAC, t.tsigTimersOnly)
|
||||
t.tsigRequestMAC = ts.MAC
|
||||
if ts := m.IsTsig(); ts != nil {
|
||||
t.tsigRequestMAC = ts.MAC
|
||||
}
|
||||
}
|
||||
return m, err
|
||||
}
|
||||
|
26
vendor/github.com/miekg/dns/zduplicate.go
generated
vendored
26
vendor/github.com/miekg/dns/zduplicate.go
generated
vendored
@@ -886,6 +886,15 @@ func (r1 *NULL) isDuplicate(_r2 RR) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (r1 *NXNAME) isDuplicate(_r2 RR) bool {
|
||||
r2, ok := _r2.(*NXNAME)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
_ = r2
|
||||
return true
|
||||
}
|
||||
|
||||
func (r1 *NXT) isDuplicate(_r2 RR) bool {
|
||||
r2, ok := _r2.(*NXT)
|
||||
if !ok {
|
||||
@@ -948,6 +957,23 @@ func (r1 *PX) isDuplicate(_r2 RR) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (r1 *RESINFO) isDuplicate(_r2 RR) bool {
|
||||
r2, ok := _r2.(*RESINFO)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
_ = r2
|
||||
if len(r1.Txt) != len(r2.Txt) {
|
||||
return false
|
||||
}
|
||||
for i := 0; i < len(r1.Txt); i++ {
|
||||
if r1.Txt[i] != r2.Txt[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (r1 *RFC3597) isDuplicate(_r2 RR) bool {
|
||||
r2, ok := _r2.(*RFC3597)
|
||||
if !ok {
|
||||
|
30
vendor/github.com/miekg/dns/zmsg.go
generated
vendored
30
vendor/github.com/miekg/dns/zmsg.go
generated
vendored
@@ -706,6 +706,10 @@ func (rr *NULL) pack(msg []byte, off int, compression compressionMap, compress b
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *NXNAME) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) {
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *NXT) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) {
|
||||
off, err = packDomainName(rr.NextDomain, msg, off, compression, false)
|
||||
if err != nil {
|
||||
@@ -758,6 +762,14 @@ func (rr *PX) pack(msg []byte, off int, compression compressionMap, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *RESINFO) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) {
|
||||
off, err = packStringTxt(rr.Txt, msg, off)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *RFC3597) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) {
|
||||
off, err = packStringHex(rr.Rdata, msg, off)
|
||||
if err != nil {
|
||||
@@ -2266,6 +2278,13 @@ func (rr *NULL) unpack(msg []byte, off int) (off1 int, err error) {
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *NXNAME) unpack(msg []byte, off int) (off1 int, err error) {
|
||||
rdStart := off
|
||||
_ = rdStart
|
||||
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *NXT) unpack(msg []byte, off int) (off1 int, err error) {
|
||||
rdStart := off
|
||||
_ = rdStart
|
||||
@@ -2342,6 +2361,17 @@ func (rr *PX) unpack(msg []byte, off int) (off1 int, err error) {
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *RESINFO) unpack(msg []byte, off int) (off1 int, err error) {
|
||||
rdStart := off
|
||||
_ = rdStart
|
||||
|
||||
rr.Txt, off, err = unpackStringTxt(msg, off)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *RFC3597) unpack(msg []byte, off int) (off1 int, err error) {
|
||||
rdStart := off
|
||||
_ = rdStart
|
||||
|
27
vendor/github.com/miekg/dns/ztypes.go
generated
vendored
27
vendor/github.com/miekg/dns/ztypes.go
generated
vendored
@@ -60,11 +60,13 @@ var TypeToRR = map[uint16]func() RR{
|
||||
TypeNSEC3: func() RR { return new(NSEC3) },
|
||||
TypeNSEC3PARAM: func() RR { return new(NSEC3PARAM) },
|
||||
TypeNULL: func() RR { return new(NULL) },
|
||||
TypeNXNAME: func() RR { return new(NXNAME) },
|
||||
TypeNXT: func() RR { return new(NXT) },
|
||||
TypeOPENPGPKEY: func() RR { return new(OPENPGPKEY) },
|
||||
TypeOPT: func() RR { return new(OPT) },
|
||||
TypePTR: func() RR { return new(PTR) },
|
||||
TypePX: func() RR { return new(PX) },
|
||||
TypeRESINFO: func() RR { return new(RESINFO) },
|
||||
TypeRKEY: func() RR { return new(RKEY) },
|
||||
TypeRP: func() RR { return new(RP) },
|
||||
TypeRRSIG: func() RR { return new(RRSIG) },
|
||||
@@ -146,12 +148,14 @@ var TypeToString = map[uint16]string{
|
||||
TypeNSEC3: "NSEC3",
|
||||
TypeNSEC3PARAM: "NSEC3PARAM",
|
||||
TypeNULL: "NULL",
|
||||
TypeNXNAME: "NXNAME",
|
||||
TypeNXT: "NXT",
|
||||
TypeNone: "None",
|
||||
TypeOPENPGPKEY: "OPENPGPKEY",
|
||||
TypeOPT: "OPT",
|
||||
TypePTR: "PTR",
|
||||
TypePX: "PX",
|
||||
TypeRESINFO: "RESINFO",
|
||||
TypeRKEY: "RKEY",
|
||||
TypeRP: "RP",
|
||||
TypeRRSIG: "RRSIG",
|
||||
@@ -230,11 +234,13 @@ func (rr *NSEC) Header() *RR_Header { return &rr.Hdr }
|
||||
func (rr *NSEC3) Header() *RR_Header { return &rr.Hdr }
|
||||
func (rr *NSEC3PARAM) Header() *RR_Header { return &rr.Hdr }
|
||||
func (rr *NULL) Header() *RR_Header { return &rr.Hdr }
|
||||
func (rr *NXNAME) Header() *RR_Header { return &rr.Hdr }
|
||||
func (rr *NXT) Header() *RR_Header { return &rr.Hdr }
|
||||
func (rr *OPENPGPKEY) Header() *RR_Header { return &rr.Hdr }
|
||||
func (rr *OPT) Header() *RR_Header { return &rr.Hdr }
|
||||
func (rr *PTR) Header() *RR_Header { return &rr.Hdr }
|
||||
func (rr *PX) Header() *RR_Header { return &rr.Hdr }
|
||||
func (rr *RESINFO) Header() *RR_Header { return &rr.Hdr }
|
||||
func (rr *RFC3597) Header() *RR_Header { return &rr.Hdr }
|
||||
func (rr *RKEY) Header() *RR_Header { return &rr.Hdr }
|
||||
func (rr *RP) Header() *RR_Header { return &rr.Hdr }
|
||||
@@ -594,6 +600,11 @@ func (rr *NULL) len(off int, compression map[string]struct{}) int {
|
||||
return l
|
||||
}
|
||||
|
||||
func (rr *NXNAME) len(off int, compression map[string]struct{}) int {
|
||||
l := rr.Hdr.len(off, compression)
|
||||
return l
|
||||
}
|
||||
|
||||
func (rr *OPENPGPKEY) len(off int, compression map[string]struct{}) int {
|
||||
l := rr.Hdr.len(off, compression)
|
||||
l += base64.StdEncoding.DecodedLen(len(rr.PublicKey))
|
||||
@@ -614,6 +625,14 @@ func (rr *PX) len(off int, compression map[string]struct{}) int {
|
||||
return l
|
||||
}
|
||||
|
||||
func (rr *RESINFO) len(off int, compression map[string]struct{}) int {
|
||||
l := rr.Hdr.len(off, compression)
|
||||
for _, x := range rr.Txt {
|
||||
l += len(x) + 1
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
||||
func (rr *RFC3597) len(off int, compression map[string]struct{}) int {
|
||||
l := rr.Hdr.len(off, compression)
|
||||
l += len(rr.Rdata) / 2
|
||||
@@ -1107,6 +1126,10 @@ func (rr *NULL) copy() RR {
|
||||
return &NULL{rr.Hdr, rr.Data}
|
||||
}
|
||||
|
||||
func (rr *NXNAME) copy() RR {
|
||||
return &NXNAME{rr.Hdr}
|
||||
}
|
||||
|
||||
func (rr *NXT) copy() RR {
|
||||
return &NXT{*rr.NSEC.copy().(*NSEC)}
|
||||
}
|
||||
@@ -1136,6 +1159,10 @@ func (rr *PX) copy() RR {
|
||||
}
|
||||
}
|
||||
|
||||
func (rr *RESINFO) copy() RR {
|
||||
return &RESINFO{rr.Hdr, cloneSlice(rr.Txt)}
|
||||
}
|
||||
|
||||
func (rr *RFC3597) copy() RR {
|
||||
return &RFC3597{rr.Hdr, rr.Rdata}
|
||||
}
|
||||
|
Reference in New Issue
Block a user