chore: update deps

This commit is contained in:
foosinn 2025-01-15 02:30:06 +01:00
parent 95803010d5
commit d514cf41c3
525 changed files with 43230 additions and 14901 deletions

15
go.mod
View file

@ -1,15 +1,18 @@
module codeberg.org/foosinn/webhook-rfc2136 module codeberg.org/foosinn/webhook-rfc2136
go 1.20 go 1.22.0
toolchain go1.23.4
require ( require (
github.com/kelseyhightower/envconfig v1.4.0 github.com/kelseyhightower/envconfig v1.4.0
github.com/miekg/dns v1.1.52 github.com/miekg/dns v1.1.62
) )
require ( require (
golang.org/x/mod v0.7.0 // indirect golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.2.0 // indirect golang.org/x/net v0.34.0 // indirect
golang.org/x/sys v0.2.0 // indirect golang.org/x/sync v0.10.0 // indirect
golang.org/x/tools v0.3.0 // indirect golang.org/x/sys v0.29.0 // indirect
golang.org/x/tools v0.29.0 // indirect
) )

25
go.sum
View file

@ -1,13 +1,16 @@
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
github.com/miekg/dns v1.1.52 h1:Bmlc/qsNNULOe6bpXcUTsuOajd0DzRHwup6D9k1An0c= github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ=
github.com/miekg/dns v1.1.52/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY= github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXbNQ=
golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/tools v0.3.0 h1:SrNbZl6ECOS1qFzgTdQfWXZM9XBkiA6tkFrH9YSTPHM= golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE=
golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588=

View file

@ -78,9 +78,13 @@ A not-so-up-to-date-list-that-may-be-actually-current:
* https://fleetdeck.io/ * https://fleetdeck.io/
* https://github.com/markdingo/autoreverse * https://github.com/markdingo/autoreverse
* https://github.com/slackhq/nebula * https://github.com/slackhq/nebula
* https://github.com/dnschecktool/dow-proxy * https://addr.tools/
* https://dnscheck.tools/ * https://dnscheck.tools/
* https://github.com/egbakou/domainverifier * https://github.com/egbakou/domainverifier
* https://github.com/semihalev/sdns
* https://github.com/wintbiit/NineDNS
* https://linuxcontainers.org/incus/
* https://ifconfig.es
Send pull request if you want to be listed here. Send pull request if you want to be listed here.
@ -124,6 +128,7 @@ Example programs can be found in the `github.com/miekg/exdns` repository.
*all of them* *all of them*
* 103{4,5} - DNS standard * 103{4,5} - DNS standard
* 1183 - ISDN, X25 and other deprecated records
* 1348 - NSAP record (removed the record) * 1348 - NSAP record (removed the record)
* 1982 - Serial Arithmetic * 1982 - Serial Arithmetic
* 1876 - LOC record * 1876 - LOC record
@ -143,6 +148,7 @@ Example programs can be found in the `github.com/miekg/exdns` repository.
* 3225 - DO bit (DNSSEC OK) * 3225 - DO bit (DNSSEC OK)
* 340{1,2,3} - NAPTR record * 340{1,2,3} - NAPTR record
* 3445 - Limiting the scope of (DNS)KEY * 3445 - Limiting the scope of (DNS)KEY
* 3596 - AAAA record
* 3597 - Unknown RRs * 3597 - Unknown RRs
* 4025 - A Method for Storing IPsec Keying Material in DNS * 4025 - A Method for Storing IPsec Keying Material in DNS
* 403{3,4,5} - DNSSEC + validation functions * 403{3,4,5} - DNSSEC + validation functions
@ -183,6 +189,9 @@ Example programs can be found in the `github.com/miekg/exdns` repository.
* 8777 - DNS Reverse IP Automatic Multicast Tunneling (AMT) Discovery * 8777 - DNS Reverse IP Automatic Multicast Tunneling (AMT) Discovery
* 8914 - Extended DNS Errors * 8914 - Extended DNS Errors
* 8976 - Message Digest for DNS Zones (ZONEMD RR) * 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
## Loosely Based Upon ## Loosely Based Upon

View file

@ -10,8 +10,6 @@ type MsgAcceptFunc func(dh Header) MsgAcceptAction
// //
// * opcode isn't OpcodeQuery or OpcodeNotify // * opcode isn't OpcodeQuery or OpcodeNotify
// //
// * Zero bit isn't zero
//
// * does not have exactly 1 question in the question section // * does not have exactly 1 question in the question section
// //
// * has more than 1 RR in the Answer section // * has more than 1 RR in the Answer section

View file

