v1.17.1
FIXED: * tplx/sprigx would throw errors on dnsx.IsPtr, because it returns a bool and net.IP instead of a boolen and optional error. Fixed by adding dnsx.IsPtrChk and using that instead.
This commit is contained in:
+56
-40
@@ -1,16 +1,16 @@
|
||||
package dnsx
|
||||
|
||||
import (
|
||||
`bytes`
|
||||
`encoding/base32`
|
||||
`fmt`
|
||||
`math`
|
||||
`net`
|
||||
`net/netip`
|
||||
`strings`
|
||||
"bytes"
|
||||
"encoding/base32"
|
||||
"fmt"
|
||||
"math"
|
||||
"net"
|
||||
"net/netip"
|
||||
"strings"
|
||||
|
||||
`go4.org/netipx`
|
||||
`r00t2.io/goutils/stringsx`
|
||||
"go4.org/netipx"
|
||||
"r00t2.io/goutils/stringsx"
|
||||
)
|
||||
|
||||
/*
|
||||
@@ -238,19 +238,19 @@ TXT records, etc. - not A/AAAA/CNAME, etc. - see RFC 8553 for details.
|
||||
See the following functions for allowing additional syntax/rule validation
|
||||
that have record-type-specific accommodations made:
|
||||
|
||||
* [IsFqdnDefinedTxt]
|
||||
* [IsFqdnNsec3]
|
||||
* [IsFqdnSrv]
|
||||
* [IsFqdnWildcard]
|
||||
- [IsFqdnDefinedTxt]
|
||||
- [IsFqdnNsec3]
|
||||
- [IsFqdnSrv]
|
||||
- [IsFqdnWildcard]
|
||||
|
||||
# RFC Coverage
|
||||
|
||||
This function should conform properly to:
|
||||
|
||||
* RFC 952
|
||||
* RFC 1034 and RFC 1035
|
||||
* RFC 1123
|
||||
* RFC 2181 (selectively, see above)
|
||||
- RFC 952
|
||||
- RFC 1034 and RFC 1035
|
||||
- RFC 1123
|
||||
- RFC 2181 (selectively, see above)
|
||||
|
||||
preferring the most up-to-date rules where relevant (e.g. labels may start with digits, as per RFC 1123).
|
||||
It enforces/checks label and overall length limits as defined by RFC.
|
||||
@@ -265,12 +265,12 @@ the caller must perform translation first
|
||||
|
||||
To reiterate, IDN/IDNA:
|
||||
|
||||
* RFC 3490
|
||||
* RFC 5890
|
||||
* RFC 5891
|
||||
* RFC 5892
|
||||
* RFC 5893
|
||||
* RFC 5894
|
||||
- RFC 3490
|
||||
- RFC 5890
|
||||
- RFC 5891
|
||||
- RFC 5892
|
||||
- RFC 5893
|
||||
- RFC 5894
|
||||
|
||||
and Punycode (RFC 3492) *MUST* use their ASCII forms, NOT the localized/Unicode formats.
|
||||
|
||||
@@ -299,18 +299,18 @@ func IsFqdn(s string) (fqdn bool) {
|
||||
IsFqdnDefinedTxt is like [IsFqdn] but explicitly *only* allows fully-qualified
|
||||
RFC-defined TXT "subtypes":
|
||||
|
||||
* ACME DNS-01 (RFC 8555)
|
||||
* BIMI (RFC draft [bimi])
|
||||
* DKIM (RFC 6376, RFC 8301, RFC 8463)
|
||||
* DKIM ATPS (RFC 6541)
|
||||
* DMARC (RFC 7489, RFC 9091, RFC 9616)
|
||||
* MTA-STS (RFC 8461)
|
||||
* TLSRPT (RFC 8460)
|
||||
- ACME DNS-01 (RFC 8555)
|
||||
- BIMI (RFC draft [bimi])
|
||||
- DKIM (RFC 6376, RFC 8301, RFC 8463)
|
||||
- DKIM ATPS (RFC 6541)
|
||||
- DMARC (RFC 7489, RFC 9091, RFC 9616)
|
||||
- MTA-STS (RFC 8461)
|
||||
- TLSRPT (RFC 8460)
|
||||
|
||||
Note that the following TXT "subtypes" do not have special formatting in labels/name,
|
||||
and thus are not covered by this function:
|
||||
|
||||
* SPF (RFC 4408, RFC 7208)
|
||||
- SPF (RFC 4408, RFC 7208)
|
||||
|
||||
[bimi]: https://datatracker.ietf.org/doc/html/draft-brand-indicators-for-message-identification
|
||||
*/
|
||||
@@ -359,15 +359,15 @@ can't be 100% confirmed with certainty - only basic checks can be done.
|
||||
|
||||
NSEC3 can be found via:
|
||||
|
||||
* RFC 5155
|
||||
* RFC 6840
|
||||
* RFC 6944
|
||||
* RFC 7129
|
||||
* RFC 8198
|
||||
* RFC 9077
|
||||
* RFC 9157
|
||||
* RFC 9276
|
||||
* RFC 9905
|
||||
- RFC 5155
|
||||
- RFC 6840
|
||||
- RFC 6944
|
||||
- RFC 7129
|
||||
- RFC 8198
|
||||
- RFC 9077
|
||||
- RFC 9157
|
||||
- RFC 9276
|
||||
- RFC 9905
|
||||
|
||||
At the time of writing, only one hashing algorithm (SHA-1) has been specified.
|
||||
However, because this function does not check against the IANA registration at runtime,
|
||||
@@ -524,6 +524,22 @@ func IsPtr(s string) (isPtr bool, addr net.IP) {
|
||||
return
|
||||
}
|
||||
|
||||
// IsPtrAddr is like IsPtr but only returns the `addr` value.
|
||||
func IsPtrAddr(s string) (addr net.IP) {
|
||||
|
||||
_, addr = IsPtr(s)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// IsPtrChk is like IsPtr but only returns the `isPtr` value.
|
||||
func IsPtrChk(s string) (isPtr bool) {
|
||||
|
||||
isPtr, _ = IsPtr(s)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// commonFqdn is used to validate some rules common to all record names.
|
||||
func commonFqdn(s string) (isOk bool) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user