@ -6,7 +6,6 @@ import (
"context" "context"
"crypto/tls" "crypto/tls"
"encoding/binary" "encoding/binary"
"fmt"
"io" "io"
"net" "net"
"strings" "strings"
@ -62,8 +61,14 @@ type Client struct {
WriteTimeout time.Duration // net.Conn.SetWriteTimeout value for connections, defaults to 2 seconds - overridden by Timeout when that value is non-zero WriteTimeout time.Duration // net.Conn.SetWriteTimeout value for connections, defaults to 2 seconds - overridden by Timeout when that value is non-zero
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) 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)
TsigProvider TsigProvider // An implementation of the TsigProvider interface. If defined it replaces TsigSecret and is used for all TSIG operations. TsigProvider TsigProvider // An implementation of the TsigProvider interface. If defined it replaces TsigSecret and is used for all TSIG operations.
SingleInflight bool // if true suppress multiple outstanding queries for the same Qname, Qtype and Qclass
group singleflight // SingleInflight previously serialised multiple concurrent queries for the
// same Qname, Qtype and Qclass to ensure only one would be in flight at a
// time.
//
// Deprecated: This is a no-op. Callers should implement their own in flight
// query caching if needed. See github.com/miekg/dns/issues/1449.
SingleInflight bool
} }
// Exchange performs a synchronous UDP query. It sends the message m to the address // Exchange performs a synchronous UDP query. It sends the message m to the address
@ -178,33 +183,13 @@ func (c *Client) Exchange(m *Msg, address string) (r *Msg, rtt time.Duration, er
// This allows users of the library to implement their own connection management, // This allows users of the library to implement their own connection management,
// as opposed to Exchange, which will always use new connections and incur the added overhead // as opposed to Exchange, which will always use new connections and incur the added overhead
// that entails when using "tcp" and especially "tcp-tls" clients. // that entails when using "tcp" and especially "tcp-tls" clients.
//
// When the singleflight is set for this client the context is _not_ forwarded to the (shared) exchange, to
// prevent one cancellation from canceling all outstanding requests.
func (c *Client) ExchangeWithConn(m *Msg, conn *Conn) (r *Msg, rtt time.Duration, err error) { func (c *Client) ExchangeWithConn(m *Msg, conn *Conn) (r *Msg, rtt time.Duration, err error) {
return c.exchangeWithConnContext(context.Background(), m, conn) return c.ExchangeWithConnContext(context.Background(), m, conn)
} }
func (c *Client) exchangeWithConnContext(ctx context.Context, m *Msg, conn *Conn) (r *Msg, rtt time.Duration, err error) { // ExchangeWithConnContext has the same behaviour as ExchangeWithConn and
if !c.SingleInflight { // additionally obeys deadlines from the passed Context.
return c.exchangeContext(ctx, m, conn) func (c *Client) ExchangeWithConnContext(ctx context.Context, m *Msg, co *Conn) (r *Msg, rtt time.Duration, err error) {
}
q := m.Question[0]
key := fmt.Sprintf("%s:%d:%d", q.Name, q.Qtype, q.Qclass)
r, rtt, err, shared := c.group.Do(key, func() (*Msg, time.Duration, error) {
// When we're doing singleflight we don't want one context cancellation, cancel _all_ outstanding queries.
// Hence we ignore the context and use Background().
return c.exchangeContext(context.Background(), m, conn)
})
if r != nil && shared {
r = r.Copy()
}
return r, rtt, err
}
func (c *Client) exchangeContext(ctx context.Context, m *Msg, co *Conn) (r *Msg, rtt time.Duration, err error) {
opt := m.IsEdns0() opt := m.IsEdns0()
// If EDNS0 is used use that for size. // If EDNS0 is used use that for size.
if opt != nil && opt.UDPSize() >= MinMsgSize { if opt != nil && opt.UDPSize() >= MinMsgSize {
@ -474,5 +459,5 @@ func (c *Client) ExchangeContext(ctx context.Context, m *Msg, a string) (r *Msg,
} }
defer conn.Close() defer conn.Close()
return c.exchangeWithConnContext(ctx, m, conn) return c.ExchangeWithConnContext(ctx, m, conn)
} }

View file

@ -22,8 +22,7 @@ func (dns *Msg) SetReply(request *Msg) *Msg {
} }
dns.Rcode = RcodeSuccess dns.Rcode = RcodeSuccess
if len(request.Question) > 0 { if len(request.Question) > 0 {
dns.Question = make([]Question, 1) dns.Question = []Question{request.Question[0]}
dns.Question[0] = request.Question[0]
} }
return dns return dns
} }
@ -199,16 +198,18 @@ func IsDomainName(s string) (labels int, ok bool) {
off int off int
begin int begin int
wasDot bool wasDot bool
escape bool
) )
for i := 0; i < len(s); i++ { for i := 0; i < len(s); i++ {
switch s[i] { switch s[i] {
case '\\': case '\\':
escape = !escape
if off+1 > lenmsg { if off+1 > lenmsg {
return labels, false return labels, false
} }
// check for \DDD // check for \DDD
if i+3 < len(s) && isDigit(s[i+1]) && isDigit(s[i+2]) && isDigit(s[i+3]) { if isDDD(s[i+1:]) {
i += 3 i += 3
begin += 3 begin += 3
} else { } else {
@ -218,6 +219,7 @@ func IsDomainName(s string) (labels int, ok bool) {
wasDot = false wasDot = false
case '.': case '.':
escape = false
if i == 0 && len(s) > 1 { if i == 0 && len(s) > 1 {
// leading dots are not legal except for the root zone // leading dots are not legal except for the root zone
return labels, false return labels, false
@ -244,10 +246,13 @@ func IsDomainName(s string) (labels int, ok bool) {
labels++ labels++
begin = i + 1 begin = i + 1
default: default:
escape = false
wasDot = false wasDot = false
} }
} }
if escape {
return labels, false
}
return labels, true return labels, true
} }
@ -272,40 +277,39 @@ func IsMsg(buf []byte) error {
// IsFqdn checks if a domain name is fully qualified. // IsFqdn checks if a domain name is fully qualified.
func IsFqdn(s string) bool { func IsFqdn(s string) bool {
s2 := strings.TrimSuffix(s, ".") // Check for (and remove) a trailing dot, returning if there isn't one.
if s == s2 { if s == "" || s[len(s)-1] != '.' {
return false return false
} }
s = s[:len(s)-1]
i := strings.LastIndexFunc(s2, func(r rune) bool { // If we don't have an escape sequence before the final dot, we know it's
// fully qualified and can return here.
if s == "" || s[len(s)-1] != '\\' {
return true
}
// Otherwise we have to check if the dot is escaped or not by checking if
// there are an odd or even number of escape sequences before the dot.
i := strings.LastIndexFunc(s, func(r rune) bool {
return r != '\\' return r != '\\'
}) })
return (len(s)-i)%2 != 0
// Test whether we have an even number of escape sequences before
// the dot or none.
return (len(s2)-i)%2 != 0
} }
// IsRRset checks if a set of RRs is a valid RRset as defined by RFC 2181. // IsRRset reports whether a set of RRs is a valid RRset as defined by RFC 2181.
// This means the RRs need to have the same type, name, and class. Returns true // This means the RRs need to have the same type, name, and class.
// if the RR set is valid, otherwise false.
func IsRRset(rrset []RR) bool { func IsRRset(rrset []RR) bool {
if len(rrset) == 0 { if len(rrset) == 0 {
return false return false
} }
if len(rrset) == 1 {
return true
}
rrHeader := rrset[0].Header()
rrType := rrHeader.Rrtype
rrClass := rrHeader.Class
rrName := rrHeader.Name
baseH := rrset[0].Header()
for _, rr := range rrset[1:] { for _, rr := range rrset[1:] {
curRRHeader := rr.Header() curH := rr.Header()
if curRRHeader.Rrtype != rrType || curRRHeader.Class != rrClass || curRRHeader.Name != rrName { if curH.Rrtype != baseH.Rrtype || curH.Class != baseH.Class || curH.Name != baseH.Name {
// Mismatch between the records, so this is not a valid rrset for // Mismatch between the records, so this is not a valid rrset for
//signing/verifying // signing/verifying
return false return false
} }
} }
@ -323,9 +327,15 @@ func Fqdn(s string) string {
} }
// CanonicalName returns the domain name in canonical form. A name in canonical // CanonicalName returns the domain name in canonical form. A name in canonical
// form is lowercase and fully qualified. See Section 6.2 in RFC 4034. // form is lowercase and fully qualified. Only US-ASCII letters are affected. See
// Section 6.2 in RFC 4034.
func CanonicalName(s string) string { func CanonicalName(s string) string {
return strings.ToLower(Fqdn(s)) return strings.Map(func(r rune) rune {
if r >= 'A' && r <= 'Z' {
r += 'a' - 'A'
}
return r
}, Fqdn(s))
} }
// Copied from the official Go code. // Copied from the official Go code.

View file

@ -128,10 +128,6 @@ type dnskeyWireFmt struct {
/* Nothing is left out */ /* Nothing is left out */
} }
func divRoundUp(a, b int) int {
return (a + b - 1) / b
}
// KeyTag calculates the keytag (or key-id) of the DNSKEY. // KeyTag calculates the keytag (or key-id) of the DNSKEY.
func (k *DNSKEY) KeyTag() uint16 { func (k *DNSKEY) KeyTag() uint16 {
if k == nil { if k == nil {
@ -418,10 +414,10 @@ func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error {
} }
sigbuf := rr.sigBuf() // Get the binary signature data sigbuf := rr.sigBuf() // Get the binary signature data
if rr.Algorithm == PRIVATEDNS { // PRIVATEOID
// TODO(miek) // TODO(miek)
// remove the domain name and assume its ours? // remove the domain name and assume its ours?
} // if rr.Algorithm == PRIVATEDNS { // PRIVATEOID
// }
h, cryptohash, err := hashFromAlgorithm(rr.Algorithm) h, cryptohash, err := hashFromAlgorithm(rr.Algorithm)
if err != nil { if err != nil {

View file

@ -37,7 +37,8 @@ func (k *DNSKEY) ReadPrivateKey(q io.Reader, file string) (crypto.PrivateKey, er
return nil, ErrPrivKey return nil, ErrPrivKey
} }
// TODO(mg): check if the pubkey matches the private key // TODO(mg): check if the pubkey matches the private key
algo, err := strconv.ParseUint(strings.SplitN(m["algorithm"], " ", 2)[0], 10, 8) algoStr, _, _ := strings.Cut(m["algorithm"], " ")
algo, err := strconv.ParseUint(algoStr, 10, 8)
if err != nil { if err != nil {
return nil, ErrPrivKey return nil, ErrPrivKey
} }
@ -159,7 +160,7 @@ func parseKey(r io.Reader, file string) (map[string]string, error) {
k = l.token k = l.token
case zValue: case zValue:
if k == "" { if k == "" {
return nil, &ParseError{file, "no private key seen", l} return nil, &ParseError{file: file, err: "no private key seen", lex: l}
} }
m[strings.ToLower(k)] = l.token m[strings.ToLower(k)] = l.token

15
vendor/github.com/miekg/dns/edns.go generated vendored
View file

@ -185,7 +185,7 @@ func (rr *OPT) Do() bool {
// SetDo sets the DO (DNSSEC OK) bit. // SetDo sets the DO (DNSSEC OK) bit.
// If we pass an argument, set the DO bit to that value. // If we pass an argument, set the DO bit to that value.
// It is possible to pass 2 or more arguments. Any arguments after the 1st is silently ignored. // It is possible to pass 2 or more arguments, but they will be ignored.
func (rr *OPT) SetDo(do ...bool) { func (rr *OPT) SetDo(do ...bool) {
if len(do) == 1 { if len(do) == 1 {
if do[0] { if do[0] {
@ -508,6 +508,7 @@ func (e *EDNS0_LLQ) String() string {
" " + strconv.FormatUint(uint64(e.LeaseLife), 10) " " + strconv.FormatUint(uint64(e.LeaseLife), 10)
return s return s
} }
func (e *EDNS0_LLQ) copy() EDNS0 { func (e *EDNS0_LLQ) copy() EDNS0 {
return &EDNS0_LLQ{e.Code, e.Version, e.Opcode, e.Error, e.Id, e.LeaseLife} return &EDNS0_LLQ{e.Code, e.Version, e.Opcode, e.Error, e.Id, e.LeaseLife}
} }
@ -755,6 +756,12 @@ const (
ExtendedErrorCodeNoReachableAuthority ExtendedErrorCodeNoReachableAuthority
ExtendedErrorCodeNetworkError ExtendedErrorCodeNetworkError
ExtendedErrorCodeInvalidData ExtendedErrorCodeInvalidData
ExtendedErrorCodeSignatureExpiredBeforeValid
ExtendedErrorCodeTooEarly
ExtendedErrorCodeUnsupportedNSEC3IterValue
ExtendedErrorCodeUnableToConformToPolicy
ExtendedErrorCodeSynthesized
ExtendedErrorCodeInvalidQueryType
) )
// ExtendedErrorCodeToString maps extended error info codes to a human readable // ExtendedErrorCodeToString maps extended error info codes to a human readable
@ -785,6 +792,12 @@ var ExtendedErrorCodeToString = map[uint16]string{
ExtendedErrorCodeNoReachableAuthority: "No Reachable Authority", ExtendedErrorCodeNoReachableAuthority: "No Reachable Authority",
ExtendedErrorCodeNetworkError: "Network Error", ExtendedErrorCodeNetworkError: "Network Error",
ExtendedErrorCodeInvalidData: "Invalid Data", 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 // StringToExtendedErrorCode is a map from human readable descriptions to

View file

@ -35,17 +35,17 @@ func (zp *ZoneParser) generate(l lex) (RR, bool) {
token = token[:i] token = token[:i]
} }
sx := strings.SplitN(token, "-", 2) startStr, endStr, ok := strings.Cut(token, "-")
if len(sx) != 2 { if !ok {
return zp.setParseError("bad start-stop in $GENERATE range", l) return zp.setParseError("bad start-stop in $GENERATE range", l)
} }
start, err := strconv.ParseInt(sx[0], 10, 64) start, err := strconv.ParseInt(startStr, 10, 64)
if err != nil { if err != nil {
return zp.setParseError("bad start in $GENERATE range", l) return zp.setParseError("bad start in $GENERATE range", l)
} }
end, err := strconv.ParseInt(sx[1], 10, 64) end, err := strconv.ParseInt(endStr, 10, 64)
if err != nil { if err != nil {
return zp.setParseError("bad stop in $GENERATE range", l) return zp.setParseError("bad stop in $GENERATE range", l)
} }
@ -54,7 +54,7 @@ func (zp *ZoneParser) generate(l lex) (RR, bool) {
} }
// _BLANK // _BLANK
l, ok := zp.c.Next() l, ok = zp.c.Next()
if !ok || l.value != zBlank { if !ok || l.value != zBlank {
return zp.setParseError("garbage after $GENERATE range", l) return zp.setParseError("garbage after $GENERATE range", l)
} }
@ -116,7 +116,7 @@ func (r *generateReader) parseError(msg string, end int) *ParseError {
l.token = r.s[r.si-1 : end] l.token = r.s[r.si-1 : end]
l.column += r.si // l.column starts one zBLANK before r.s l.column += r.si // l.column starts one zBLANK before r.s
return &ParseError{r.file, msg, l} return &ParseError{file: r.file, err: msg, lex: l}
} }
func (r *generateReader) Read(p []byte) (int, error) { func (r *generateReader) Read(p []byte) (int, error) {
@ -211,15 +211,16 @@ func (r *generateReader) ReadByte() (byte, error) {
func modToPrintf(s string) (string, int64, string) { func modToPrintf(s string) (string, int64, string) {
// Modifier is { offset [ ,width [ ,base ] ] } - provide default // Modifier is { offset [ ,width [ ,base ] ] } - provide default
// values for optional width and type, if necessary. // values for optional width and type, if necessary.
var offStr, widthStr, base string offStr, s, ok0 := strings.Cut(s, ",")
switch xs := strings.Split(s, ","); len(xs) { widthStr, s, ok1 := strings.Cut(s, ",")
case 1: base, _, ok2 := strings.Cut(s, ",")
offStr, widthStr, base = xs[0], "0", "d" if !ok0 {
case 2: widthStr = "0"
offStr, widthStr, base = xs[0], xs[1], "d" }
case 3: if !ok1 {
offStr, widthStr, base = xs[0], xs[1], xs[2] base = "d"
default: }
if ok2 {
return "", 0, "bad modifier in $GENERATE" return "", 0, "bad modifier in $GENERATE"
} }
@ -234,8 +235,8 @@ func modToPrintf(s string) (string, int64, string) {
return "", 0, "bad offset in $GENERATE" return "", 0, "bad offset in $GENERATE"
} }
width, err := strconv.ParseInt(widthStr, 10, 64) width, err := strconv.ParseUint(widthStr, 10, 8)
if err != nil || width < 0 || width > 255 { if err != nil {
return "", 0, "bad width in $GENERATE" return "", 0, "bad width in $GENERATE"
} }

View file

@ -7,16 +7,18 @@ import "net"
const supportsReusePort = false const supportsReusePort = false
func listenTCP(network, addr string, reuseport bool) (net.Listener, error) { func listenTCP(network, addr string, reuseport, reuseaddr bool) (net.Listener, error) {
if reuseport { if reuseport || reuseaddr {
// TODO(tmthrgd): return an error? // TODO(tmthrgd): return an error?
} }
return net.Listen(network, addr) return net.Listen(network, addr)
} }
func listenUDP(network, addr string, reuseport bool) (net.PacketConn, error) { const supportsReuseAddr = false
if reuseport {
func listenUDP(network, addr string, reuseport, reuseaddr bool) (net.PacketConn, error) {
if reuseport || reuseaddr {
// TODO(tmthrgd): return an error? // TODO(tmthrgd): return an error?
} }

View file

@ -25,19 +25,41 @@ func reuseportControl(network, address string, c syscall.RawConn) error {
return opErr return opErr
} }
func listenTCP(network, addr string, reuseport bool) (net.Listener, error) { const supportsReuseAddr = true
func reuseaddrControl(network, address string, c syscall.RawConn) error {
var opErr error
err := c.Control(func(fd uintptr) {
opErr = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEADDR, 1)
})
if err != nil {
return err
}
return opErr
}
func listenTCP(network, addr string, reuseport, reuseaddr bool) (net.Listener, error) {
var lc net.ListenConfig var lc net.ListenConfig
if reuseport { switch {
case reuseaddr && reuseport:
case reuseport:
lc.Control = reuseportControl lc.Control = reuseportControl
case reuseaddr:
lc.Control = reuseaddrControl
} }
return lc.Listen(context.Background(), network, addr) return lc.Listen(context.Background(), network, addr)
} }
func listenUDP(network, addr string, reuseport bool) (net.PacketConn, error) { func listenUDP(network, addr string, reuseport, reuseaddr bool) (net.PacketConn, error) {
var lc net.ListenConfig var lc net.ListenConfig
if reuseport { switch {
case reuseaddr && reuseport:
case reuseport:
lc.Control = reuseportControl lc.Control = reuseportControl
case reuseaddr:
lc.Control = reuseaddrControl
} }
return lc.ListenPacket(context.Background(), network, addr) return lc.ListenPacket(context.Background(), network, addr)

64
vendor/github.com/miekg/dns/msg.go generated vendored
View file

@ -252,7 +252,7 @@ loop:
} }
// check for \DDD // check for \DDD
if i+3 < ls && isDigit(bs[i+1]) && isDigit(bs[i+2]) && isDigit(bs[i+3]) { if isDDD(bs[i+1:]) {
bs[i] = dddToByte(bs[i+1:]) bs[i] = dddToByte(bs[i+1:])
copy(bs[i+1:ls-3], bs[i+4:]) copy(bs[i+1:ls-3], bs[i+4:])
ls -= 3 ls -= 3
@ -482,8 +482,8 @@ func packTxtString(s string, msg []byte, offset int) (int, error) {
break break
} }
// check for \DDD // check for \DDD
if i+2 < len(s) && isDigit(s[i]) && isDigit(s[i+1]) && isDigit(s[i+2]) { if isDDD(s[i:]) {
msg[offset] = dddStringToByte(s[i:]) msg[offset] = dddToByte(s[i:])
i += 2 i += 2
} else { } else {
msg[offset] = s[i] msg[offset] = s[i]
@ -501,30 +501,28 @@ func packTxtString(s string, msg []byte, offset int) (int, error) {
return offset, nil return offset, nil
} }
func packOctetString(s string, msg []byte, offset int, tmp []byte) (int, error) { func packOctetString(s string, msg []byte, offset int) (int, error) {
if offset >= len(msg) || len(s) > len(tmp) { if offset >= len(msg) || len(s) > 256*4+1 {
return offset, ErrBuf return offset, ErrBuf
} }
bs := tmp[:len(s)] for i := 0; i < len(s); i++ {
copy(bs, s)
for i := 0; i < len(bs); i++ {
if len(msg) <= offset { if len(msg) <= offset {
return offset, ErrBuf return offset, ErrBuf
} }
if bs[i] == '\\' { if s[i] == '\\' {
i++ i++
if i == len(bs) { if i == len(s) {
break break
} }
// check for \DDD // check for \DDD
if i+2 < len(bs) && isDigit(bs[i]) && isDigit(bs[i+1]) && isDigit(bs[i+2]) { if isDDD(s[i:]) {
msg[offset] = dddToByte(bs[i:]) msg[offset] = dddToByte(s[i:])
i += 2 i += 2
} else { } else {
msg[offset] = bs[i] msg[offset] = s[i]
} }
} else { } else {
msg[offset] = bs[i] msg[offset] = s[i]
} }
offset++ offset++
} }
@ -546,12 +544,11 @@ func unpackTxt(msg []byte, off0 int) (ss []string, off int, err error) {
// Helpers for dealing with escaped bytes // Helpers for dealing with escaped bytes
func isDigit(b byte) bool { return b >= '0' && b <= '9' } func isDigit(b byte) bool { return b >= '0' && b <= '9' }
func dddToByte(s []byte) byte { func isDDD[T ~[]byte | ~string](s T) bool {
_ = s[2] // bounds check hint to compiler; see golang.org/issue/14808 return len(s) >= 3 && isDigit(s[0]) && isDigit(s[1]) && isDigit(s[2])
return byte((s[0]-'0')*100 + (s[1]-'0')*10 + (s[2] - '0'))
} }
func dddStringToByte(s string) byte { func dddToByte[T ~[]byte | ~string](s T) byte {
_ = s[2] // bounds check hint to compiler; see golang.org/issue/14808 _ = s[2] // bounds check hint to compiler; see golang.org/issue/14808
return byte((s[0]-'0')*100 + (s[1]-'0')*10 + (s[2] - '0')) return byte((s[0]-'0')*100 + (s[1]-'0')*10 + (s[2] - '0'))
} }
@ -717,7 +714,7 @@ func (h *MsgHdr) String() string {
return s 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. // If the dns.Compress is true the message will be in compressed wire format.
func (dns *Msg) Pack() (msg []byte, err error) { func (dns *Msg) Pack() (msg []byte, err error) {
return dns.PackBuffer(nil) return dns.PackBuffer(nil)
@ -861,7 +858,7 @@ func (dns *Msg) unpack(dh Header, msg []byte, off int) (err error) {
// The header counts might have been wrong so we need to update it // The header counts might have been wrong so we need to update it
dh.Nscount = uint16(len(dns.Ns)) dh.Nscount = uint16(len(dns.Ns))
if err == nil { if err == nil {
dns.Extra, off, err = unpackRRslice(int(dh.Arcount), msg, off) dns.Extra, _, err = unpackRRslice(int(dh.Arcount), msg, off)
} }
// The header counts might have been wrong so we need to update it // The header counts might have been wrong so we need to update it
dh.Arcount = uint16(len(dns.Extra)) dh.Arcount = uint16(len(dns.Extra))
@ -871,11 +868,11 @@ func (dns *Msg) unpack(dh Header, msg []byte, off int) (err error) {
dns.Rcode |= opt.ExtendedRcode() dns.Rcode |= opt.ExtendedRcode()
} }
if off != len(msg) {
// TODO(miek) make this an error? // TODO(miek) make this an error?
// use PackOpt to let people tell how detailed the error reporting should be? // use PackOpt to let people tell how detailed the error reporting should be?
// println("dns: extra bytes in dns packet", off, "<", len(msg)) // if off != len(msg) {
} // // println("dns: extra bytes in dns packet", off, "<", len(msg))
// }
return err return err
} }
@ -897,23 +894,38 @@ func (dns *Msg) String() string {
return "<nil> MsgHdr" return "<nil> MsgHdr"
} }
s := dns.MsgHdr.String() + " " s := dns.MsgHdr.String() + " "
if dns.MsgHdr.Opcode == OpcodeUpdate {
s += "ZONE: " + strconv.Itoa(len(dns.Question)) + ", "
s += "PREREQ: " + strconv.Itoa(len(dns.Answer)) + ", "
s += "UPDATE: " + strconv.Itoa(len(dns.Ns)) + ", "
s += "ADDITIONAL: " + strconv.Itoa(len(dns.Extra)) + "\n"
} else {
s += "QUERY: " + strconv.Itoa(len(dns.Question)) + ", " s += "QUERY: " + strconv.Itoa(len(dns.Question)) + ", "
s += "ANSWER: " + strconv.Itoa(len(dns.Answer)) + ", " s += "ANSWER: " + strconv.Itoa(len(dns.Answer)) + ", "
s += "AUTHORITY: " + strconv.Itoa(len(dns.Ns)) + ", " s += "AUTHORITY: " + strconv.Itoa(len(dns.Ns)) + ", "
s += "ADDITIONAL: " + strconv.Itoa(len(dns.Extra)) + "\n" s += "ADDITIONAL: " + strconv.Itoa(len(dns.Extra)) + "\n"
}
opt := dns.IsEdns0() opt := dns.IsEdns0()
if opt != nil { if opt != nil {
// OPT PSEUDOSECTION // OPT PSEUDOSECTION
s += opt.String() + "\n" s += opt.String() + "\n"
} }
if len(dns.Question) > 0 { if len(dns.Question) > 0 {
if dns.MsgHdr.Opcode == OpcodeUpdate {
s += "\n;; ZONE SECTION:\n"
} else {
s += "\n;; QUESTION SECTION:\n" s += "\n;; QUESTION SECTION:\n"
}
for _, r := range dns.Question { for _, r := range dns.Question {
s += r.String() + "\n" s += r.String() + "\n"
} }
} }
if len(dns.Answer) > 0 { if len(dns.Answer) > 0 {
if dns.MsgHdr.Opcode == OpcodeUpdate {
s += "\n;; PREREQUISITE SECTION:\n"
} else {
s += "\n;; ANSWER SECTION:\n" s += "\n;; ANSWER SECTION:\n"
}
for _, r := range dns.Answer { for _, r := range dns.Answer {
if r != nil { if r != nil {
s += r.String() + "\n" s += r.String() + "\n"
@ -921,7 +933,11 @@ func (dns *Msg) String() string {
} }
} }
if len(dns.Ns) > 0 { if len(dns.Ns) > 0 {
if dns.MsgHdr.Opcode == OpcodeUpdate {
s += "\n;; UPDATE SECTION:\n"
} else {
s += "\n;; AUTHORITY SECTION:\n" s += "\n;; AUTHORITY SECTION:\n"
}
for _, r := range dns.Ns { for _, r := range dns.Ns {
if r != nil { if r != nil {
s += r.String() + "\n" s += r.String() + "\n"
@ -1019,7 +1035,7 @@ func escapedNameLen(s string) int {
continue continue
} }
if i+3 < len(s) && isDigit(s[i+1]) && isDigit(s[i+2]) && isDigit(s[i+3]) { if isDDD(s[i+1:]) {
nameLen -= 3 nameLen -= 3
i += 3 i += 3
} else { } else {

View file

@ -20,9 +20,7 @@ func unpackDataA(msg []byte, off int) (net.IP, int, error) {
if off+net.IPv4len > len(msg) { if off+net.IPv4len > len(msg) {
return nil, len(msg), &Error{err: "overflow unpacking a"} return nil, len(msg), &Error{err: "overflow unpacking a"}
} }
a := append(make(net.IP, 0, net.IPv4len), msg[off:off+net.IPv4len]...) return cloneSlice(msg[off : off+net.IPv4len]), off + net.IPv4len, nil
off += net.IPv4len
return a, off, nil
} }
func packDataA(a net.IP, msg []byte, off int) (int, error) { func packDataA(a net.IP, msg []byte, off int) (int, error) {
@ -47,9 +45,7 @@ func unpackDataAAAA(msg []byte, off int) (net.IP, int, error) {
if off+net.IPv6len > len(msg) { if off+net.IPv6len > len(msg) {
return nil, len(msg), &Error{err: "overflow unpacking aaaa"} return nil, len(msg), &Error{err: "overflow unpacking aaaa"}
} }
aaaa := append(make(net.IP, 0, net.IPv6len), msg[off:off+net.IPv6len]...) return cloneSlice(msg[off : off+net.IPv6len]), off + net.IPv6len, nil
off += net.IPv6len
return aaaa, off, nil
} }
func packDataAAAA(aaaa net.IP, msg []byte, off int) (int, error) { func packDataAAAA(aaaa net.IP, msg []byte, off int) (int, error) {
@ -410,29 +406,24 @@ func packStringTxt(s []string, msg []byte, off int) (int, error) {
func unpackDataOpt(msg []byte, off int) ([]EDNS0, int, error) { func unpackDataOpt(msg []byte, off int) ([]EDNS0, int, error) {
var edns []EDNS0 var edns []EDNS0
Option: for off < len(msg) {
var code uint16
if off+4 > len(msg) { if off+4 > len(msg) {
return nil, len(msg), &Error{err: "overflow unpacking opt"} return nil, len(msg), &Error{err: "overflow unpacking opt"}
} }
code = binary.BigEndian.Uint16(msg[off:]) code := binary.BigEndian.Uint16(msg[off:])
off += 2 off += 2
optlen := binary.BigEndian.Uint16(msg[off:]) optlen := binary.BigEndian.Uint16(msg[off:])
off += 2 off += 2
if off+int(optlen) > len(msg) { if off+int(optlen) > len(msg) {
return nil, len(msg), &Error{err: "overflow unpacking opt"} return nil, len(msg), &Error{err: "overflow unpacking opt"}
} }
e := makeDataOpt(code) opt := makeDataOpt(code)
if err := e.unpack(msg[off : off+int(optlen)]); err != nil { if err := opt.unpack(msg[off : off+int(optlen)]); err != nil {
return nil, len(msg), err return nil, len(msg), err
} }
edns = append(edns, e) edns = append(edns, opt)
off += int(optlen) off += int(optlen)
if off < len(msg) {
goto Option
} }
return edns, off, nil return edns, off, nil
} }
@ -461,8 +452,7 @@ func unpackStringOctet(msg []byte, off int) (string, int, error) {
} }
func packStringOctet(s string, msg []byte, off int) (int, error) { func packStringOctet(s string, msg []byte, off int) (int, error) {
txtTmp := make([]byte, 256*4+1) off, err := packOctetString(s, msg, off)
off, err := packOctetString(s, msg, off, txtTmp)
if err != nil { if err != nil {
return len(msg), err return len(msg), err
} }

View file

@ -84,7 +84,7 @@ Fetch:
err := r.Data.Parse(text) err := r.Data.Parse(text)
if err != nil { if err != nil {
return &ParseError{"", err.Error(), l} return &ParseError{wrappedErr: err, lex: l}
} }
return nil return nil

157
vendor/github.com/miekg/dns/scan.go generated vendored
View file

@ -4,19 +4,21 @@ import (
"bufio" "bufio"
"fmt" "fmt"
"io" "io"
"io/fs"
"os" "os"
"path"
"path/filepath" "path/filepath"
"strconv" "strconv"
"strings" "strings"
) )
const maxTok = 2048 // Largest token we can return. const maxTok = 512 // Token buffer start size, and growth size amount.
// The maximum depth of $INCLUDE directives supported by the // The maximum depth of $INCLUDE directives supported by the
// ZoneParser API. // ZoneParser API.
const maxIncludeDepth = 7 const maxIncludeDepth = 7
// Tokinize a RFC 1035 zone file. The tokenizer will normalize it: // Tokenize a RFC 1035 zone file. The tokenizer will normalize it:
// * Add ownernames if they are left blank; // * Add ownernames if they are left blank;
// * Suppress sequences of spaces; // * Suppress sequences of spaces;
// * Make each RR fit on one line (_NEWLINE is send as last) // * Make each RR fit on one line (_NEWLINE is send as last)
@ -66,6 +68,7 @@ const (
type ParseError struct { type ParseError struct {
file string file string
err string err string
wrappedErr error
lex lex lex lex
} }
@ -73,11 +76,16 @@ func (e *ParseError) Error() (s string) {
if e.file != "" { if e.file != "" {
s = e.file + ": " s = e.file + ": "
} }
if e.err == "" && e.wrappedErr != nil {
e.err = e.wrappedErr.Error()
}
s += "dns: " + e.err + ": " + strconv.QuoteToASCII(e.lex.token) + " at line: " + s += "dns: " + e.err + ": " + strconv.QuoteToASCII(e.lex.token) + " at line: " +
strconv.Itoa(e.lex.line) + ":" + strconv.Itoa(e.lex.column) strconv.Itoa(e.lex.line) + ":" + strconv.Itoa(e.lex.column)
return return
} }
func (e *ParseError) Unwrap() error { return e.wrappedErr }
type lex struct { type lex struct {
token string // text of the token token string // text of the token
err bool // when true, token text has lexer error err bool // when true, token text has lexer error
@ -93,12 +101,13 @@ type ttlState struct {
isByDirective bool // isByDirective indicates whether ttl was set by a $TTL directive 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. // 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 // The class defaults to IN, TTL defaults to 3600, and
// like $TTL, $ORIGIN, etc. is supported. All fields of the returned RR are // origin for resolving relative domain names defaults to the DNS root (.).
// set, except RR.Header().Rdlength which is set to 0. // 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.
func NewRR(s string) (RR, error) { func NewRR(s string) (RR, error) {
if len(s) > 0 && s[len(s)-1] != '\n' { // We need a closing newline if len(s) > 0 && s[len(s)-1] != '\n' { // We need a closing newline
return ReadRR(strings.NewReader(s+"\n"), "") return ReadRR(strings.NewReader(s+"\n"), "")
@ -169,7 +178,8 @@ type ZoneParser struct {
// Next, by calling subNext, forwards the resulting RRs from this // Next, by calling subNext, forwards the resulting RRs from this
// sub parser to the calling code. // sub parser to the calling code.
sub *ZoneParser sub *ZoneParser
osFile *os.File r io.Reader
fsys fs.FS
includeDepth uint8 includeDepth uint8
@ -188,7 +198,7 @@ func NewZoneParser(r io.Reader, origin, file string) *ZoneParser {
if origin != "" { if origin != "" {
origin = Fqdn(origin) origin = Fqdn(origin)
if _, ok := IsDomainName(origin); !ok { if _, ok := IsDomainName(origin); !ok {
pe = &ParseError{file, "bad initial origin name", lex{}} pe = &ParseError{file: file, err: "bad initial origin name"}
} }
} }
@ -220,6 +230,24 @@ func (zp *ZoneParser) SetIncludeAllowed(v bool) {
zp.includeAllowed = v zp.includeAllowed = v
} }
// SetIncludeFS provides an [fs.FS] to use when looking for the target of
// $INCLUDE directives. ($INCLUDE must still be enabled separately by calling
// [ZoneParser.SetIncludeAllowed].) If fsys is nil, [os.Open] will be used.
//
// When fsys is an on-disk FS, the ability of $INCLUDE to reach files from
// outside its root directory depends upon the FS implementation. For
// instance, [os.DirFS] will refuse to open paths like "../../etc/passwd",
// however it will still follow links which may point anywhere on the system.
//
// FS paths are slash-separated on all systems, even Windows. $INCLUDE paths
// containing other characters such as backslash and colon may be accepted as
// valid, but those characters will never be interpreted by an FS
// implementation as path element separators. See [fs.ValidPath] for more
// details.
func (zp *ZoneParser) SetIncludeFS(fsys fs.FS) {
zp.fsys = fsys
}
// Err returns the first non-EOF error that was encountered by the // Err returns the first non-EOF error that was encountered by the
// ZoneParser. // ZoneParser.
func (zp *ZoneParser) Err() error { func (zp *ZoneParser) Err() error {
@ -237,7 +265,7 @@ func (zp *ZoneParser) Err() error {
} }
func (zp *ZoneParser) setParseError(err string, l lex) (RR, bool) { func (zp *ZoneParser) setParseError(err string, l lex) (RR, bool) {
zp.parseErr = &ParseError{zp.file, err, l} zp.parseErr = &ParseError{file: zp.file, err: err, lex: l}
return nil, false return nil, false
} }
@ -260,9 +288,11 @@ func (zp *ZoneParser) subNext() (RR, bool) {
return rr, true return rr, true
} }
if zp.sub.osFile != nil { if zp.sub.r != nil {
zp.sub.osFile.Close() if c, ok := zp.sub.r.(io.Closer); ok {
zp.sub.osFile = nil c.Close()
}
zp.sub.r = nil
} }
if zp.sub.Err() != nil { if zp.sub.Err() != nil {
@ -402,24 +432,44 @@ func (zp *ZoneParser) Next() (RR, bool) {
// Start with the new file // Start with the new file
includePath := l.token includePath := l.token
var r1 io.Reader
var e1 error
if zp.fsys != nil {
// fs.FS always uses / as separator, even on Windows, so use
// path instead of filepath here:
if !path.IsAbs(includePath) {
includePath = path.Join(path.Dir(zp.file), includePath)
}
// os.DirFS, and probably others, expect all paths to be
// relative, so clean the path and remove leading / if
// present:
includePath = strings.TrimLeft(path.Clean(includePath), "/")
r1, e1 = zp.fsys.Open(includePath)
} else {
if !filepath.IsAbs(includePath) { if !filepath.IsAbs(includePath) {
includePath = filepath.Join(filepath.Dir(zp.file), includePath) includePath = filepath.Join(filepath.Dir(zp.file), includePath)
} }
r1, e1 = os.Open(includePath)
r1, e1 := os.Open(includePath) }
if e1 != nil { if e1 != nil {
var as string var as string
if !filepath.IsAbs(l.token) { if includePath != l.token {
as = fmt.Sprintf(" as `%s'", includePath) as = fmt.Sprintf(" as `%s'", includePath)
} }
zp.parseErr = &ParseError{
msg := fmt.Sprintf("failed to open `%s'%s: %v", l.token, as, e1) file: zp.file,
return zp.setParseError(msg, l) wrappedErr: fmt.Errorf("failed to open `%s'%s: %w", l.token, as, e1),
lex: l,
}
return nil, false
} }
zp.sub = NewZoneParser(r1, neworigin, includePath) zp.sub = NewZoneParser(r1, neworigin, includePath)
zp.sub.defttl, zp.sub.includeDepth, zp.sub.osFile = zp.defttl, zp.includeDepth+1, r1 zp.sub.defttl, zp.sub.includeDepth, zp.sub.r = zp.defttl, zp.includeDepth+1, r1
zp.sub.SetIncludeAllowed(true) zp.sub.SetIncludeAllowed(true)
zp.sub.SetIncludeFS(zp.fsys)
return zp.subNext() return zp.subNext()
case zExpectDirTTLBl: case zExpectDirTTLBl:
if l.value != zBlank { if l.value != zBlank {
@ -605,8 +655,6 @@ func (zp *ZoneParser) Next() (RR, bool) {
if !isPrivate && zp.c.Peek().token == "" { if !isPrivate && zp.c.Peek().token == "" {
// This is a dynamic update rr. // This is a dynamic update rr.
// TODO(tmthrgd): Previously slurpRemainder was only called
// for certain RR types, which may have been important.
if err := slurpRemainder(zp.c); err != nil { if err := slurpRemainder(zp.c); err != nil {
return zp.setParseError(err.err, err.lex) return zp.setParseError(err.err, err.lex)
} }
@ -765,8 +813,8 @@ func (zl *zlexer) Next() (lex, bool) {
} }
var ( var (
str [maxTok]byte // Hold string text str = make([]byte, maxTok) // Hold string text
com [maxTok]byte // Hold comment text com = make([]byte, maxTok) // Hold comment text
stri int // Offset in str (0 means empty) stri int // Offset in str (0 means empty)
comi int // Offset in com (0 means empty) comi int // Offset in com (0 means empty)
@ -785,14 +833,12 @@ func (zl *zlexer) Next() (lex, bool) {
l.line, l.column = zl.line, zl.column l.line, l.column = zl.line, zl.column
if stri >= len(str) { if stri >= len(str) {
l.token = "token length insufficient for parsing" // if buffer length is insufficient, increase it.
l.err = true str = append(str[:], make([]byte, maxTok)...)
return *l, true
} }
if comi >= len(com) { if comi >= len(com) {
l.token = "comment length insufficient for parsing" // if buffer length is insufficient, increase it.
l.err = true com = append(com[:], make([]byte, maxTok)...)
return *l, true
} }
switch x { switch x {
@ -816,7 +862,7 @@ func (zl *zlexer) Next() (lex, bool) {
if stri == 0 { if stri == 0 {
// Space directly in the beginning, handled in the grammar // Space directly in the beginning, handled in the grammar
} else if zl.owner { } else if zl.owner {
// If we have a string and its the first, make it an owner // If we have a string and it's the first, make it an owner
l.value = zOwner l.value = zOwner
l.token = string(str[:stri]) l.token = string(str[:stri])
@ -1218,42 +1264,34 @@ func stringToCm(token string) (e, m uint8, ok bool) {
if token[len(token)-1] == 'M' || token[len(token)-1] == 'm' { if token[len(token)-1] == 'M' || token[len(token)-1] == 'm' {
token = token[0 : len(token)-1] token = token[0 : len(token)-1]
} }
s := strings.SplitN(token, ".", 2)
var meters, cmeters, val int var (
var err error meters, cmeters, val int
switch len(s) { err error
case 2: )
if cmeters, err = strconv.Atoi(s[1]); err != nil { mStr, cmStr, hasCM := strings.Cut(token, ".")
return if hasCM {
}
// There's no point in having more than 2 digits in this part, and would rather make the implementation complicated ('123' should be treated as '12'). // There's no point in having more than 2 digits in this part, and would rather make the implementation complicated ('123' should be treated as '12').
// So we simply reject it. // So we simply reject it.
// We also make sure the first character is a digit to reject '+-' signs. // We also make sure the first character is a digit to reject '+-' signs.
if len(s[1]) > 2 || s[1][0] < '0' || s[1][0] > '9' { cmeters, err = strconv.Atoi(cmStr)
if err != nil || len(cmStr) > 2 || cmStr[0] < '0' || cmStr[0] > '9' {
return return
} }
if len(s[1]) == 1 { if len(cmStr) == 1 {
// 'nn.1' must be treated as 'nn-meters and 10cm, not 1cm. // 'nn.1' must be treated as 'nn-meters and 10cm, not 1cm.
cmeters *= 10 cmeters *= 10
} }
if s[0] == "" {
// This will allow omitting the 'meter' part, like .01 (meaning 0.01m = 1cm).
break
}
fallthrough
case 1:
if meters, err = strconv.Atoi(s[0]); err != nil {
return
} }
// 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. // RFC1876 states the max value is 90000000.00. The latter two conditions enforce it.
if s[0][0] < '0' || s[0][0] > '9' || meters > 90000000 || (meters == 90000000 && cmeters != 0) { if err != nil || mStr[0] < '0' || mStr[0] > '9' || meters > 90000000 || (meters == 90000000 && cmeters != 0) {
return return
} }
case 0:
// huh?
return 0, 0, false
} }
ok = true
if meters > 0 { if meters > 0 {
e = 2 e = 2
val = meters val = meters
@ -1265,8 +1303,7 @@ func stringToCm(token string) (e, m uint8, ok bool) {
e++ e++
val /= 10 val /= 10
} }
m = uint8(val) return e, uint8(val), true
return
} }
func toAbsoluteName(name, origin string) (absolute string, ok bool) { func toAbsoluteName(name, origin string) (absolute string, ok bool) {
@ -1339,12 +1376,12 @@ func slurpRemainder(c *zlexer) *ParseError {
case zBlank: case zBlank:
l, _ = c.Next() l, _ = c.Next()
if l.value != zNewline && l.value != zEOF { if l.value != zNewline && l.value != zEOF {
return &ParseError{"", "garbage after rdata", l} return &ParseError{err: "garbage after rdata", lex: l}
} }
case zNewline: case zNewline:
case zEOF: case zEOF:
default: default:
return &ParseError{"", "garbage after rdata", l} return &ParseError{err: "garbage after rdata", lex: l}
} }
return nil return nil
} }
@ -1353,16 +1390,16 @@ func slurpRemainder(c *zlexer) *ParseError {
// Used for NID and L64 record. // Used for NID and L64 record.
func stringToNodeID(l lex) (uint64, *ParseError) { func stringToNodeID(l lex) (uint64, *ParseError) {
if len(l.token) < 19 { if len(l.token) < 19 {
return 0, &ParseError{l.token, "bad NID/L64 NodeID/Locator64", l} return 0, &ParseError{file: l.token, err: "bad NID/L64 NodeID/Locator64", lex: l}
} }
// There must be three colons at fixes positions, if not its a parse error // There must be three colons at fixes positions, if not its a parse error
if l.token[4] != ':' && l.token[9] != ':' && l.token[14] != ':' { if l.token[4] != ':' && l.token[9] != ':' && l.token[14] != ':' {
return 0, &ParseError{l.token, "bad NID/L64 NodeID/Locator64", l} return 0, &ParseError{file: l.token, err: "bad NID/L64 NodeID/Locator64", lex: l}
} }
s := l.token[0:4] + l.token[5:9] + l.token[10:14] + l.token[15:19] s := l.token[0:4] + l.token[5:9] + l.token[10:14] + l.token[15:19]
u, err := strconv.ParseUint(s, 16, 64) u, err := strconv.ParseUint(s, 16, 64)
if err != nil { if err != nil {
return 0, &ParseError{l.token, "bad NID/L64 NodeID/Locator64", l} return 0, &ParseError{file: l.token, err: "bad NID/L64 NodeID/Locator64", lex: l}
} }
return u, nil return u, nil
} }

File diff suppressed because it is too large Load diff

View file

@ -188,6 +188,14 @@ type DecorateReader func(Reader) Reader
// Implementations should never return a nil Writer. // Implementations should never return a nil Writer.
type DecorateWriter func(Writer) 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. // A Server defines parameters for running an DNS server.
type Server struct { type Server struct {
// Address to listen on, ":dns" if empty. // Address to listen on, ":dns" if empty.
@ -226,9 +234,15 @@ type Server struct {
// Whether to set the SO_REUSEPORT socket option, allowing multiple listeners to be bound to a single address. // Whether to set the SO_REUSEPORT socket option, allowing multiple listeners to be bound to a single address.
// It is only supported on certain GOOSes and when using ListenAndServe. // It is only supported on certain GOOSes and when using ListenAndServe.
ReusePort bool ReusePort bool
// Whether to set the SO_REUSEADDR socket option, allowing multiple listeners to be bound to a single address.
// Crucially this allows binding when an existing server is listening on `0.0.0.0` or `::`.
// It is only supported on certain GOOSes and when using ListenAndServe.
ReuseAddr bool
// AcceptMsgFunc will check the incoming message and will reject it early in the process. // AcceptMsgFunc will check the incoming message and will reject it early in the process.
// By default DefaultMsgAcceptFunc will be used. // By default DefaultMsgAcceptFunc will be used.
MsgAcceptFunc MsgAcceptFunc MsgAcceptFunc MsgAcceptFunc
// MsgInvalidFunc is optional, will be called if a message is received but cannot be parsed.
MsgInvalidFunc MsgInvalidFunc
// Shutdown handling // Shutdown handling
lock sync.RWMutex lock sync.RWMutex
@ -273,6 +287,9 @@ func (srv *Server) init() {
if srv.MsgAcceptFunc == nil { if srv.MsgAcceptFunc == nil {
srv.MsgAcceptFunc = DefaultMsgAcceptFunc srv.MsgAcceptFunc = DefaultMsgAcceptFunc
} }
if srv.MsgInvalidFunc == nil {
srv.MsgInvalidFunc = DefaultMsgInvalidFunc
}
if srv.Handler == nil { if srv.Handler == nil {
srv.Handler = DefaultServeMux srv.Handler = DefaultServeMux
} }
@ -304,7 +321,7 @@ func (srv *Server) ListenAndServe() error {
switch srv.Net { switch srv.Net {
case "tcp", "tcp4", "tcp6": case "tcp", "tcp4", "tcp6":
l, err := listenTCP(srv.Net, addr, srv.ReusePort) l, err := listenTCP(srv.Net, addr, srv.ReusePort, srv.ReuseAddr)
if err != nil { if err != nil {
return err return err
} }
@ -317,7 +334,7 @@ func (srv *Server) ListenAndServe() error {
return errors.New("dns: neither Certificates nor GetCertificate set in Config") return errors.New("dns: neither Certificates nor GetCertificate set in Config")
} }
network := strings.TrimSuffix(srv.Net, "-tls") network := strings.TrimSuffix(srv.Net, "-tls")
l, err := listenTCP(network, addr, srv.ReusePort) l, err := listenTCP(network, addr, srv.ReusePort, srv.ReuseAddr)
if err != nil { if err != nil {
return err return err
} }
@ -327,7 +344,7 @@ func (srv *Server) ListenAndServe() error {
unlock() unlock()
return srv.serveTCP(l) return srv.serveTCP(l)
case "udp", "udp4", "udp6": case "udp", "udp4", "udp6":
l, err := listenUDP(srv.Net, addr, srv.ReusePort) l, err := listenUDP(srv.Net, addr, srv.ReusePort, srv.ReuseAddr)
if err != nil { if err != nil {
return err return err
} }
@ -527,6 +544,7 @@ func (srv *Server) serveUDP(l net.PacketConn) error {
if cap(m) == srv.UDPSize { if cap(m) == srv.UDPSize {
srv.udpPool.Put(m[:srv.UDPSize]) srv.udpPool.Put(m[:srv.UDPSize])
} }
srv.MsgInvalidFunc(m, ErrShortRead)
continue continue
} }
wg.Add(1) wg.Add(1)
@ -607,6 +625,7 @@ func (srv *Server) serveUDPPacket(wg *sync.WaitGroup, m []byte, u net.PacketConn
func (srv *Server) serveDNS(m []byte, w *response) { func (srv *Server) serveDNS(m []byte, w *response) {
dh, off, err := unpackMsgHdr(m, 0) dh, off, err := unpackMsgHdr(m, 0)
if err != nil { if err != nil {
srv.MsgInvalidFunc(m, err)
// Let client hang, they are sending crap; any reply can be used to amplify. // Let client hang, they are sending crap; any reply can be used to amplify.
return return
} }
@ -616,10 +635,12 @@ func (srv *Server) serveDNS(m []byte, w *response) {
switch action := srv.MsgAcceptFunc(dh); action { switch action := srv.MsgAcceptFunc(dh); action {
case MsgAccept: case MsgAccept:
if req.unpack(dh, m, off) == nil { err := req.unpack(dh, m, off)
if err == nil {
break break
} }
srv.MsgInvalidFunc(m, err)
fallthrough fallthrough
case MsgReject, MsgRejectNotImplemented: case MsgReject, MsgRejectNotImplemented:
opcode := req.Opcode opcode := req.Opcode

View file

@ -1,61 +0,0 @@
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Adapted for dns package usage by Miek Gieben.
package dns
import "sync"
import "time"
// call is an in-flight or completed singleflight.Do call
type call struct {
wg sync.WaitGroup
val *Msg
rtt time.Duration
err error
dups int
}
// singleflight represents a class of work and forms a namespace in
// which units of work can be executed with duplicate suppression.
type singleflight struct {
sync.Mutex // protects m
m map[string]*call // lazily initialized
dontDeleteForTesting bool // this is only to be used by TestConcurrentExchanges
}
// Do executes and returns the results of the given function, making
// sure that only one execution is in-flight for a given key at a
// time. If a duplicate comes in, the duplicate caller waits for the
// original to complete and receives the same results.
// The return value shared indicates whether v was given to multiple callers.
func (g *singleflight) Do(key string, fn func() (*Msg, time.Duration, error)) (v *Msg, rtt time.Duration, err error, shared bool) {
g.Lock()
if g.m == nil {
g.m = make(map[string]*call)
}
if c, ok := g.m[key]; ok {
c.dups++
g.Unlock()
c.wg.Wait()
return c.val, c.rtt, c.err, true
}
c := new(call)
c.wg.Add(1)
g.m[key] = c
g.Unlock()
c.val, c.rtt, c.err = fn()
c.wg.Done()
if !g.dontDeleteForTesting {
g.Lock()
delete(g.m, key)
g.Unlock()
}
return c.val, c.rtt, c.err, c.dups > 0
}

109
vendor/github.com/miekg/dns/svcb.go generated vendored
View file

@ -14,7 +14,7 @@ import (
// SVCBKey is the type of the keys used in the SVCB RR. // SVCBKey is the type of the keys used in the SVCB RR.
type SVCBKey uint16 type SVCBKey uint16
// Keys defined in draft-ietf-dnsop-svcb-https-08 Section 14.3.2. // Keys defined in rfc9460
const ( const (
SVCB_MANDATORY SVCBKey = iota SVCB_MANDATORY SVCBKey = iota
SVCB_ALPN SVCB_ALPN
@ -23,7 +23,8 @@ const (
SVCB_IPV4HINT SVCB_IPV4HINT
SVCB_ECHCONFIG SVCB_ECHCONFIG
SVCB_IPV6HINT 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 svcb_RESERVED SVCBKey = 65535
) )
@ -37,6 +38,7 @@ var svcbKeyToStringMap = map[SVCBKey]string{
SVCB_ECHCONFIG: "ech", SVCB_ECHCONFIG: "ech",
SVCB_IPV6HINT: "ipv6hint", SVCB_IPV6HINT: "ipv6hint",
SVCB_DOHPATH: "dohpath", SVCB_DOHPATH: "dohpath",
SVCB_OHTTP: "ohttp",
} }
var svcbStringToKeyMap = reverseSVCBKeyMap(svcbKeyToStringMap) var svcbStringToKeyMap = reverseSVCBKeyMap(svcbKeyToStringMap)
@ -85,7 +87,7 @@ func (rr *SVCB) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next() l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16) i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err { if e != nil || l.err {
return &ParseError{l.token, "bad SVCB priority", l} return &ParseError{file: l.token, err: "bad SVCB priority", lex: l}
} }
rr.Priority = uint16(i) rr.Priority = uint16(i)
@ -95,7 +97,7 @@ func (rr *SVCB) parse(c *zlexer, o string) *ParseError {
name, nameOk := toAbsoluteName(l.token, o) name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk { if l.err || !nameOk {
return &ParseError{l.token, "bad SVCB Target", l} return &ParseError{file: l.token, err: "bad SVCB Target", lex: l}
} }
rr.Target = name rr.Target = name
@ -111,7 +113,7 @@ func (rr *SVCB) parse(c *zlexer, o string) *ParseError {
if !canHaveNextKey { if !canHaveNextKey {
// The key we can now read was probably meant to be // The key we can now read was probably meant to be
// a part of the last value. // a part of the last value.
return &ParseError{l.token, "bad SVCB value quotation", l} return &ParseError{file: l.token, err: "bad SVCB value quotation", lex: l}
} }
// In key=value pairs, value does not have to be quoted unless value // In key=value pairs, value does not have to be quoted unless value
@ -124,7 +126,7 @@ func (rr *SVCB) parse(c *zlexer, o string) *ParseError {
// Key with no value and no equality sign // Key with no value and no equality sign
key = l.token key = l.token
} else if idx == 0 { } else if idx == 0 {
return &ParseError{l.token, "bad SVCB key", l} return &ParseError{file: l.token, err: "bad SVCB key", lex: l}
} else { } else {
key, value = l.token[:idx], l.token[idx+1:] key, value = l.token[:idx], l.token[idx+1:]
@ -144,30 +146,30 @@ func (rr *SVCB) parse(c *zlexer, o string) *ParseError {
value = l.token value = l.token
l, _ = c.Next() l, _ = c.Next()
if l.value != zQuote { if l.value != zQuote {
return &ParseError{l.token, "SVCB unterminated value", l} return &ParseError{file: l.token, err: "SVCB unterminated value", lex: l}
} }
case zQuote: case zQuote:
// There's nothing in double quotes. // There's nothing in double quotes.
default: default:
return &ParseError{l.token, "bad SVCB value", l} return &ParseError{file: l.token, err: "bad SVCB value", lex: l}
} }
} }
} }
} }
kv := makeSVCBKeyValue(svcbStringToKey(key)) kv := makeSVCBKeyValue(svcbStringToKey(key))
if kv == nil { if kv == nil {
return &ParseError{l.token, "bad SVCB key", l} return &ParseError{file: l.token, err: "bad SVCB key", lex: l}
} }
if err := kv.parse(value); err != nil { if err := kv.parse(value); err != nil {
return &ParseError{l.token, err.Error(), l} return &ParseError{file: l.token, wrappedErr: err, lex: l}
} }
xs = append(xs, kv) xs = append(xs, kv)
case zQuote: case zQuote:
return &ParseError{l.token, "SVCB key can't contain double quotes", l} return &ParseError{file: l.token, err: "SVCB key can't contain double quotes", lex: l}
case zBlank: case zBlank:
canHaveNextKey = true canHaveNextKey = true
default: default:
return &ParseError{l.token, "bad SVCB values", l} return &ParseError{file: l.token, err: "bad SVCB values", lex: l}
} }
l, _ = c.Next() l, _ = c.Next()
} }
@ -201,6 +203,8 @@ func makeSVCBKeyValue(key SVCBKey) SVCBKeyValue {
return new(SVCBIPv6Hint) return new(SVCBIPv6Hint)
case SVCB_DOHPATH: case SVCB_DOHPATH:
return new(SVCBDoHPath) return new(SVCBDoHPath)
case SVCB_OHTTP:
return new(SVCBOhttp)
case svcb_RESERVED: case svcb_RESERVED:
return nil return nil
default: default:
@ -314,10 +318,11 @@ func (s *SVCBMandatory) unpack(b []byte) error {
} }
func (s *SVCBMandatory) parse(b string) error { func (s *SVCBMandatory) parse(b string) error {
str := strings.Split(b, ",") codes := make([]SVCBKey, 0, strings.Count(b, ",")+1)
codes := make([]SVCBKey, 0, len(str)) for len(b) > 0 {
for _, e := range str { var key string
codes = append(codes, svcbStringToKey(e)) key, b, _ = strings.Cut(b, ",")
codes = append(codes, svcbStringToKey(key))
} }
s.Code = codes s.Code = codes
return nil return nil
@ -613,19 +618,24 @@ func (s *SVCBIPv4Hint) String() string {
} }
func (s *SVCBIPv4Hint) parse(b string) error { func (s *SVCBIPv4Hint) parse(b string) error {
if b == "" {
return errors.New("dns: svcbipv4hint: empty hint")
}
if strings.Contains(b, ":") { if strings.Contains(b, ":") {
return errors.New("dns: svcbipv4hint: expected ipv4, got ipv6") return errors.New("dns: svcbipv4hint: expected ipv4, got ipv6")
} }
str := strings.Split(b, ",")
dst := make([]net.IP, len(str)) hint := make([]net.IP, 0, strings.Count(b, ",")+1)
for i, e := range str { for len(b) > 0 {
var e string
e, b, _ = strings.Cut(b, ",")
ip := net.ParseIP(e).To4() ip := net.ParseIP(e).To4()
if ip == nil { if ip == nil {
return errors.New("dns: svcbipv4hint: bad ip") return errors.New("dns: svcbipv4hint: bad ip")
} }
dst[i] = ip hint = append(hint, ip)
} }
s.Hint = dst s.Hint = hint
return nil return nil
} }
@ -733,9 +743,14 @@ func (s *SVCBIPv6Hint) String() string {
} }
func (s *SVCBIPv6Hint) parse(b string) error { func (s *SVCBIPv6Hint) parse(b string) error {
str := strings.Split(b, ",") if b == "" {
dst := make([]net.IP, len(str)) return errors.New("dns: svcbipv6hint: empty hint")
for i, e := range str { }
hint := make([]net.IP, 0, strings.Count(b, ",")+1)
for len(b) > 0 {
var e string
e, b, _ = strings.Cut(b, ",")
ip := net.ParseIP(e) ip := net.ParseIP(e)
if ip == nil { if ip == nil {
return errors.New("dns: svcbipv6hint: bad ip") return errors.New("dns: svcbipv6hint: bad ip")
@ -743,9 +758,9 @@ func (s *SVCBIPv6Hint) parse(b string) error {
if ip.To4() != nil { if ip.To4() != nil {
return errors.New("dns: svcbipv6hint: expected ipv6, got ipv4-mapped-ipv6") return errors.New("dns: svcbipv6hint: expected ipv6, got ipv4-mapped-ipv6")
} }
dst[i] = ip hint = append(hint, ip)
} }
s.Hint = dst s.Hint = hint
return nil return nil
} }
@ -760,8 +775,8 @@ func (s *SVCBIPv6Hint) copy() SVCBKeyValue {
// SVCBDoHPath pair is used to indicate the URI template that the // SVCBDoHPath pair is used to indicate the URI template that the
// clients may use to construct a DNS over HTTPS URI. // 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) // See RFC 9461 (https://datatracker.ietf.org/doc/html/rfc9461)
// and RFC yyyy (https://datatracker.ietf.org/doc/html/draft-ietf-add-ddr-06). // and RFC 9462 (https://datatracker.ietf.org/doc/html/rfc9462).
// //
// A basic example of using the dohpath option together with the alpn // A basic example of using the dohpath option together with the alpn
// option to indicate support for DNS over HTTPS on a certain path: // option to indicate support for DNS over HTTPS on a certain path:
@ -805,6 +820,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 // SVCBLocal pair is intended for experimental/private use. The key is recommended
// to be in the range [SVCB_PRIVATE_LOWER, SVCB_PRIVATE_UPPER]. // to be in the range [SVCB_PRIVATE_LOWER, SVCB_PRIVATE_UPPER].
// Basic use pattern for creating a keyNNNNN option: // Basic use pattern for creating a keyNNNNN option:

70
vendor/github.com/miekg/dns/types.go generated vendored
View file

@ -96,6 +96,7 @@ const (
TypeLP uint16 = 107 TypeLP uint16 = 107
TypeEUI48 uint16 = 108 TypeEUI48 uint16 = 108
TypeEUI64 uint16 = 109 TypeEUI64 uint16 = 109
TypeNXNAME uint16 = 128
TypeURI uint16 = 256 TypeURI uint16 = 256
TypeCAA uint16 = 257 TypeCAA uint16 = 257
TypeAVC uint16 = 258 TypeAVC uint16 = 258
@ -135,8 +136,8 @@ const (
RcodeNXRrset = 8 // NXRRSet - RR Set that should exist does 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] RcodeNotAuth = 9 // NotAuth - Server Not Authoritative for zone [DNS Update]
RcodeNotZone = 10 // NotZone - Name not contained in zone [DNS Update/TSIG] RcodeNotZone = 10 // NotZone - Name not contained in zone [DNS Update/TSIG]
RcodeBadSig = 16 // BADSIG - TSIG Signature Failure [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] 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] RcodeBadKey = 17 // BADKEY - Key not recognized [TSIG]
RcodeBadTime = 18 // BADTIME - Signature out of time window [TSIG] RcodeBadTime = 18 // BADTIME - Signature out of time window [TSIG]
RcodeBadMode = 19 // BADMODE - Bad TKEY Mode [TKEY] RcodeBadMode = 19 // BADMODE - Bad TKEY Mode [TKEY]
@ -198,7 +199,7 @@ const (
_CD = 1 << 4 // checking disabled _CD = 1 << 4 // checking disabled
) )
// Various constants used in the LOC RR. See RFC 1887. // Various constants used in the LOC RR. See RFC 1876.
const ( const (
LOC_EQUATOR = 1 << 31 // RFC 1876, Section 2. LOC_EQUATOR = 1 << 31 // RFC 1876, Section 2.
LOC_PRIMEMERIDIAN = 1 << 31 // RFC 1876, Section 2. LOC_PRIMEMERIDIAN = 1 << 31 // RFC 1876, Section 2.
@ -236,6 +237,9 @@ var CertTypeToString = map[uint16]string{
CertOID: "OID", CertOID: "OID",
} }
// Prefix for IPv4 encoded as IPv6 address
const ipv4InIPv6Prefix = "::ffff:"
//go:generate go run types_generate.go //go:generate go run types_generate.go
// Question holds a DNS question. Usually there is just one. While the // Question holds a DNS question. Usually there is just one. While the
@ -291,6 +295,19 @@ func (*NULL) parse(c *zlexer, origin string) *ParseError {
return &ParseError{err: "NULL records do not have a presentation format"} 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. // CNAME RR. See RFC 1034.
type CNAME struct { type CNAME struct {
Hdr RR_Header Hdr RR_Header
@ -399,6 +416,17 @@ func (rr *X25) String() string {
return rr.Hdr.String() + rr.PSDNAddress return rr.Hdr.String() + rr.PSDNAddress
} }
// ISDN RR. See RFC 1183, Section 3.2.
type ISDN struct {
Hdr RR_Header
Address string
SubAddress string
}
func (rr *ISDN) String() string {
return rr.Hdr.String() + sprintTxt([]string{rr.Address, rr.SubAddress})
}
// RT RR. See RFC 1183, Section 3.3. // RT RR. See RFC 1183, Section 3.3.
type RT struct { type RT struct {
Hdr RR_Header Hdr RR_Header
@ -631,8 +659,8 @@ func nextByte(s string, offset int) (byte, int) {
return 0, 0 return 0, 0
case 2, 3: // too short to be \ddd case 2, 3: // too short to be \ddd
default: // maybe \ddd default: // maybe \ddd
if isDigit(s[offset+1]) && isDigit(s[offset+2]) && isDigit(s[offset+3]) { if isDDD(s[offset+1:]) {
return dddStringToByte(s[offset+1:]), 4 return dddToByte(s[offset+1:]), 4
} }
} }
// not \ddd, just an RFC 1035 "quoted" character // not \ddd, just an RFC 1035 "quoted" character
@ -751,6 +779,11 @@ func (rr *AAAA) String() string {
if rr.AAAA == nil { if rr.AAAA == nil {
return rr.Hdr.String() return rr.Hdr.String()
} }
if rr.AAAA.To4() != nil {
return rr.Hdr.String() + ipv4InIPv6Prefix + rr.AAAA.String()
}
return rr.Hdr.String() + rr.AAAA.String() return rr.Hdr.String() + rr.AAAA.String()
} }
@ -778,7 +811,7 @@ func (rr *GPOS) String() string {
return rr.Hdr.String() + rr.Longitude + " " + rr.Latitude + " " + rr.Altitude return rr.Hdr.String() + rr.Longitude + " " + rr.Latitude + " " + rr.Altitude
} }
// LOC RR. See RFC RFC 1876. // LOC RR. See RFC 1876.
type LOC struct { type LOC struct {
Hdr RR_Header Hdr RR_Header
Version uint8 Version uint8
@ -792,7 +825,10 @@ type LOC struct {
// cmToM takes a cm value expressed in RFC 1876 SIZE mantissa/exponent // cmToM takes a cm value expressed in RFC 1876 SIZE mantissa/exponent
// format and returns a string in m (two decimals for the cm). // format and returns a string in m (two decimals for the cm).
func cmToM(m, e uint8) string { func cmToM(x uint8) string {
m := x & 0xf0 >> 4
e := x & 0x0f
if e < 2 { if e < 2 {
if e == 1 { if e == 1 {
m *= 10 m *= 10
@ -848,10 +884,9 @@ func (rr *LOC) String() string {
s += fmt.Sprintf("%.0fm ", alt) s += fmt.Sprintf("%.0fm ", alt)
} }
s += cmToM(rr.Size&0xf0>>4, rr.Size&0x0f) + "m " s += cmToM(rr.Size) + "m "
s += cmToM(rr.HorizPre&0xf0>>4, rr.HorizPre&0x0f) + "m " s += cmToM(rr.HorizPre) + "m "
s += cmToM(rr.VertPre&0xf0>>4, rr.VertPre&0x0f) + "m" s += cmToM(rr.VertPre) + "m"
return s return s
} }
@ -888,6 +923,11 @@ func (rr *RRSIG) String() string {
return s return s
} }
// NXT RR. See RFC 2535.
type NXT struct {
NSEC
}
// NSEC RR. See RFC 4034 and RFC 3755. // NSEC RR. See RFC 4034 and RFC 3755.
type NSEC struct { type NSEC struct {
Hdr RR_Header Hdr RR_Header
@ -972,7 +1012,7 @@ func (rr *TALINK) String() string {
sprintName(rr.PreviousName) + " " + sprintName(rr.NextName) sprintName(rr.PreviousName) + " " + sprintName(rr.NextName)
} }
// SSHFP RR. See RFC RFC 4255. // SSHFP RR. See RFC 4255.
type SSHFP struct { type SSHFP struct {
Hdr RR_Header Hdr RR_Header
Algorithm uint8 Algorithm uint8
@ -986,7 +1026,7 @@ func (rr *SSHFP) String() string {
" " + strings.ToUpper(rr.FingerPrint) " " + strings.ToUpper(rr.FingerPrint)
} }
// KEY RR. See RFC RFC 2535. // KEY RR. See RFC 2535.
type KEY struct { type KEY struct {
DNSKEY DNSKEY
} }
@ -1296,7 +1336,7 @@ type NINFO struct {
func (rr *NINFO) String() string { return rr.Hdr.String() + sprintTxt(rr.ZSData) } func (rr *NINFO) String() string { return rr.Hdr.String() + sprintTxt(rr.ZSData) }
// NID RR. See RFC RFC 6742. // NID RR. See RFC 6742.
type NID struct { type NID struct {
Hdr RR_Header Hdr RR_Header
Preference uint16 Preference uint16
@ -1515,7 +1555,7 @@ func (a *APLPrefix) str() string {
case net.IPv6len: case net.IPv6len:
// add prefix for IPv4-mapped IPv6 // add prefix for IPv4-mapped IPv6
if v4 := a.Network.IP.To4(); v4 != nil { if v4 := a.Network.IP.To4(); v4 != nil {
sb.WriteString("::ffff:") sb.WriteString(ipv4InIPv6Prefix)
} }
sb.WriteString(a.Network.IP.String()) sb.WriteString(a.Network.IP.String())
} }

View file

@ -3,7 +3,7 @@ package dns
import "fmt" import "fmt"
// Version is current version of this library. // Version is current version of this library.
var Version = v{1, 1, 52} var Version = v{1, 1, 62}
// v holds the version of this library. // v holds the version of this library.
type v struct { type v struct {

27
vendor/github.com/miekg/dns/xfr.go generated vendored
View file

@ -1,6 +1,7 @@
package dns package dns
import ( import (
"crypto/tls"
"fmt" "fmt"
"time" "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. 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) 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 tsigTimersOnly bool
TLS *tls.Config // TLS config. If Xfr over TLS will be attempted
} }
func (t *Transfer) tsigProvider() TsigProvider { 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 { if t.Conn == nil {
if t.TLS != nil {
t.Conn, err = DialTimeoutWithTLS("tcp-tls", a, t.TLS, timeout)
} else {
t.Conn, err = DialTimeout("tcp", a, timeout) t.Conn, err = DialTimeout("tcp", a, timeout)
}
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -80,8 +86,13 @@ func (t *Transfer) In(q *Msg, a string) (env chan *Envelope, err error) {
func (t *Transfer) inAxfr(q *Msg, c chan *Envelope) { func (t *Transfer) inAxfr(q *Msg, c chan *Envelope) {
first := true first := true
defer t.Close() defer func() {
defer close(c) // First close the connection, then the channel. This allows functions blocked on
// the channel to assume that the connection is closed and no further operations are
// pending when they resume.
t.Close()
close(c)
}()
timeout := dnsTimeout timeout := dnsTimeout
if t.ReadTimeout != 0 { if t.ReadTimeout != 0 {
timeout = t.ReadTimeout timeout = t.ReadTimeout
@ -131,8 +142,13 @@ func (t *Transfer) inIxfr(q *Msg, c chan *Envelope) {
axfr := true axfr := true
n := 0 n := 0
qser := q.Ns[0].(*SOA).Serial qser := q.Ns[0].(*SOA).Serial
defer t.Close() defer func() {
defer close(c) // First close the connection, then the channel. This allows functions blocked on
// the channel to assume that the connection is closed and no further operations are
// pending when they resume.
t.Close()
close(c)
}()
timeout := dnsTimeout timeout := dnsTimeout
if t.ReadTimeout != 0 { if t.ReadTimeout != 0 {
timeout = t.ReadTimeout timeout = t.ReadTimeout
@ -172,7 +188,7 @@ func (t *Transfer) inIxfr(q *Msg, c chan *Envelope) {
if v, ok := rr.(*SOA); ok { if v, ok := rr.(*SOA); ok {
if v.Serial == serial { if v.Serial == serial {
n++ 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 { if axfr && n == 2 || n == 3 {
c <- &Envelope{in.Answer, nil} c <- &Envelope{in.Answer, nil}
return return
@ -193,6 +209,7 @@ func (t *Transfer) inIxfr(q *Msg, c chan *Envelope) {
// ch := make(chan *dns.Envelope) // ch := make(chan *dns.Envelope)
// tr := new(dns.Transfer) // tr := new(dns.Transfer)
// var wg sync.WaitGroup // var wg sync.WaitGroup
// wg.Add(1)
// go func() { // go func() {
// tr.Out(w, r, ch) // tr.Out(w, r, ch)
// wg.Done() // wg.Done()

View file

@ -481,6 +481,21 @@ func (r1 *IPSECKEY) isDuplicate(_r2 RR) bool {
return true return true
} }
func (r1 *ISDN) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*ISDN)
if !ok {
return false
}
_ = r2
if r1.Address != r2.Address {
return false
}
if r1.SubAddress != r2.SubAddress {
return false
}
return true
}
func (r1 *KEY) isDuplicate(_r2 RR) bool { func (r1 *KEY) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*KEY) r2, ok := _r2.(*KEY)
if !ok { if !ok {
@ -871,6 +886,35 @@ func (r1 *NULL) isDuplicate(_r2 RR) bool {
return true 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 {
return false
}
_ = r2
if !isDuplicateName(r1.NextDomain, r2.NextDomain) {
return false
}
if len(r1.TypeBitMap) != len(r2.TypeBitMap) {
return false
}
for i := 0; i < len(r1.TypeBitMap); i++ {
if r1.TypeBitMap[i] != r2.TypeBitMap[i] {
return false
}
}
return true
}
func (r1 *OPENPGPKEY) isDuplicate(_r2 RR) bool { func (r1 *OPENPGPKEY) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*OPENPGPKEY) r2, ok := _r2.(*OPENPGPKEY)
if !ok { if !ok {

71
vendor/github.com/miekg/dns/zmsg.go generated vendored
View file

@ -372,6 +372,18 @@ func (rr *IPSECKEY) pack(msg []byte, off int, compression compressionMap, compre
return off, nil return off, nil
} }
func (rr *ISDN) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) {
off, err = packString(rr.Address, msg, off)
if err != nil {
return off, err
}
off, err = packString(rr.SubAddress, msg, off)
if err != nil {
return off, err
}
return off, nil
}
func (rr *KEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { func (rr *KEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) {
off, err = packUint16(rr.Flags, msg, off) off, err = packUint16(rr.Flags, msg, off)
if err != nil { if err != nil {
@ -694,6 +706,22 @@ func (rr *NULL) pack(msg []byte, off int, compression compressionMap, compress b
return off, nil 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 {
return off, err
}
off, err = packDataNsec(rr.TypeBitMap, msg, off)
if err != nil {
return off, err
}
return off, nil
}
func (rr *OPENPGPKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) { func (rr *OPENPGPKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) {
off, err = packStringBase64(rr.PublicKey, msg, off) off, err = packStringBase64(rr.PublicKey, msg, off)
if err != nil { if err != nil {
@ -1746,6 +1774,24 @@ func (rr *IPSECKEY) unpack(msg []byte, off int) (off1 int, err error) {
return off, nil return off, nil
} }
func (rr *ISDN) unpack(msg []byte, off int) (off1 int, err error) {
rdStart := off
_ = rdStart
rr.Address, off, err = unpackString(msg, off)
if err != nil {
return off, err
}
if off == len(msg) {
return off, nil
}
rr.SubAddress, off, err = unpackString(msg, off)
if err != nil {
return off, err
}
return off, nil
}
func (rr *KEY) unpack(msg []byte, off int) (off1 int, err error) { func (rr *KEY) unpack(msg []byte, off int) (off1 int, err error) {
rdStart := off rdStart := off
_ = rdStart _ = rdStart
@ -2224,6 +2270,31 @@ func (rr *NULL) unpack(msg []byte, off int) (off1 int, err error) {
return off, nil 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
rr.NextDomain, off, err = UnpackDomainName(msg, off)
if err != nil {
return off, err
}
if off == len(msg) {
return off, nil
}
rr.TypeBitMap, off, err = unpackDataNsec(msg, off)
if err != nil {
return off, err
}
return off, nil
}
func (rr *OPENPGPKEY) unpack(msg []byte, off int) (off1 int, err error) { func (rr *OPENPGPKEY) unpack(msg []byte, off int) (off1 int, err error) {
rdStart := off rdStart := off
_ = rdStart _ = rdStart

View file

@ -36,6 +36,7 @@ var TypeToRR = map[uint16]func() RR{
TypeHIP: func() RR { return new(HIP) }, TypeHIP: func() RR { return new(HIP) },
TypeHTTPS: func() RR { return new(HTTPS) }, TypeHTTPS: func() RR { return new(HTTPS) },
TypeIPSECKEY: func() RR { return new(IPSECKEY) }, TypeIPSECKEY: func() RR { return new(IPSECKEY) },
TypeISDN: func() RR { return new(ISDN) },
TypeKEY: func() RR { return new(KEY) }, TypeKEY: func() RR { return new(KEY) },
TypeKX: func() RR { return new(KX) }, TypeKX: func() RR { return new(KX) },
TypeL32: func() RR { return new(L32) }, TypeL32: func() RR { return new(L32) },
@ -59,6 +60,8 @@ var TypeToRR = map[uint16]func() RR{
TypeNSEC3: func() RR { return new(NSEC3) }, TypeNSEC3: func() RR { return new(NSEC3) },
TypeNSEC3PARAM: func() RR { return new(NSEC3PARAM) }, TypeNSEC3PARAM: func() RR { return new(NSEC3PARAM) },
TypeNULL: func() RR { return new(NULL) }, TypeNULL: func() RR { return new(NULL) },
TypeNXNAME: func() RR { return new(NXNAME) },
TypeNXT: func() RR { return new(NXT) },
TypeOPENPGPKEY: func() RR { return new(OPENPGPKEY) }, TypeOPENPGPKEY: func() RR { return new(OPENPGPKEY) },
TypeOPT: func() RR { return new(OPT) }, TypeOPT: func() RR { return new(OPT) },
TypePTR: func() RR { return new(PTR) }, TypePTR: func() RR { return new(PTR) },
@ -144,6 +147,7 @@ var TypeToString = map[uint16]string{
TypeNSEC3: "NSEC3", TypeNSEC3: "NSEC3",
TypeNSEC3PARAM: "NSEC3PARAM", TypeNSEC3PARAM: "NSEC3PARAM",
TypeNULL: "NULL", TypeNULL: "NULL",
TypeNXNAME: "NXNAME",
TypeNXT: "NXT", TypeNXT: "NXT",
TypeNone: "None", TypeNone: "None",
TypeOPENPGPKEY: "OPENPGPKEY", TypeOPENPGPKEY: "OPENPGPKEY",
@ -204,6 +208,7 @@ func (rr *HINFO) Header() *RR_Header { return &rr.Hdr }
func (rr *HIP) Header() *RR_Header { return &rr.Hdr } func (rr *HIP) Header() *RR_Header { return &rr.Hdr }
func (rr *HTTPS) Header() *RR_Header { return &rr.Hdr } func (rr *HTTPS) Header() *RR_Header { return &rr.Hdr }
func (rr *IPSECKEY) Header() *RR_Header { return &rr.Hdr } func (rr *IPSECKEY) Header() *RR_Header { return &rr.Hdr }
func (rr *ISDN) Header() *RR_Header { return &rr.Hdr }
func (rr *KEY) Header() *RR_Header { return &rr.Hdr } func (rr *KEY) Header() *RR_Header { return &rr.Hdr }
func (rr *KX) Header() *RR_Header { return &rr.Hdr } func (rr *KX) Header() *RR_Header { return &rr.Hdr }
func (rr *L32) Header() *RR_Header { return &rr.Hdr } func (rr *L32) Header() *RR_Header { return &rr.Hdr }
@ -227,6 +232,8 @@ func (rr *NSEC) Header() *RR_Header { return &rr.Hdr }
func (rr *NSEC3) 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 *NSEC3PARAM) Header() *RR_Header { return &rr.Hdr }
func (rr *NULL) 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 *OPENPGPKEY) Header() *RR_Header { return &rr.Hdr }
func (rr *OPT) 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 *PTR) Header() *RR_Header { return &rr.Hdr }
@ -437,6 +444,13 @@ func (rr *IPSECKEY) len(off int, compression map[string]struct{}) int {
return l return l
} }
func (rr *ISDN) len(off int, compression map[string]struct{}) int {
l := rr.Hdr.len(off, compression)
l += len(rr.Address) + 1
l += len(rr.SubAddress) + 1
return l
}
func (rr *KX) len(off int, compression map[string]struct{}) int { func (rr *KX) len(off int, compression map[string]struct{}) int {
l := rr.Hdr.len(off, compression) l := rr.Hdr.len(off, compression)
l += 2 // Preference l += 2 // Preference
@ -583,6 +597,11 @@ func (rr *NULL) len(off int, compression map[string]struct{}) int {
return l 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 { func (rr *OPENPGPKEY) len(off int, compression map[string]struct{}) int {
l := rr.Hdr.len(off, compression) l := rr.Hdr.len(off, compression)
l += base64.StdEncoding.DecodedLen(len(rr.PublicKey)) l += base64.StdEncoding.DecodedLen(len(rr.PublicKey))
@ -966,6 +985,10 @@ func (rr *IPSECKEY) copy() RR {
} }
} }
func (rr *ISDN) copy() RR {
return &ISDN{rr.Hdr, rr.Address, rr.SubAddress}
}
func (rr *KEY) copy() RR { func (rr *KEY) copy() RR {
return &KEY{*rr.DNSKEY.copy().(*DNSKEY)} return &KEY{*rr.DNSKEY.copy().(*DNSKEY)}
} }
@ -1092,6 +1115,14 @@ func (rr *NULL) copy() RR {
return &NULL{rr.Hdr, rr.Data} 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)}
}
func (rr *OPENPGPKEY) copy() RR { func (rr *OPENPGPKEY) copy() RR {
return &OPENPGPKEY{rr.Hdr, rr.PublicKey} return &OPENPGPKEY{rr.Hdr, rr.PublicKey}
} }

4
vendor/golang.org/x/mod/LICENSE generated vendored
View file

@ -1,4 +1,4 @@
Copyright (c) 2009 The Go Authors. All rights reserved. Copyright 2009 The Go Authors.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are modification, are permitted provided that the following conditions are
@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer.
copyright notice, this list of conditions and the following disclaimer copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the in the documentation and/or other materials provided with the
distribution. distribution.
* Neither the name of Google Inc. nor the names of its * Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived from contributors may be used to endorse or promote products derived from
this software without specific prior written permission. this software without specific prior written permission.

View file

@ -140,7 +140,7 @@ func Compare(v, w string) int {
// Max canonicalizes its arguments and then returns the version string // Max canonicalizes its arguments and then returns the version string
// that compares greater. // that compares greater.
// //
// Deprecated: use Compare instead. In most cases, returning a canonicalized // Deprecated: use [Compare] instead. In most cases, returning a canonicalized
// version is not expected or desired. // version is not expected or desired.
func Max(v, w string) string { func Max(v, w string) string {
v = Canonical(v) v = Canonical(v)
@ -151,7 +151,7 @@ func Max(v, w string) string {
return w return w
} }
// ByVersion implements sort.Interface for sorting semantic version strings. // ByVersion implements [sort.Interface] for sorting semantic version strings.
type ByVersion []string type ByVersion []string
func (vs ByVersion) Len() int { return len(vs) } func (vs ByVersion) Len() int { return len(vs) }
@ -164,7 +164,7 @@ func (vs ByVersion) Less(i, j int) bool {
return vs[i] < vs[j] return vs[i] < vs[j]
} }
// Sort sorts a list of semantic version strings using ByVersion. // Sort sorts a list of semantic version strings using [ByVersion].
func Sort(list []string) { func Sort(list []string) {
sort.Sort(ByVersion(list)) sort.Sort(ByVersion(list))
} }

4
vendor/golang.org/x/net/LICENSE generated vendored
View file

@ -1,4 +1,4 @@
Copyright (c) 2009 The Go Authors. All rights reserved. Copyright 2009 The Go Authors.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are modification, are permitted provided that the following conditions are
@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer.
copyright notice, this list of conditions and the following disclaimer copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the in the documentation and/or other materials provided with the
distribution. distribution.
* Neither the name of Google Inc. nor the names of its * Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived from contributors may be used to endorse or promote products derived from
this software without specific prior written permission. this software without specific prior written permission.

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd //go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd
// +build aix darwin dragonfly freebsd netbsd openbsd
package socket package socket

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build (arm || mips || mipsle || 386 || ppc) && linux //go:build (arm || mips || mipsle || 386 || ppc) && linux
// +build arm mips mipsle 386 ppc
// +build linux
package socket package socket

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux //go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux
// +build arm64 amd64 loong64 ppc64 ppc64le mips64 mips64le riscv64 s390x
// +build linux
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build amd64 && solaris //go:build amd64 && solaris
// +build amd64,solaris
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris //go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || windows || zos //go:build aix || windows || zos
// +build aix windows zos
package socket package socket

View file

@ -3,6 +3,5 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build darwin && go1.12 //go:build darwin && go1.12
// +build darwin,go1.12
// This exists solely so we can linkname in symbols from syscall. // This exists solely so we can linkname in symbols from syscall.

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package socket package socket

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build (arm || mips || mipsle || 386 || ppc) && (darwin || dragonfly || freebsd || linux || netbsd || openbsd) //go:build (arm || mips || mipsle || 386 || ppc) && (darwin || dragonfly || freebsd || linux || netbsd || openbsd)
// +build arm mips mipsle 386 ppc
// +build darwin dragonfly freebsd linux netbsd openbsd
package socket package socket

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || zos) //go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || zos)
// +build arm64 amd64 loong64 ppc64 ppc64le mips64 mips64le riscv64 s390x
// +build aix darwin dragonfly freebsd linux netbsd openbsd zos
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build amd64 && solaris //go:build amd64 && solaris
// +build amd64,solaris
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !aix && !linux && !netbsd //go:build !aix && !linux && !netbsd
// +build !aix,!linux,!netbsd
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || linux || netbsd //go:build aix || linux || netbsd
// +build aix linux netbsd
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd //go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd
// +build aix darwin dragonfly freebsd netbsd openbsd
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || netbsd //go:build aix || darwin || dragonfly || freebsd || netbsd
// +build aix darwin dragonfly freebsd netbsd
package socket package socket

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build (arm || mips || mipsle || 386 || ppc) && linux //go:build (arm || mips || mipsle || 386 || ppc) && linux
// +build arm mips mipsle 386 ppc
// +build linux
package socket package socket

View file

@ -3,8 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux //go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux
// +build arm64 amd64 loong64 ppc64 ppc64le mips64 mips64le riscv64 s390x
// +build linux
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build amd64 && solaris //go:build amd64 && solaris
// +build amd64,solaris
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build s390x && zos //go:build s390x && zos
// +build s390x,zos
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !race //go:build !race
// +build !race
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build race //go:build race
// +build race
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build linux //go:build linux
// +build linux
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows || zos //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows zos
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !linux //go:build !linux
// +build !linux
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || openbsd || solaris //go:build aix || darwin || dragonfly || freebsd || openbsd || solaris
// +build aix darwin dragonfly freebsd openbsd solaris
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build linux && !s390x && !386 //go:build linux && !s390x && !386
// +build linux,!s390x,!386
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build loong64 //go:build loong64
// +build loong64
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build riscv64 //go:build riscv64
// +build riscv64
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows || zos //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows zos
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package socket package socket

View file

@ -3,7 +3,6 @@
// Added for go1.11 compatibility // Added for go1.11 compatibility
//go:build aix //go:build aix
// +build aix
package socket package socket

View file

@ -2,7 +2,6 @@
// cgo -godefs defs_linux.go // cgo -godefs defs_linux.go
//go:build loong64 //go:build loong64
// +build loong64
package socket package socket

View file

@ -2,7 +2,6 @@
// cgo -godefs defs_linux.go // cgo -godefs defs_linux.go
//go:build riscv64 //go:build riscv64
// +build riscv64
package socket package socket

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd //go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd
// +build aix darwin dragonfly freebsd netbsd openbsd
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build darwin || linux || solaris //go:build darwin || linux || solaris
// +build darwin linux solaris
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !linux //go:build !linux
// +build !linux
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !zos
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!zos
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows || zos //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows zos
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos
package ipv4 package ipv4

View file

@ -4,7 +4,6 @@
// Added for go1.11 compatibility // Added for go1.11 compatibility
//go:build aix //go:build aix
// +build aix
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd || solaris || windows //go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd netbsd openbsd solaris windows
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !aix && !darwin && !dragonfly && !freebsd && !netbsd && !openbsd && !solaris && !windows //go:build !aix && !darwin && !dragonfly && !freebsd && !netbsd && !openbsd && !solaris && !windows
// +build !aix,!darwin,!dragonfly,!freebsd,!netbsd,!openbsd,!solaris,!windows
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build darwin || freebsd || linux //go:build darwin || freebsd || linux
// +build darwin freebsd linux
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !darwin && !freebsd && !linux //go:build !darwin && !freebsd && !linux
// +build !darwin,!freebsd,!linux
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build linux //go:build linux
// +build linux
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !linux //go:build !linux
// +build !linux
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build netbsd || openbsd //go:build netbsd || openbsd
// +build netbsd openbsd
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build darwin || freebsd || linux || solaris //go:build darwin || freebsd || linux || solaris
// +build darwin freebsd linux solaris
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !darwin && !freebsd && !linux && !solaris //go:build !darwin && !freebsd && !linux && !solaris
// +build !darwin,!freebsd,!linux,!solaris
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// Added for go1.11 compatibility // Added for go1.11 compatibility
//go:build aix //go:build aix
// +build aix
package ipv4 package ipv4

View file

@ -2,7 +2,6 @@
// cgo -godefs defs_linux.go // cgo -godefs defs_linux.go
//go:build loong64 //go:build loong64
// +build loong64
package ipv4 package ipv4

View file

@ -2,7 +2,6 @@
// cgo -godefs defs_linux.go // cgo -godefs defs_linux.go
//go:build riscv64 //go:build riscv64
// +build riscv64
package ipv4 package ipv4

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build darwin //go:build darwin
// +build darwin
package ipv6 package ipv6

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package ipv6 package ipv6

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos
package ipv6 package ipv6

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
package ipv6 package ipv6

View file

@ -245,7 +245,7 @@ func (c *dgramOpt) Checksum() (on bool, offset int, err error) {
return true, offset, nil return true, offset, nil
} }
// SetChecksum enables the kernel checksum processing. If on is ture, // SetChecksum enables the kernel checksum processing. If on is true,
// the offset should be an offset in bytes into the data of where the // the offset should be an offset in bytes into the data of where the
// checksum field is located. // checksum field is located.
func (c *dgramOpt) SetChecksum(on bool, offset int) error { func (c *dgramOpt) SetChecksum(on bool, offset int) error {

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd //go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd
// +build aix darwin dragonfly freebsd netbsd openbsd
package ipv6 package ipv6

View file

@ -3,7 +3,6 @@
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos //go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos
package ipv6 package ipv6

Some files were not shown because too many files have changed in this diff Show more