2017-12-06 21:02:47 +11:00
|
|
|
// Code generated by "go run types_generate.go"; DO NOT EDIT.
|
2015-10-07 14:33:08 +11:00
|
|
|
|
|
|
|
package dns
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/base64"
|
|
|
|
"net"
|
|
|
|
)
|
|
|
|
|
2015-10-17 03:01:49 +11:00
|
|
|
// TypeToRR is a map of constructors for each RR type.
|
|
|
|
var TypeToRR = map[uint16]func() RR{
|
2015-10-07 14:33:08 +11:00
|
|
|
TypeA: func() RR { return new(A) },
|
|
|
|
TypeAAAA: func() RR { return new(AAAA) },
|
|
|
|
TypeAFSDB: func() RR { return new(AFSDB) },
|
|
|
|
TypeANY: func() RR { return new(ANY) },
|
2020-01-03 23:41:45 +11:00
|
|
|
TypeAPL: func() RR { return new(APL) },
|
2017-03-30 07:17:13 +11:00
|
|
|
TypeAVC: func() RR { return new(AVC) },
|
2015-10-07 14:33:08 +11:00
|
|
|
TypeCAA: func() RR { return new(CAA) },
|
|
|
|
TypeCDNSKEY: func() RR { return new(CDNSKEY) },
|
|
|
|
TypeCDS: func() RR { return new(CDS) },
|
|
|
|
TypeCERT: func() RR { return new(CERT) },
|
|
|
|
TypeCNAME: func() RR { return new(CNAME) },
|
Implement CSYNC (#585)
Implement the CSYNC record.
Fixes #290
Long overdue, lets add this record. Similar in vain as NSEC/NSEC3, we
need to implement len() our selves. Presentation format parsing and
tests are done as well.
This is CoreDNS running with CSYNC support, `dig` doesn't support this
at the moment, so:
~~~
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40323
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;csync.example.org. IN TYPE62
;; ANSWER SECTION:
csync.example.org. 10 IN TYPE62 \# 12 000335240042000460000008
;; AUTHORITY SECTION:
example.org. 10 IN NS a.iana-servers.net.
example.org. 10 IN NS b.iana-servers.net.
~~~
2017-11-25 19:19:06 +11:00
|
|
|
TypeCSYNC: func() RR { return new(CSYNC) },
|
2015-10-07 14:33:08 +11:00
|
|
|
TypeDHCID: func() RR { return new(DHCID) },
|
|
|
|
TypeDLV: func() RR { return new(DLV) },
|
|
|
|
TypeDNAME: func() RR { return new(DNAME) },
|
|
|
|
TypeDNSKEY: func() RR { return new(DNSKEY) },
|
|
|
|
TypeDS: func() RR { return new(DS) },
|
|
|
|
TypeEID: func() RR { return new(EID) },
|
|
|
|
TypeEUI48: func() RR { return new(EUI48) },
|
|
|
|
TypeEUI64: func() RR { return new(EUI64) },
|
|
|
|
TypeGID: func() RR { return new(GID) },
|
|
|
|
TypeGPOS: func() RR { return new(GPOS) },
|
|
|
|
TypeHINFO: func() RR { return new(HINFO) },
|
|
|
|
TypeHIP: func() RR { return new(HIP) },
|
Implement SVCB (#1067)
* Implement SVCB
* Fix serialization and deserialization of double quotes
* More effort (?)
4 months old commit
* DEBUG
* _
* Presentation format serialization/deserialization
* _
Remove generated
* Progress on presentation format parse & write
* _
* Finish parsing presentation format
* Regenerate
* Pack unpack
* Move to svcb.go
Scan_rr.go and types.go should be untouched now
* :bug:
Thanks ghedo
* Definitions
* TypeHTTPSSVC
* Generated
and isDuplicate
* Goodbye lenient functions
Now private key=value pairs have to be defined as structs too. They are no longer automatically named as KeyNNNNN
* Encode/decode
* Experimental svc
* Read method
* Implement some of the methods, use trick...
to report where the error is while reading it. This should be applied to EDNS too. Todo: Find if case can only contain e := new(SVC_ALPN) and rest moved out
Also fix two compile errors
* Add SVC_LOCAL methods, reorder, remove alpn value, bugs
* Errors
* Alpn, make it build
* Correct testsuite
* Fully implement parser
Change from keeping a state variable to reading in one iteration until the key=value pair is fully consumed
* Simplify and document
EDNS should be simplified too
* Attempt to fix fuzzer
And Alpn bug
* A bug and change type values to match @ghedo's implementation
* IP bug
Also there are two ip duplicating patterns, one with copy, one with append. Maybe change it to be consistent.
* Check for strictly increasing keys as required
* Don't panic on invalid alpn
* Redundant check, don't modify original array
* Size calculation
* Fix the fuzzer, match the style
* 65535 is reserved too, don't delay errors
* Check keyNNN, check for aliasform having values
* IPvNHint is an array
* Fix ipvNHint
* Rename everything
* Unrecognized keys according to the updated specification
* Skip zero-length structs in generators. Fix CI
* Doc cleanup
* Off by one
* Add parse tests
* Check if private key doesn't collide with known key, invalid tests
* Disallow IPv4 as IPv6. More tests.
Related #1107
* Style fixes
* More consistency, more tests
* :bug: Deep copy as in the documentation
a := make([]net.IP, 1)
a[0] = net.ParseIP("1.1.1.1").To4()
b := append(make([]net.IP, 0, 1), a...)
b[0] = net.ParseIP("3.1.1.1").To4()
fmt.Println(a[0][0])
* Make tests readable
* Move valid parse tests to different file
* :bug: One of previous commits not fully committed
* Test binary single value encoding/decoding and full encode/decode
* Add worst-case grows to builders, :bug: Wrong visible character range, redundant tests
* Testing improvements
And don't convert to IPv4 twice
* Doc update only
* Document worst case allocations
and ipv6 can be at most of length 39, not 40
* Redundant IP copy, consistent IPv6 behavior, fix deep copy
* isDuplicate for SVCB
* Optimizations
* echoconfig
* Svc => SVCB
* Fix CI
* Regenerate after REBASE (2)
Rebased twice on 15th and 20th May
* Rename svc, use escapeByte.
* Fix parsing whitespaces between quotes, rename ECHOHOConfig
* resolve
Remove svcbFieldLen
Use reverseInt
Uppercase SVCB
Rename key_value
"invalid" => bad
Alpn comments
> 65535 check
Unneeded slices
* a little more
read => parse
IP array meaning
Force pushed because forgot to change read in svcb_test.go
* HTTPSSVC -> HTTPS
* Use new values
* mandatory code
https://github.com/MikeBishop/dns-alt-svc/pull/205
* Resolve comments
Rename svcb-pairs
Remove SVCB_PRIVATE ranges
Comment on SVCB_KEY65535
ParseError return l.token
rename svcbKeyToString and svcbStringToKey
privatize SVCBKeyToString, SVCBStringToKey
* Refactor 1
Rename sorted, originalPairs
Use append instead of copy
Use svcb_RESERVED instead of 65535, with it now being private
"type SVCBKey uint16"
* Refactor 2
svcbKeyToString as method
svcbStringToKey updated after key 0
:bug: mandatory has missing key
Rename str
idx < 0
* Refactor 3
Use l.token as z
var key, value string
Comment wrap
0:
Sentences with '.'
keyValue => kv
* Refactor 4
* Refactor 5
len() int
* Refactor 6
* Refactor 7
* Test remove parsing
* Error messages
* Rewrite two estimate comments
* parse shouldn't modify original array :bug:
* Remove two unneeded comments
* Address review comments
Push 2 because can't build fuzzer python
Push 3 to try again
* Simplify argument duplication as per tmthrgd's suggestion
And add the relevant test
Force push edit: Make sorting code fit into one line
* Rewrite ECHConfig and address the review
* Remove the optional tab
* Add To4() Check
* More cleanup and fix mandatory not sorting bug
2020-10-11 18:09:36 +11:00
|
|
|
TypeHTTPS: func() RR { return new(HTTPS) },
|
2015-10-07 14:33:08 +11:00
|
|
|
TypeKEY: func() RR { return new(KEY) },
|
|
|
|
TypeKX: func() RR { return new(KX) },
|
|
|
|
TypeL32: func() RR { return new(L32) },
|
|
|
|
TypeL64: func() RR { return new(L64) },
|
|
|
|
TypeLOC: func() RR { return new(LOC) },
|
|
|
|
TypeLP: func() RR { return new(LP) },
|
|
|
|
TypeMB: func() RR { return new(MB) },
|
|
|
|
TypeMD: func() RR { return new(MD) },
|
|
|
|
TypeMF: func() RR { return new(MF) },
|
|
|
|
TypeMG: func() RR { return new(MG) },
|
|
|
|
TypeMINFO: func() RR { return new(MINFO) },
|
|
|
|
TypeMR: func() RR { return new(MR) },
|
|
|
|
TypeMX: func() RR { return new(MX) },
|
|
|
|
TypeNAPTR: func() RR { return new(NAPTR) },
|
|
|
|
TypeNID: func() RR { return new(NID) },
|
|
|
|
TypeNIMLOC: func() RR { return new(NIMLOC) },
|
|
|
|
TypeNINFO: func() RR { return new(NINFO) },
|
|
|
|
TypeNS: func() RR { return new(NS) },
|
|
|
|
TypeNSAPPTR: func() RR { return new(NSAPPTR) },
|
|
|
|
TypeNSEC: func() RR { return new(NSEC) },
|
|
|
|
TypeNSEC3: func() RR { return new(NSEC3) },
|
|
|
|
TypeNSEC3PARAM: func() RR { return new(NSEC3PARAM) },
|
2018-12-30 20:45:18 +11:00
|
|
|
TypeNULL: func() RR { return new(NULL) },
|
2015-10-07 14:33:08 +11:00
|
|
|
TypeOPENPGPKEY: func() RR { return new(OPENPGPKEY) },
|
|
|
|
TypeOPT: func() RR { return new(OPT) },
|
|
|
|
TypePTR: func() RR { return new(PTR) },
|
|
|
|
TypePX: func() RR { return new(PX) },
|
|
|
|
TypeRKEY: func() RR { return new(RKEY) },
|
|
|
|
TypeRP: func() RR { return new(RP) },
|
|
|
|
TypeRRSIG: func() RR { return new(RRSIG) },
|
|
|
|
TypeRT: func() RR { return new(RT) },
|
|
|
|
TypeSIG: func() RR { return new(SIG) },
|
2016-10-18 04:09:52 +11:00
|
|
|
TypeSMIMEA: func() RR { return new(SMIMEA) },
|
2015-10-07 14:33:08 +11:00
|
|
|
TypeSOA: func() RR { return new(SOA) },
|
|
|
|
TypeSPF: func() RR { return new(SPF) },
|
|
|
|
TypeSRV: func() RR { return new(SRV) },
|
|
|
|
TypeSSHFP: func() RR { return new(SSHFP) },
|
Implement SVCB (#1067)
* Implement SVCB
* Fix serialization and deserialization of double quotes
* More effort (?)
4 months old commit
* DEBUG
* _
* Presentation format serialization/deserialization
* _
Remove generated
* Progress on presentation format parse & write
* _
* Finish parsing presentation format
* Regenerate
* Pack unpack
* Move to svcb.go
Scan_rr.go and types.go should be untouched now
* :bug:
Thanks ghedo
* Definitions
* TypeHTTPSSVC
* Generated
and isDuplicate
* Goodbye lenient functions
Now private key=value pairs have to be defined as structs too. They are no longer automatically named as KeyNNNNN
* Encode/decode
* Experimental svc
* Read method
* Implement some of the methods, use trick...
to report where the error is while reading it. This should be applied to EDNS too. Todo: Find if case can only contain e := new(SVC_ALPN) and rest moved out
Also fix two compile errors
* Add SVC_LOCAL methods, reorder, remove alpn value, bugs
* Errors
* Alpn, make it build
* Correct testsuite
* Fully implement parser
Change from keeping a state variable to reading in one iteration until the key=value pair is fully consumed
* Simplify and document
EDNS should be simplified too
* Attempt to fix fuzzer
And Alpn bug
* A bug and change type values to match @ghedo's implementation
* IP bug
Also there are two ip duplicating patterns, one with copy, one with append. Maybe change it to be consistent.
* Check for strictly increasing keys as required
* Don't panic on invalid alpn
* Redundant check, don't modify original array
* Size calculation
* Fix the fuzzer, match the style
* 65535 is reserved too, don't delay errors
* Check keyNNN, check for aliasform having values
* IPvNHint is an array
* Fix ipvNHint
* Rename everything
* Unrecognized keys according to the updated specification
* Skip zero-length structs in generators. Fix CI
* Doc cleanup
* Off by one
* Add parse tests
* Check if private key doesn't collide with known key, invalid tests
* Disallow IPv4 as IPv6. More tests.
Related #1107
* Style fixes
* More consistency, more tests
* :bug: Deep copy as in the documentation
a := make([]net.IP, 1)
a[0] = net.ParseIP("1.1.1.1").To4()
b := append(make([]net.IP, 0, 1), a...)
b[0] = net.ParseIP("3.1.1.1").To4()
fmt.Println(a[0][0])
* Make tests readable
* Move valid parse tests to different file
* :bug: One of previous commits not fully committed
* Test binary single value encoding/decoding and full encode/decode
* Add worst-case grows to builders, :bug: Wrong visible character range, redundant tests
* Testing improvements
And don't convert to IPv4 twice
* Doc update only
* Document worst case allocations
and ipv6 can be at most of length 39, not 40
* Redundant IP copy, consistent IPv6 behavior, fix deep copy
* isDuplicate for SVCB
* Optimizations
* echoconfig
* Svc => SVCB
* Fix CI
* Regenerate after REBASE (2)
Rebased twice on 15th and 20th May
* Rename svc, use escapeByte.
* Fix parsing whitespaces between quotes, rename ECHOHOConfig
* resolve
Remove svcbFieldLen
Use reverseInt
Uppercase SVCB
Rename key_value
"invalid" => bad
Alpn comments
> 65535 check
Unneeded slices
* a little more
read => parse
IP array meaning
Force pushed because forgot to change read in svcb_test.go
* HTTPSSVC -> HTTPS
* Use new values
* mandatory code
https://github.com/MikeBishop/dns-alt-svc/pull/205
* Resolve comments
Rename svcb-pairs
Remove SVCB_PRIVATE ranges
Comment on SVCB_KEY65535
ParseError return l.token
rename svcbKeyToString and svcbStringToKey
privatize SVCBKeyToString, SVCBStringToKey
* Refactor 1
Rename sorted, originalPairs
Use append instead of copy
Use svcb_RESERVED instead of 65535, with it now being private
"type SVCBKey uint16"
* Refactor 2
svcbKeyToString as method
svcbStringToKey updated after key 0
:bug: mandatory has missing key
Rename str
idx < 0
* Refactor 3
Use l.token as z
var key, value string
Comment wrap
0:
Sentences with '.'
keyValue => kv
* Refactor 4
* Refactor 5
len() int
* Refactor 6
* Refactor 7
* Test remove parsing
* Error messages
* Rewrite two estimate comments
* parse shouldn't modify original array :bug:
* Remove two unneeded comments
* Address review comments
Push 2 because can't build fuzzer python
Push 3 to try again
* Simplify argument duplication as per tmthrgd's suggestion
And add the relevant test
Force push edit: Make sorting code fit into one line
* Rewrite ECHConfig and address the review
* Remove the optional tab
* Add To4() Check
* More cleanup and fix mandatory not sorting bug
2020-10-11 18:09:36 +11:00
|
|
|
TypeSVCB: func() RR { return new(SVCB) },
|
2015-10-07 14:33:08 +11:00
|
|
|
TypeTA: func() RR { return new(TA) },
|
|
|
|
TypeTALINK: func() RR { return new(TALINK) },
|
|
|
|
TypeTKEY: func() RR { return new(TKEY) },
|
|
|
|
TypeTLSA: func() RR { return new(TLSA) },
|
|
|
|
TypeTSIG: func() RR { return new(TSIG) },
|
|
|
|
TypeTXT: func() RR { return new(TXT) },
|
|
|
|
TypeUID: func() RR { return new(UID) },
|
|
|
|
TypeUINFO: func() RR { return new(UINFO) },
|
|
|
|
TypeURI: func() RR { return new(URI) },
|
|
|
|
TypeX25: func() RR { return new(X25) },
|
2021-02-27 02:35:05 +11:00
|
|
|
TypeZONEMD: func() RR { return new(ZONEMD) },
|
2015-10-07 14:33:08 +11:00
|
|
|
}
|
|
|
|
|
2015-10-17 03:01:49 +11:00
|
|
|
// TypeToString is a map of strings for each RR type.
|
2015-10-07 14:33:08 +11:00
|
|
|
var TypeToString = map[uint16]string{
|
|
|
|
TypeA: "A",
|
|
|
|
TypeAAAA: "AAAA",
|
|
|
|
TypeAFSDB: "AFSDB",
|
|
|
|
TypeANY: "ANY",
|
2020-01-03 23:41:45 +11:00
|
|
|
TypeAPL: "APL",
|
2015-10-07 14:33:08 +11:00
|
|
|
TypeATMA: "ATMA",
|
2017-03-30 07:17:13 +11:00
|
|
|
TypeAVC: "AVC",
|
2015-10-07 14:33:08 +11:00
|
|
|
TypeAXFR: "AXFR",
|
|
|
|
TypeCAA: "CAA",
|
|
|
|
TypeCDNSKEY: "CDNSKEY",
|
|
|
|
TypeCDS: "CDS",
|
|
|
|
TypeCERT: "CERT",
|
|
|
|
TypeCNAME: "CNAME",
|
Implement CSYNC (#585)
Implement the CSYNC record.
Fixes #290
Long overdue, lets add this record. Similar in vain as NSEC/NSEC3, we
need to implement len() our selves. Presentation format parsing and
tests are done as well.
This is CoreDNS running with CSYNC support, `dig` doesn't support this
at the moment, so:
~~~
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40323
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;csync.example.org. IN TYPE62
;; ANSWER SECTION:
csync.example.org. 10 IN TYPE62 \# 12 000335240042000460000008
;; AUTHORITY SECTION:
example.org. 10 IN NS a.iana-servers.net.
example.org. 10 IN NS b.iana-servers.net.
~~~
2017-11-25 19:19:06 +11:00
|
|
|
TypeCSYNC: "CSYNC",
|
2015-10-07 14:33:08 +11:00
|
|
|
TypeDHCID: "DHCID",
|
|
|
|
TypeDLV: "DLV",
|
|
|
|
TypeDNAME: "DNAME",
|
|
|
|
TypeDNSKEY: "DNSKEY",
|
|
|
|
TypeDS: "DS",
|
|
|
|
TypeEID: "EID",
|
|
|
|
TypeEUI48: "EUI48",
|
|
|
|
TypeEUI64: "EUI64",
|
|
|
|
TypeGID: "GID",
|
|
|
|
TypeGPOS: "GPOS",
|
|
|
|
TypeHINFO: "HINFO",
|
|
|
|
TypeHIP: "HIP",
|
Implement SVCB (#1067)
* Implement SVCB
* Fix serialization and deserialization of double quotes
* More effort (?)
4 months old commit
* DEBUG
* _
* Presentation format serialization/deserialization
* _
Remove generated
* Progress on presentation format parse & write
* _
* Finish parsing presentation format
* Regenerate
* Pack unpack
* Move to svcb.go
Scan_rr.go and types.go should be untouched now
* :bug:
Thanks ghedo
* Definitions
* TypeHTTPSSVC
* Generated
and isDuplicate
* Goodbye lenient functions
Now private key=value pairs have to be defined as structs too. They are no longer automatically named as KeyNNNNN
* Encode/decode
* Experimental svc
* Read method
* Implement some of the methods, use trick...
to report where the error is while reading it. This should be applied to EDNS too. Todo: Find if case can only contain e := new(SVC_ALPN) and rest moved out
Also fix two compile errors
* Add SVC_LOCAL methods, reorder, remove alpn value, bugs
* Errors
* Alpn, make it build
* Correct testsuite
* Fully implement parser
Change from keeping a state variable to reading in one iteration until the key=value pair is fully consumed
* Simplify and document
EDNS should be simplified too
* Attempt to fix fuzzer
And Alpn bug
* A bug and change type values to match @ghedo's implementation
* IP bug
Also there are two ip duplicating patterns, one with copy, one with append. Maybe change it to be consistent.
* Check for strictly increasing keys as required
* Don't panic on invalid alpn
* Redundant check, don't modify original array
* Size calculation
* Fix the fuzzer, match the style
* 65535 is reserved too, don't delay errors
* Check keyNNN, check for aliasform having values
* IPvNHint is an array
* Fix ipvNHint
* Rename everything
* Unrecognized keys according to the updated specification
* Skip zero-length structs in generators. Fix CI
* Doc cleanup
* Off by one
* Add parse tests
* Check if private key doesn't collide with known key, invalid tests
* Disallow IPv4 as IPv6. More tests.
Related #1107
* Style fixes
* More consistency, more tests
* :bug: Deep copy as in the documentation
a := make([]net.IP, 1)
a[0] = net.ParseIP("1.1.1.1").To4()
b := append(make([]net.IP, 0, 1), a...)
b[0] = net.ParseIP("3.1.1.1").To4()
fmt.Println(a[0][0])
* Make tests readable
* Move valid parse tests to different file
* :bug: One of previous commits not fully committed
* Test binary single value encoding/decoding and full encode/decode
* Add worst-case grows to builders, :bug: Wrong visible character range, redundant tests
* Testing improvements
And don't convert to IPv4 twice
* Doc update only
* Document worst case allocations
and ipv6 can be at most of length 39, not 40
* Redundant IP copy, consistent IPv6 behavior, fix deep copy
* isDuplicate for SVCB
* Optimizations
* echoconfig
* Svc => SVCB
* Fix CI
* Regenerate after REBASE (2)
Rebased twice on 15th and 20th May
* Rename svc, use escapeByte.
* Fix parsing whitespaces between quotes, rename ECHOHOConfig
* resolve
Remove svcbFieldLen
Use reverseInt
Uppercase SVCB
Rename key_value
"invalid" => bad
Alpn comments
> 65535 check
Unneeded slices
* a little more
read => parse
IP array meaning
Force pushed because forgot to change read in svcb_test.go
* HTTPSSVC -> HTTPS
* Use new values
* mandatory code
https://github.com/MikeBishop/dns-alt-svc/pull/205
* Resolve comments
Rename svcb-pairs
Remove SVCB_PRIVATE ranges
Comment on SVCB_KEY65535
ParseError return l.token
rename svcbKeyToString and svcbStringToKey
privatize SVCBKeyToString, SVCBStringToKey
* Refactor 1
Rename sorted, originalPairs
Use append instead of copy
Use svcb_RESERVED instead of 65535, with it now being private
"type SVCBKey uint16"
* Refactor 2
svcbKeyToString as method
svcbStringToKey updated after key 0
:bug: mandatory has missing key
Rename str
idx < 0
* Refactor 3
Use l.token as z
var key, value string
Comment wrap
0:
Sentences with '.'
keyValue => kv
* Refactor 4
* Refactor 5
len() int
* Refactor 6
* Refactor 7
* Test remove parsing
* Error messages
* Rewrite two estimate comments
* parse shouldn't modify original array :bug:
* Remove two unneeded comments
* Address review comments
Push 2 because can't build fuzzer python
Push 3 to try again
* Simplify argument duplication as per tmthrgd's suggestion
And add the relevant test
Force push edit: Make sorting code fit into one line
* Rewrite ECHConfig and address the review
* Remove the optional tab
* Add To4() Check
* More cleanup and fix mandatory not sorting bug
2020-10-11 18:09:36 +11:00
|
|
|
TypeHTTPS: "HTTPS",
|
2015-10-07 14:33:08 +11:00
|
|
|
TypeISDN: "ISDN",
|
|
|
|
TypeIXFR: "IXFR",
|
|
|
|
TypeKEY: "KEY",
|
|
|
|
TypeKX: "KX",
|
|
|
|
TypeL32: "L32",
|
|
|
|
TypeL64: "L64",
|
|
|
|
TypeLOC: "LOC",
|
|
|
|
TypeLP: "LP",
|
|
|
|
TypeMAILA: "MAILA",
|
|
|
|
TypeMAILB: "MAILB",
|
|
|
|
TypeMB: "MB",
|
|
|
|
TypeMD: "MD",
|
|
|
|
TypeMF: "MF",
|
|
|
|
TypeMG: "MG",
|
|
|
|
TypeMINFO: "MINFO",
|
|
|
|
TypeMR: "MR",
|
|
|
|
TypeMX: "MX",
|
|
|
|
TypeNAPTR: "NAPTR",
|
|
|
|
TypeNID: "NID",
|
|
|
|
TypeNIMLOC: "NIMLOC",
|
|
|
|
TypeNINFO: "NINFO",
|
|
|
|
TypeNS: "NS",
|
|
|
|
TypeNSEC: "NSEC",
|
|
|
|
TypeNSEC3: "NSEC3",
|
|
|
|
TypeNSEC3PARAM: "NSEC3PARAM",
|
|
|
|
TypeNULL: "NULL",
|
|
|
|
TypeNXT: "NXT",
|
|
|
|
TypeNone: "None",
|
|
|
|
TypeOPENPGPKEY: "OPENPGPKEY",
|
|
|
|
TypeOPT: "OPT",
|
|
|
|
TypePTR: "PTR",
|
|
|
|
TypePX: "PX",
|
|
|
|
TypeRKEY: "RKEY",
|
|
|
|
TypeRP: "RP",
|
|
|
|
TypeRRSIG: "RRSIG",
|
|
|
|
TypeRT: "RT",
|
|
|
|
TypeReserved: "Reserved",
|
|
|
|
TypeSIG: "SIG",
|
2016-10-18 04:09:52 +11:00
|
|
|
TypeSMIMEA: "SMIMEA",
|
2015-10-07 14:33:08 +11:00
|
|
|
TypeSOA: "SOA",
|
|
|
|
TypeSPF: "SPF",
|
|
|
|
TypeSRV: "SRV",
|
|
|
|
TypeSSHFP: "SSHFP",
|
Implement SVCB (#1067)
* Implement SVCB
* Fix serialization and deserialization of double quotes
* More effort (?)
4 months old commit
* DEBUG
* _
* Presentation format serialization/deserialization
* _
Remove generated
* Progress on presentation format parse & write
* _
* Finish parsing presentation format
* Regenerate
* Pack unpack
* Move to svcb.go
Scan_rr.go and types.go should be untouched now
* :bug:
Thanks ghedo
* Definitions
* TypeHTTPSSVC
* Generated
and isDuplicate
* Goodbye lenient functions
Now private key=value pairs have to be defined as structs too. They are no longer automatically named as KeyNNNNN
* Encode/decode
* Experimental svc
* Read method
* Implement some of the methods, use trick...
to report where the error is while reading it. This should be applied to EDNS too. Todo: Find if case can only contain e := new(SVC_ALPN) and rest moved out
Also fix two compile errors
* Add SVC_LOCAL methods, reorder, remove alpn value, bugs
* Errors
* Alpn, make it build
* Correct testsuite
* Fully implement parser
Change from keeping a state variable to reading in one iteration until the key=value pair is fully consumed
* Simplify and document
EDNS should be simplified too
* Attempt to fix fuzzer
And Alpn bug
* A bug and change type values to match @ghedo's implementation
* IP bug
Also there are two ip duplicating patterns, one with copy, one with append. Maybe change it to be consistent.
* Check for strictly increasing keys as required
* Don't panic on invalid alpn
* Redundant check, don't modify original array
* Size calculation
* Fix the fuzzer, match the style
* 65535 is reserved too, don't delay errors
* Check keyNNN, check for aliasform having values
* IPvNHint is an array
* Fix ipvNHint
* Rename everything
* Unrecognized keys according to the updated specification
* Skip zero-length structs in generators. Fix CI
* Doc cleanup
* Off by one
* Add parse tests
* Check if private key doesn't collide with known key, invalid tests
* Disallow IPv4 as IPv6. More tests.
Related #1107
* Style fixes
* More consistency, more tests
* :bug: Deep copy as in the documentation
a := make([]net.IP, 1)
a[0] = net.ParseIP("1.1.1.1").To4()
b := append(make([]net.IP, 0, 1), a...)
b[0] = net.ParseIP("3.1.1.1").To4()
fmt.Println(a[0][0])
* Make tests readable
* Move valid parse tests to different file
* :bug: One of previous commits not fully committed
* Test binary single value encoding/decoding and full encode/decode
* Add worst-case grows to builders, :bug: Wrong visible character range, redundant tests
* Testing improvements
And don't convert to IPv4 twice
* Doc update only
* Document worst case allocations
and ipv6 can be at most of length 39, not 40
* Redundant IP copy, consistent IPv6 behavior, fix deep copy
* isDuplicate for SVCB
* Optimizations
* echoconfig
* Svc => SVCB
* Fix CI
* Regenerate after REBASE (2)
Rebased twice on 15th and 20th May
* Rename svc, use escapeByte.
* Fix parsing whitespaces between quotes, rename ECHOHOConfig
* resolve
Remove svcbFieldLen
Use reverseInt
Uppercase SVCB
Rename key_value
"invalid" => bad
Alpn comments
> 65535 check
Unneeded slices
* a little more
read => parse
IP array meaning
Force pushed because forgot to change read in svcb_test.go
* HTTPSSVC -> HTTPS
* Use new values
* mandatory code
https://github.com/MikeBishop/dns-alt-svc/pull/205
* Resolve comments
Rename svcb-pairs
Remove SVCB_PRIVATE ranges
Comment on SVCB_KEY65535
ParseError return l.token
rename svcbKeyToString and svcbStringToKey
privatize SVCBKeyToString, SVCBStringToKey
* Refactor 1
Rename sorted, originalPairs
Use append instead of copy
Use svcb_RESERVED instead of 65535, with it now being private
"type SVCBKey uint16"
* Refactor 2
svcbKeyToString as method
svcbStringToKey updated after key 0
:bug: mandatory has missing key
Rename str
idx < 0
* Refactor 3
Use l.token as z
var key, value string
Comment wrap
0:
Sentences with '.'
keyValue => kv
* Refactor 4
* Refactor 5
len() int
* Refactor 6
* Refactor 7
* Test remove parsing
* Error messages
* Rewrite two estimate comments
* parse shouldn't modify original array :bug:
* Remove two unneeded comments
* Address review comments
Push 2 because can't build fuzzer python
Push 3 to try again
* Simplify argument duplication as per tmthrgd's suggestion
And add the relevant test
Force push edit: Make sorting code fit into one line
* Rewrite ECHConfig and address the review
* Remove the optional tab
* Add To4() Check
* More cleanup and fix mandatory not sorting bug
2020-10-11 18:09:36 +11:00
|
|
|
TypeSVCB: "SVCB",
|
2015-10-07 14:33:08 +11:00
|
|
|
TypeTA: "TA",
|
|
|
|
TypeTALINK: "TALINK",
|
|
|
|
TypeTKEY: "TKEY",
|
|
|
|
TypeTLSA: "TLSA",
|
|
|
|
TypeTSIG: "TSIG",
|
|
|
|
TypeTXT: "TXT",
|
|
|
|
TypeUID: "UID",
|
|
|
|
TypeUINFO: "UINFO",
|
|
|
|
TypeUNSPEC: "UNSPEC",
|
|
|
|
TypeURI: "URI",
|
|
|
|
TypeX25: "X25",
|
2021-02-27 02:35:05 +11:00
|
|
|
TypeZONEMD: "ZONEMD",
|
2015-10-07 14:33:08 +11:00
|
|
|
TypeNSAPPTR: "NSAP-PTR",
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rr *A) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *AAAA) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *AFSDB) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *ANY) Header() *RR_Header { return &rr.Hdr }
|
2020-01-03 23:41:45 +11:00
|
|
|
func (rr *APL) Header() *RR_Header { return &rr.Hdr }
|
2017-03-30 07:17:13 +11:00
|
|
|
func (rr *AVC) Header() *RR_Header { return &rr.Hdr }
|
2015-10-07 14:33:08 +11:00
|
|
|
func (rr *CAA) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *CDNSKEY) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *CDS) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *CERT) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *CNAME) Header() *RR_Header { return &rr.Hdr }
|
Implement CSYNC (#585)
Implement the CSYNC record.
Fixes #290
Long overdue, lets add this record. Similar in vain as NSEC/NSEC3, we
need to implement len() our selves. Presentation format parsing and
tests are done as well.
This is CoreDNS running with CSYNC support, `dig` doesn't support this
at the moment, so:
~~~
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40323
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;csync.example.org. IN TYPE62
;; ANSWER SECTION:
csync.example.org. 10 IN TYPE62 \# 12 000335240042000460000008
;; AUTHORITY SECTION:
example.org. 10 IN NS a.iana-servers.net.
example.org. 10 IN NS b.iana-servers.net.
~~~
2017-11-25 19:19:06 +11:00
|
|
|
func (rr *CSYNC) Header() *RR_Header { return &rr.Hdr }
|
2015-10-07 14:33:08 +11:00
|
|
|
func (rr *DHCID) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *DLV) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *DNAME) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *DNSKEY) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *DS) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *EID) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *EUI48) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *EUI64) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *GID) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *GPOS) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *HINFO) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *HIP) Header() *RR_Header { return &rr.Hdr }
|
Implement SVCB (#1067)
* Implement SVCB
* Fix serialization and deserialization of double quotes
* More effort (?)
4 months old commit
* DEBUG
* _
* Presentation format serialization/deserialization
* _
Remove generated
* Progress on presentation format parse & write
* _
* Finish parsing presentation format
* Regenerate
* Pack unpack
* Move to svcb.go
Scan_rr.go and types.go should be untouched now
* :bug:
Thanks ghedo
* Definitions
* TypeHTTPSSVC
* Generated
and isDuplicate
* Goodbye lenient functions
Now private key=value pairs have to be defined as structs too. They are no longer automatically named as KeyNNNNN
* Encode/decode
* Experimental svc
* Read method
* Implement some of the methods, use trick...
to report where the error is while reading it. This should be applied to EDNS too. Todo: Find if case can only contain e := new(SVC_ALPN) and rest moved out
Also fix two compile errors
* Add SVC_LOCAL methods, reorder, remove alpn value, bugs
* Errors
* Alpn, make it build
* Correct testsuite
* Fully implement parser
Change from keeping a state variable to reading in one iteration until the key=value pair is fully consumed
* Simplify and document
EDNS should be simplified too
* Attempt to fix fuzzer
And Alpn bug
* A bug and change type values to match @ghedo's implementation
* IP bug
Also there are two ip duplicating patterns, one with copy, one with append. Maybe change it to be consistent.
* Check for strictly increasing keys as required
* Don't panic on invalid alpn
* Redundant check, don't modify original array
* Size calculation
* Fix the fuzzer, match the style
* 65535 is reserved too, don't delay errors
* Check keyNNN, check for aliasform having values
* IPvNHint is an array
* Fix ipvNHint
* Rename everything
* Unrecognized keys according to the updated specification
* Skip zero-length structs in generators. Fix CI
* Doc cleanup
* Off by one
* Add parse tests
* Check if private key doesn't collide with known key, invalid tests
* Disallow IPv4 as IPv6. More tests.
Related #1107
* Style fixes
* More consistency, more tests
* :bug: Deep copy as in the documentation
a := make([]net.IP, 1)
a[0] = net.ParseIP("1.1.1.1").To4()
b := append(make([]net.IP, 0, 1), a...)
b[0] = net.ParseIP("3.1.1.1").To4()
fmt.Println(a[0][0])
* Make tests readable
* Move valid parse tests to different file
* :bug: One of previous commits not fully committed
* Test binary single value encoding/decoding and full encode/decode
* Add worst-case grows to builders, :bug: Wrong visible character range, redundant tests
* Testing improvements
And don't convert to IPv4 twice
* Doc update only
* Document worst case allocations
and ipv6 can be at most of length 39, not 40
* Redundant IP copy, consistent IPv6 behavior, fix deep copy
* isDuplicate for SVCB
* Optimizations
* echoconfig
* Svc => SVCB
* Fix CI
* Regenerate after REBASE (2)
Rebased twice on 15th and 20th May
* Rename svc, use escapeByte.
* Fix parsing whitespaces between quotes, rename ECHOHOConfig
* resolve
Remove svcbFieldLen
Use reverseInt
Uppercase SVCB
Rename key_value
"invalid" => bad
Alpn comments
> 65535 check
Unneeded slices
* a little more
read => parse
IP array meaning
Force pushed because forgot to change read in svcb_test.go
* HTTPSSVC -> HTTPS
* Use new values
* mandatory code
https://github.com/MikeBishop/dns-alt-svc/pull/205
* Resolve comments
Rename svcb-pairs
Remove SVCB_PRIVATE ranges
Comment on SVCB_KEY65535
ParseError return l.token
rename svcbKeyToString and svcbStringToKey
privatize SVCBKeyToString, SVCBStringToKey
* Refactor 1
Rename sorted, originalPairs
Use append instead of copy
Use svcb_RESERVED instead of 65535, with it now being private
"type SVCBKey uint16"
* Refactor 2
svcbKeyToString as method
svcbStringToKey updated after key 0
:bug: mandatory has missing key
Rename str
idx < 0
* Refactor 3
Use l.token as z
var key, value string
Comment wrap
0:
Sentences with '.'
keyValue => kv
* Refactor 4
* Refactor 5
len() int
* Refactor 6
* Refactor 7
* Test remove parsing
* Error messages
* Rewrite two estimate comments
* parse shouldn't modify original array :bug:
* Remove two unneeded comments
* Address review comments
Push 2 because can't build fuzzer python
Push 3 to try again
* Simplify argument duplication as per tmthrgd's suggestion
And add the relevant test
Force push edit: Make sorting code fit into one line
* Rewrite ECHConfig and address the review
* Remove the optional tab
* Add To4() Check
* More cleanup and fix mandatory not sorting bug
2020-10-11 18:09:36 +11:00
|
|
|
func (rr *HTTPS) Header() *RR_Header { return &rr.Hdr }
|
2015-10-07 14:33:08 +11:00
|
|
|
func (rr *KEY) 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 *L64) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *LOC) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *LP) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *MB) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *MD) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *MF) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *MG) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *MINFO) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *MR) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *MX) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *NAPTR) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *NID) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *NIMLOC) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *NINFO) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *NS) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *NSAPPTR) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *NSEC) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *NSEC3) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *NSEC3PARAM) Header() *RR_Header { return &rr.Hdr }
|
2018-12-30 20:45:18 +11:00
|
|
|
func (rr *NULL) Header() *RR_Header { return &rr.Hdr }
|
2015-10-07 14:33:08 +11:00
|
|
|
func (rr *OPENPGPKEY) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *OPT) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *PTR) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *PX) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *RFC3597) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *RKEY) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *RP) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *RRSIG) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *RT) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *SIG) Header() *RR_Header { return &rr.Hdr }
|
2016-10-18 04:09:52 +11:00
|
|
|
func (rr *SMIMEA) Header() *RR_Header { return &rr.Hdr }
|
2015-10-07 14:33:08 +11:00
|
|
|
func (rr *SOA) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *SPF) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *SRV) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *SSHFP) Header() *RR_Header { return &rr.Hdr }
|
Implement SVCB (#1067)
* Implement SVCB
* Fix serialization and deserialization of double quotes
* More effort (?)
4 months old commit
* DEBUG
* _
* Presentation format serialization/deserialization
* _
Remove generated
* Progress on presentation format parse & write
* _
* Finish parsing presentation format
* Regenerate
* Pack unpack
* Move to svcb.go
Scan_rr.go and types.go should be untouched now
* :bug:
Thanks ghedo
* Definitions
* TypeHTTPSSVC
* Generated
and isDuplicate
* Goodbye lenient functions
Now private key=value pairs have to be defined as structs too. They are no longer automatically named as KeyNNNNN
* Encode/decode
* Experimental svc
* Read method
* Implement some of the methods, use trick...
to report where the error is while reading it. This should be applied to EDNS too. Todo: Find if case can only contain e := new(SVC_ALPN) and rest moved out
Also fix two compile errors
* Add SVC_LOCAL methods, reorder, remove alpn value, bugs
* Errors
* Alpn, make it build
* Correct testsuite
* Fully implement parser
Change from keeping a state variable to reading in one iteration until the key=value pair is fully consumed
* Simplify and document
EDNS should be simplified too
* Attempt to fix fuzzer
And Alpn bug
* A bug and change type values to match @ghedo's implementation
* IP bug
Also there are two ip duplicating patterns, one with copy, one with append. Maybe change it to be consistent.
* Check for strictly increasing keys as required
* Don't panic on invalid alpn
* Redundant check, don't modify original array
* Size calculation
* Fix the fuzzer, match the style
* 65535 is reserved too, don't delay errors
* Check keyNNN, check for aliasform having values
* IPvNHint is an array
* Fix ipvNHint
* Rename everything
* Unrecognized keys according to the updated specification
* Skip zero-length structs in generators. Fix CI
* Doc cleanup
* Off by one
* Add parse tests
* Check if private key doesn't collide with known key, invalid tests
* Disallow IPv4 as IPv6. More tests.
Related #1107
* Style fixes
* More consistency, more tests
* :bug: Deep copy as in the documentation
a := make([]net.IP, 1)
a[0] = net.ParseIP("1.1.1.1").To4()
b := append(make([]net.IP, 0, 1), a...)
b[0] = net.ParseIP("3.1.1.1").To4()
fmt.Println(a[0][0])
* Make tests readable
* Move valid parse tests to different file
* :bug: One of previous commits not fully committed
* Test binary single value encoding/decoding and full encode/decode
* Add worst-case grows to builders, :bug: Wrong visible character range, redundant tests
* Testing improvements
And don't convert to IPv4 twice
* Doc update only
* Document worst case allocations
and ipv6 can be at most of length 39, not 40
* Redundant IP copy, consistent IPv6 behavior, fix deep copy
* isDuplicate for SVCB
* Optimizations
* echoconfig
* Svc => SVCB
* Fix CI
* Regenerate after REBASE (2)
Rebased twice on 15th and 20th May
* Rename svc, use escapeByte.
* Fix parsing whitespaces between quotes, rename ECHOHOConfig
* resolve
Remove svcbFieldLen
Use reverseInt
Uppercase SVCB
Rename key_value
"invalid" => bad
Alpn comments
> 65535 check
Unneeded slices
* a little more
read => parse
IP array meaning
Force pushed because forgot to change read in svcb_test.go
* HTTPSSVC -> HTTPS
* Use new values
* mandatory code
https://github.com/MikeBishop/dns-alt-svc/pull/205
* Resolve comments
Rename svcb-pairs
Remove SVCB_PRIVATE ranges
Comment on SVCB_KEY65535
ParseError return l.token
rename svcbKeyToString and svcbStringToKey
privatize SVCBKeyToString, SVCBStringToKey
* Refactor 1
Rename sorted, originalPairs
Use append instead of copy
Use svcb_RESERVED instead of 65535, with it now being private
"type SVCBKey uint16"
* Refactor 2
svcbKeyToString as method
svcbStringToKey updated after key 0
:bug: mandatory has missing key
Rename str
idx < 0
* Refactor 3
Use l.token as z
var key, value string
Comment wrap
0:
Sentences with '.'
keyValue => kv
* Refactor 4
* Refactor 5
len() int
* Refactor 6
* Refactor 7
* Test remove parsing
* Error messages
* Rewrite two estimate comments
* parse shouldn't modify original array :bug:
* Remove two unneeded comments
* Address review comments
Push 2 because can't build fuzzer python
Push 3 to try again
* Simplify argument duplication as per tmthrgd's suggestion
And add the relevant test
Force push edit: Make sorting code fit into one line
* Rewrite ECHConfig and address the review
* Remove the optional tab
* Add To4() Check
* More cleanup and fix mandatory not sorting bug
2020-10-11 18:09:36 +11:00
|
|
|
func (rr *SVCB) Header() *RR_Header { return &rr.Hdr }
|
2015-10-07 14:33:08 +11:00
|
|
|
func (rr *TA) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *TALINK) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *TKEY) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *TLSA) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *TSIG) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *TXT) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *UID) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *UINFO) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *URI) Header() *RR_Header { return &rr.Hdr }
|
|
|
|
func (rr *X25) Header() *RR_Header { return &rr.Hdr }
|
2021-02-27 02:35:05 +11:00
|
|
|
func (rr *ZONEMD) Header() *RR_Header { return &rr.Hdr }
|
2015-10-07 14:33:08 +11:00
|
|
|
|
|
|
|
// len() functions
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *A) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2019-03-29 08:53:54 +11:00
|
|
|
if len(rr.A) != 0 {
|
|
|
|
l += net.IPv4len
|
|
|
|
}
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *AAAA) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2019-03-29 08:53:54 +11:00
|
|
|
if len(rr.AAAA) != 0 {
|
|
|
|
l += net.IPv6len
|
|
|
|
}
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *AFSDB) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Subtype
|
2018-11-30 10:33:41 +11:00
|
|
|
l += domainNameLen(rr.Hostname, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *ANY) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2020-01-03 23:41:45 +11:00
|
|
|
func (rr *APL) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
for _, x := range rr.Prefixes {
|
|
|
|
l += x.len()
|
|
|
|
}
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *AVC) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2017-03-30 07:17:13 +11:00
|
|
|
for _, x := range rr.Txt {
|
|
|
|
l += len(x) + 1
|
|
|
|
}
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *CAA) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2017-02-16 07:40:16 +11:00
|
|
|
l++ // Flag
|
2015-10-07 14:33:08 +11:00
|
|
|
l += len(rr.Tag) + 1
|
|
|
|
l += len(rr.Value)
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *CERT) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Type
|
|
|
|
l += 2 // KeyTag
|
2017-02-16 07:40:16 +11:00
|
|
|
l++ // Algorithm
|
2015-10-07 14:33:08 +11:00
|
|
|
l += base64.StdEncoding.DecodedLen(len(rr.Certificate))
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *CNAME) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Target, off+l, compression, true)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *DHCID) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += base64.StdEncoding.DecodedLen(len(rr.Digest))
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *DNAME) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Target, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *DNSKEY) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Flags
|
2017-02-16 07:40:16 +11:00
|
|
|
l++ // Protocol
|
|
|
|
l++ // Algorithm
|
2015-10-07 14:33:08 +11:00
|
|
|
l += base64.StdEncoding.DecodedLen(len(rr.PublicKey))
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *DS) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // KeyTag
|
2017-02-16 07:40:16 +11:00
|
|
|
l++ // Algorithm
|
|
|
|
l++ // DigestType
|
2019-04-30 18:14:07 +10:00
|
|
|
l += len(rr.Digest) / 2
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *EID) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2019-04-30 18:14:07 +10:00
|
|
|
l += len(rr.Endpoint) / 2
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *EUI48) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 6 // Address
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *EUI64) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 8 // Address
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *GID) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 4 // Gid
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *GPOS) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += len(rr.Longitude) + 1
|
|
|
|
l += len(rr.Latitude) + 1
|
|
|
|
l += len(rr.Altitude) + 1
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *HINFO) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += len(rr.Cpu) + 1
|
|
|
|
l += len(rr.Os) + 1
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *HIP) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2017-02-16 07:40:16 +11:00
|
|
|
l++ // HitLength
|
|
|
|
l++ // PublicKeyAlgorithm
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // PublicKeyLength
|
2017-12-07 08:41:53 +11:00
|
|
|
l += len(rr.Hit) / 2
|
2015-10-07 14:33:08 +11:00
|
|
|
l += base64.StdEncoding.DecodedLen(len(rr.PublicKey))
|
|
|
|
for _, x := range rr.RendezvousServers {
|
2018-11-30 10:33:41 +11:00
|
|
|
l += domainNameLen(x, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
}
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *KX) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Preference
|
2018-11-30 10:33:41 +11:00
|
|
|
l += domainNameLen(rr.Exchanger, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *L32) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2019-03-29 08:53:54 +11:00
|
|
|
l += 2 // Preference
|
|
|
|
if len(rr.Locator32) != 0 {
|
|
|
|
l += net.IPv4len
|
|
|
|
}
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *L64) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Preference
|
|
|
|
l += 8 // Locator64
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *LOC) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2017-02-16 07:40:16 +11:00
|
|
|
l++ // Version
|
|
|
|
l++ // Size
|
|
|
|
l++ // HorizPre
|
|
|
|
l++ // VertPre
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 4 // Latitude
|
|
|
|
l += 4 // Longitude
|
|
|
|
l += 4 // Altitude
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *LP) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Preference
|
2018-11-30 10:33:41 +11:00
|
|
|
l += domainNameLen(rr.Fqdn, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *MB) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Mb, off+l, compression, true)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *MD) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Md, off+l, compression, true)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *MF) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Mf, off+l, compression, true)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *MG) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Mg, off+l, compression, true)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *MINFO) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Rmail, off+l, compression, true)
|
|
|
|
l += domainNameLen(rr.Email, off+l, compression, true)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *MR) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Mr, off+l, compression, true)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *MX) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Preference
|
2018-11-30 10:33:41 +11:00
|
|
|
l += domainNameLen(rr.Mx, off+l, compression, true)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *NAPTR) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Order
|
|
|
|
l += 2 // Preference
|
|
|
|
l += len(rr.Flags) + 1
|
|
|
|
l += len(rr.Service) + 1
|
|
|
|
l += len(rr.Regexp) + 1
|
2018-11-30 10:33:41 +11:00
|
|
|
l += domainNameLen(rr.Replacement, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *NID) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Preference
|
|
|
|
l += 8 // NodeID
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *NIMLOC) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2019-04-30 18:14:07 +10:00
|
|
|
l += len(rr.Locator) / 2
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *NINFO) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
for _, x := range rr.ZSData {
|
|
|
|
l += len(x) + 1
|
|
|
|
}
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *NS) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Ns, off+l, compression, true)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *NSAPPTR) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Ptr, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *NSEC3PARAM) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2017-02-16 07:40:16 +11:00
|
|
|
l++ // Hash
|
|
|
|
l++ // Flags
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Iterations
|
2017-02-16 07:40:16 +11:00
|
|
|
l++ // SaltLength
|
2017-12-07 08:41:53 +11:00
|
|
|
l += len(rr.Salt) / 2
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-12-30 20:45:18 +11:00
|
|
|
func (rr *NULL) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2019-01-03 21:33:38 +11:00
|
|
|
l += len(rr.Data)
|
2018-12-30 20:45:18 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *OPENPGPKEY) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += base64.StdEncoding.DecodedLen(len(rr.PublicKey))
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *PTR) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Ptr, off+l, compression, true)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *PX) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Preference
|
2018-11-30 10:33:41 +11:00
|
|
|
l += domainNameLen(rr.Map822, off+l, compression, false)
|
|
|
|
l += domainNameLen(rr.Mapx400, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *RFC3597) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2019-04-30 18:14:07 +10:00
|
|
|
l += len(rr.Rdata) / 2
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *RKEY) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Flags
|
2017-02-16 07:40:16 +11:00
|
|
|
l++ // Protocol
|
|
|
|
l++ // Algorithm
|
2015-10-07 14:33:08 +11:00
|
|
|
l += base64.StdEncoding.DecodedLen(len(rr.PublicKey))
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *RP) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Mbox, off+l, compression, false)
|
|
|
|
l += domainNameLen(rr.Txt, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *RRSIG) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // TypeCovered
|
2017-02-16 07:40:16 +11:00
|
|
|
l++ // Algorithm
|
|
|
|
l++ // Labels
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 4 // OrigTtl
|
|
|
|
l += 4 // Expiration
|
|
|
|
l += 4 // Inception
|
|
|
|
l += 2 // KeyTag
|
2018-11-30 10:33:41 +11:00
|
|
|
l += domainNameLen(rr.SignerName, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += base64.StdEncoding.DecodedLen(len(rr.Signature))
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *RT) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Preference
|
2018-11-30 23:20:24 +11:00
|
|
|
l += domainNameLen(rr.Host, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *SMIMEA) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2017-02-16 07:40:16 +11:00
|
|
|
l++ // Usage
|
|
|
|
l++ // Selector
|
|
|
|
l++ // MatchingType
|
2019-04-30 18:14:07 +10:00
|
|
|
l += len(rr.Certificate) / 2
|
2016-10-18 04:09:52 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *SOA) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Ns, off+l, compression, true)
|
|
|
|
l += domainNameLen(rr.Mbox, off+l, compression, true)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 4 // Serial
|
|
|
|
l += 4 // Refresh
|
|
|
|
l += 4 // Retry
|
|
|
|
l += 4 // Expire
|
|
|
|
l += 4 // Minttl
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *SPF) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
for _, x := range rr.Txt {
|
|
|
|
l += len(x) + 1
|
|
|
|
}
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *SRV) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Priority
|
|
|
|
l += 2 // Weight
|
|
|
|
l += 2 // Port
|
2018-11-30 10:33:41 +11:00
|
|
|
l += domainNameLen(rr.Target, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *SSHFP) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2017-02-16 07:40:16 +11:00
|
|
|
l++ // Algorithm
|
|
|
|
l++ // Type
|
2019-04-30 18:14:07 +10:00
|
|
|
l += len(rr.FingerPrint) / 2
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
Implement SVCB (#1067)
* Implement SVCB
* Fix serialization and deserialization of double quotes
* More effort (?)
4 months old commit
* DEBUG
* _
* Presentation format serialization/deserialization
* _
Remove generated
* Progress on presentation format parse & write
* _
* Finish parsing presentation format
* Regenerate
* Pack unpack
* Move to svcb.go
Scan_rr.go and types.go should be untouched now
* :bug:
Thanks ghedo
* Definitions
* TypeHTTPSSVC
* Generated
and isDuplicate
* Goodbye lenient functions
Now private key=value pairs have to be defined as structs too. They are no longer automatically named as KeyNNNNN
* Encode/decode
* Experimental svc
* Read method
* Implement some of the methods, use trick...
to report where the error is while reading it. This should be applied to EDNS too. Todo: Find if case can only contain e := new(SVC_ALPN) and rest moved out
Also fix two compile errors
* Add SVC_LOCAL methods, reorder, remove alpn value, bugs
* Errors
* Alpn, make it build
* Correct testsuite
* Fully implement parser
Change from keeping a state variable to reading in one iteration until the key=value pair is fully consumed
* Simplify and document
EDNS should be simplified too
* Attempt to fix fuzzer
And Alpn bug
* A bug and change type values to match @ghedo's implementation
* IP bug
Also there are two ip duplicating patterns, one with copy, one with append. Maybe change it to be consistent.
* Check for strictly increasing keys as required
* Don't panic on invalid alpn
* Redundant check, don't modify original array
* Size calculation
* Fix the fuzzer, match the style
* 65535 is reserved too, don't delay errors
* Check keyNNN, check for aliasform having values
* IPvNHint is an array
* Fix ipvNHint
* Rename everything
* Unrecognized keys according to the updated specification
* Skip zero-length structs in generators. Fix CI
* Doc cleanup
* Off by one
* Add parse tests
* Check if private key doesn't collide with known key, invalid tests
* Disallow IPv4 as IPv6. More tests.
Related #1107
* Style fixes
* More consistency, more tests
* :bug: Deep copy as in the documentation
a := make([]net.IP, 1)
a[0] = net.ParseIP("1.1.1.1").To4()
b := append(make([]net.IP, 0, 1), a...)
b[0] = net.ParseIP("3.1.1.1").To4()
fmt.Println(a[0][0])
* Make tests readable
* Move valid parse tests to different file
* :bug: One of previous commits not fully committed
* Test binary single value encoding/decoding and full encode/decode
* Add worst-case grows to builders, :bug: Wrong visible character range, redundant tests
* Testing improvements
And don't convert to IPv4 twice
* Doc update only
* Document worst case allocations
and ipv6 can be at most of length 39, not 40
* Redundant IP copy, consistent IPv6 behavior, fix deep copy
* isDuplicate for SVCB
* Optimizations
* echoconfig
* Svc => SVCB
* Fix CI
* Regenerate after REBASE (2)
Rebased twice on 15th and 20th May
* Rename svc, use escapeByte.
* Fix parsing whitespaces between quotes, rename ECHOHOConfig
* resolve
Remove svcbFieldLen
Use reverseInt
Uppercase SVCB
Rename key_value
"invalid" => bad
Alpn comments
> 65535 check
Unneeded slices
* a little more
read => parse
IP array meaning
Force pushed because forgot to change read in svcb_test.go
* HTTPSSVC -> HTTPS
* Use new values
* mandatory code
https://github.com/MikeBishop/dns-alt-svc/pull/205
* Resolve comments
Rename svcb-pairs
Remove SVCB_PRIVATE ranges
Comment on SVCB_KEY65535
ParseError return l.token
rename svcbKeyToString and svcbStringToKey
privatize SVCBKeyToString, SVCBStringToKey
* Refactor 1
Rename sorted, originalPairs
Use append instead of copy
Use svcb_RESERVED instead of 65535, with it now being private
"type SVCBKey uint16"
* Refactor 2
svcbKeyToString as method
svcbStringToKey updated after key 0
:bug: mandatory has missing key
Rename str
idx < 0
* Refactor 3
Use l.token as z
var key, value string
Comment wrap
0:
Sentences with '.'
keyValue => kv
* Refactor 4
* Refactor 5
len() int
* Refactor 6
* Refactor 7
* Test remove parsing
* Error messages
* Rewrite two estimate comments
* parse shouldn't modify original array :bug:
* Remove two unneeded comments
* Address review comments
Push 2 because can't build fuzzer python
Push 3 to try again
* Simplify argument duplication as per tmthrgd's suggestion
And add the relevant test
Force push edit: Make sorting code fit into one line
* Rewrite ECHConfig and address the review
* Remove the optional tab
* Add To4() Check
* More cleanup and fix mandatory not sorting bug
2020-10-11 18:09:36 +11:00
|
|
|
func (rr *SVCB) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += 2 // Priority
|
|
|
|
l += domainNameLen(rr.Target, off+l, compression, false)
|
|
|
|
for _, x := range rr.Value {
|
|
|
|
l += 4 + int(x.len())
|
|
|
|
}
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *TA) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // KeyTag
|
2017-02-16 07:40:16 +11:00
|
|
|
l++ // Algorithm
|
|
|
|
l++ // DigestType
|
2019-04-30 18:14:07 +10:00
|
|
|
l += len(rr.Digest) / 2
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *TALINK) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.PreviousName, off+l, compression, false)
|
|
|
|
l += domainNameLen(rr.NextName, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *TKEY) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Algorithm, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 4 // Inception
|
|
|
|
l += 4 // Expiration
|
|
|
|
l += 2 // Mode
|
|
|
|
l += 2 // Error
|
|
|
|
l += 2 // KeySize
|
2017-12-07 08:41:53 +11:00
|
|
|
l += len(rr.Key) / 2
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // OtherLen
|
2017-12-07 08:41:53 +11:00
|
|
|
l += len(rr.OtherData) / 2
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *TLSA) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2017-02-16 07:40:16 +11:00
|
|
|
l++ // Usage
|
|
|
|
l++ // Selector
|
|
|
|
l++ // MatchingType
|
2019-04-30 18:14:07 +10:00
|
|
|
l += len(rr.Certificate) / 2
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *TSIG) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += domainNameLen(rr.Algorithm, off+l, compression, false)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 6 // TimeSigned
|
|
|
|
l += 2 // Fudge
|
|
|
|
l += 2 // MACSize
|
2017-12-07 08:41:53 +11:00
|
|
|
l += len(rr.MAC) / 2
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // OrigId
|
|
|
|
l += 2 // Error
|
|
|
|
l += 2 // OtherLen
|
2017-12-07 08:41:53 +11:00
|
|
|
l += len(rr.OtherData) / 2
|
2015-10-07 14:33:08 +11:00
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *TXT) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
for _, x := range rr.Txt {
|
|
|
|
l += len(x) + 1
|
|
|
|
}
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *UID) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 4 // Uid
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *UINFO) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += len(rr.Uinfo) + 1
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *URI) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += 2 // Priority
|
|
|
|
l += 2 // Weight
|
|
|
|
l += len(rr.Target)
|
|
|
|
return l
|
|
|
|
}
|
2018-11-30 10:33:41 +11:00
|
|
|
func (rr *X25) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
2015-10-07 14:33:08 +11:00
|
|
|
l += len(rr.PSDNAddress) + 1
|
|
|
|
return l
|
|
|
|
}
|
2021-02-27 02:35:05 +11:00
|
|
|
func (rr *ZONEMD) len(off int, compression map[string]struct{}) int {
|
|
|
|
l := rr.Hdr.len(off, compression)
|
|
|
|
l += 4 // Serial
|
|
|
|
l++ // Scheme
|
|
|
|
l++ // Hash
|
|
|
|
l += len(rr.Digest) / 2
|
|
|
|
return l
|
|
|
|
}
|
2015-10-07 15:06:31 +11:00
|
|
|
|
|
|
|
// copy() functions
|
|
|
|
func (rr *A) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &A{rr.Hdr, copyIP(rr.A)}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *AAAA) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &AAAA{rr.Hdr, copyIP(rr.AAAA)}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *AFSDB) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &AFSDB{rr.Hdr, rr.Subtype, rr.Hostname}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *ANY) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &ANY{rr.Hdr}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
2020-01-03 23:41:45 +11:00
|
|
|
func (rr *APL) copy() RR {
|
|
|
|
Prefixes := make([]APLPrefix, len(rr.Prefixes))
|
2020-05-18 22:54:09 +10:00
|
|
|
for i, e := range rr.Prefixes {
|
|
|
|
Prefixes[i] = e.copy()
|
2020-01-03 23:41:45 +11:00
|
|
|
}
|
|
|
|
return &APL{rr.Hdr, Prefixes}
|
|
|
|
}
|
2017-03-30 07:17:13 +11:00
|
|
|
func (rr *AVC) copy() RR {
|
|
|
|
Txt := make([]string, len(rr.Txt))
|
|
|
|
copy(Txt, rr.Txt)
|
2018-05-10 23:50:26 +10:00
|
|
|
return &AVC{rr.Hdr, Txt}
|
2017-03-30 07:17:13 +11:00
|
|
|
}
|
2015-10-07 15:06:31 +11:00
|
|
|
func (rr *CAA) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &CAA{rr.Hdr, rr.Flag, rr.Tag, rr.Value}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
2020-05-18 22:54:09 +10:00
|
|
|
func (rr *CDNSKEY) copy() RR {
|
|
|
|
return &CDNSKEY{*rr.DNSKEY.copy().(*DNSKEY)}
|
|
|
|
}
|
|
|
|
func (rr *CDS) copy() RR {
|
|
|
|
return &CDS{*rr.DS.copy().(*DS)}
|
|
|
|
}
|
2015-10-07 15:06:31 +11:00
|
|
|
func (rr *CERT) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &CERT{rr.Hdr, rr.Type, rr.KeyTag, rr.Algorithm, rr.Certificate}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *CNAME) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &CNAME{rr.Hdr, rr.Target}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
Implement CSYNC (#585)
Implement the CSYNC record.
Fixes #290
Long overdue, lets add this record. Similar in vain as NSEC/NSEC3, we
need to implement len() our selves. Presentation format parsing and
tests are done as well.
This is CoreDNS running with CSYNC support, `dig` doesn't support this
at the moment, so:
~~~
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40323
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;csync.example.org. IN TYPE62
;; ANSWER SECTION:
csync.example.org. 10 IN TYPE62 \# 12 000335240042000460000008
;; AUTHORITY SECTION:
example.org. 10 IN NS a.iana-servers.net.
example.org. 10 IN NS b.iana-servers.net.
~~~
2017-11-25 19:19:06 +11:00
|
|
|
func (rr *CSYNC) copy() RR {
|
|
|
|
TypeBitMap := make([]uint16, len(rr.TypeBitMap))
|
|
|
|
copy(TypeBitMap, rr.TypeBitMap)
|
2018-05-10 23:50:26 +10:00
|
|
|
return &CSYNC{rr.Hdr, rr.Serial, rr.Flags, TypeBitMap}
|
Implement CSYNC (#585)
Implement the CSYNC record.
Fixes #290
Long overdue, lets add this record. Similar in vain as NSEC/NSEC3, we
need to implement len() our selves. Presentation format parsing and
tests are done as well.
This is CoreDNS running with CSYNC support, `dig` doesn't support this
at the moment, so:
~~~
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40323
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;csync.example.org. IN TYPE62
;; ANSWER SECTION:
csync.example.org. 10 IN TYPE62 \# 12 000335240042000460000008
;; AUTHORITY SECTION:
example.org. 10 IN NS a.iana-servers.net.
example.org. 10 IN NS b.iana-servers.net.
~~~
2017-11-25 19:19:06 +11:00
|
|
|
}
|
2015-10-07 15:06:31 +11:00
|
|
|
func (rr *DHCID) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &DHCID{rr.Hdr, rr.Digest}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
2020-05-18 22:54:09 +10:00
|
|
|
func (rr *DLV) copy() RR {
|
|
|
|
return &DLV{*rr.DS.copy().(*DS)}
|
|
|
|
}
|
2015-10-07 15:06:31 +11:00
|
|
|
func (rr *DNAME) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &DNAME{rr.Hdr, rr.Target}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *DNSKEY) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &DNSKEY{rr.Hdr, rr.Flags, rr.Protocol, rr.Algorithm, rr.PublicKey}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *DS) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &DS{rr.Hdr, rr.KeyTag, rr.Algorithm, rr.DigestType, rr.Digest}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *EID) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &EID{rr.Hdr, rr.Endpoint}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *EUI48) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &EUI48{rr.Hdr, rr.Address}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *EUI64) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &EUI64{rr.Hdr, rr.Address}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *GID) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &GID{rr.Hdr, rr.Gid}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *GPOS) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &GPOS{rr.Hdr, rr.Longitude, rr.Latitude, rr.Altitude}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *HINFO) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &HINFO{rr.Hdr, rr.Cpu, rr.Os}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *HIP) copy() RR {
|
|
|
|
RendezvousServers := make([]string, len(rr.RendezvousServers))
|
|
|
|
copy(RendezvousServers, rr.RendezvousServers)
|
2018-05-10 23:50:26 +10:00
|
|
|
return &HIP{rr.Hdr, rr.HitLength, rr.PublicKeyAlgorithm, rr.PublicKeyLength, rr.Hit, rr.PublicKey, RendezvousServers}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
Implement SVCB (#1067)
* Implement SVCB
* Fix serialization and deserialization of double quotes
* More effort (?)
4 months old commit
* DEBUG
* _
* Presentation format serialization/deserialization
* _
Remove generated
* Progress on presentation format parse & write
* _
* Finish parsing presentation format
* Regenerate
* Pack unpack
* Move to svcb.go
Scan_rr.go and types.go should be untouched now
* :bug:
Thanks ghedo
* Definitions
* TypeHTTPSSVC
* Generated
and isDuplicate
* Goodbye lenient functions
Now private key=value pairs have to be defined as structs too. They are no longer automatically named as KeyNNNNN
* Encode/decode
* Experimental svc
* Read method
* Implement some of the methods, use trick...
to report where the error is while reading it. This should be applied to EDNS too. Todo: Find if case can only contain e := new(SVC_ALPN) and rest moved out
Also fix two compile errors
* Add SVC_LOCAL methods, reorder, remove alpn value, bugs
* Errors
* Alpn, make it build
* Correct testsuite
* Fully implement parser
Change from keeping a state variable to reading in one iteration until the key=value pair is fully consumed
* Simplify and document
EDNS should be simplified too
* Attempt to fix fuzzer
And Alpn bug
* A bug and change type values to match @ghedo's implementation
* IP bug
Also there are two ip duplicating patterns, one with copy, one with append. Maybe change it to be consistent.
* Check for strictly increasing keys as required
* Don't panic on invalid alpn
* Redundant check, don't modify original array
* Size calculation
* Fix the fuzzer, match the style
* 65535 is reserved too, don't delay errors
* Check keyNNN, check for aliasform having values
* IPvNHint is an array
* Fix ipvNHint
* Rename everything
* Unrecognized keys according to the updated specification
* Skip zero-length structs in generators. Fix CI
* Doc cleanup
* Off by one
* Add parse tests
* Check if private key doesn't collide with known key, invalid tests
* Disallow IPv4 as IPv6. More tests.
Related #1107
* Style fixes
* More consistency, more tests
* :bug: Deep copy as in the documentation
a := make([]net.IP, 1)
a[0] = net.ParseIP("1.1.1.1").To4()
b := append(make([]net.IP, 0, 1), a...)
b[0] = net.ParseIP("3.1.1.1").To4()
fmt.Println(a[0][0])
* Make tests readable
* Move valid parse tests to different file
* :bug: One of previous commits not fully committed
* Test binary single value encoding/decoding and full encode/decode
* Add worst-case grows to builders, :bug: Wrong visible character range, redundant tests
* Testing improvements
And don't convert to IPv4 twice
* Doc update only
* Document worst case allocations
and ipv6 can be at most of length 39, not 40
* Redundant IP copy, consistent IPv6 behavior, fix deep copy
* isDuplicate for SVCB
* Optimizations
* echoconfig
* Svc => SVCB
* Fix CI
* Regenerate after REBASE (2)
Rebased twice on 15th and 20th May
* Rename svc, use escapeByte.
* Fix parsing whitespaces between quotes, rename ECHOHOConfig
* resolve
Remove svcbFieldLen
Use reverseInt
Uppercase SVCB
Rename key_value
"invalid" => bad
Alpn comments
> 65535 check
Unneeded slices
* a little more
read => parse
IP array meaning
Force pushed because forgot to change read in svcb_test.go
* HTTPSSVC -> HTTPS
* Use new values
* mandatory code
https://github.com/MikeBishop/dns-alt-svc/pull/205
* Resolve comments
Rename svcb-pairs
Remove SVCB_PRIVATE ranges
Comment on SVCB_KEY65535
ParseError return l.token
rename svcbKeyToString and svcbStringToKey
privatize SVCBKeyToString, SVCBStringToKey
* Refactor 1
Rename sorted, originalPairs
Use append instead of copy
Use svcb_RESERVED instead of 65535, with it now being private
"type SVCBKey uint16"
* Refactor 2
svcbKeyToString as method
svcbStringToKey updated after key 0
:bug: mandatory has missing key
Rename str
idx < 0
* Refactor 3
Use l.token as z
var key, value string
Comment wrap
0:
Sentences with '.'
keyValue => kv
* Refactor 4
* Refactor 5
len() int
* Refactor 6
* Refactor 7
* Test remove parsing
* Error messages
* Rewrite two estimate comments
* parse shouldn't modify original array :bug:
* Remove two unneeded comments
* Address review comments
Push 2 because can't build fuzzer python
Push 3 to try again
* Simplify argument duplication as per tmthrgd's suggestion
And add the relevant test
Force push edit: Make sorting code fit into one line
* Rewrite ECHConfig and address the review
* Remove the optional tab
* Add To4() Check
* More cleanup and fix mandatory not sorting bug
2020-10-11 18:09:36 +11:00
|
|
|
func (rr *HTTPS) copy() RR {
|
|
|
|
return &HTTPS{*rr.SVCB.copy().(*SVCB)}
|
|
|
|
}
|
2020-05-18 22:54:09 +10:00
|
|
|
func (rr *KEY) copy() RR {
|
|
|
|
return &KEY{*rr.DNSKEY.copy().(*DNSKEY)}
|
|
|
|
}
|
2015-10-07 15:06:31 +11:00
|
|
|
func (rr *KX) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &KX{rr.Hdr, rr.Preference, rr.Exchanger}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *L32) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &L32{rr.Hdr, rr.Preference, copyIP(rr.Locator32)}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *L64) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &L64{rr.Hdr, rr.Preference, rr.Locator64}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *LOC) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &LOC{rr.Hdr, rr.Version, rr.Size, rr.HorizPre, rr.VertPre, rr.Latitude, rr.Longitude, rr.Altitude}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *LP) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &LP{rr.Hdr, rr.Preference, rr.Fqdn}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *MB) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &MB{rr.Hdr, rr.Mb}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *MD) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &MD{rr.Hdr, rr.Md}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *MF) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &MF{rr.Hdr, rr.Mf}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *MG) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &MG{rr.Hdr, rr.Mg}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *MINFO) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &MINFO{rr.Hdr, rr.Rmail, rr.Email}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *MR) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &MR{rr.Hdr, rr.Mr}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *MX) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &MX{rr.Hdr, rr.Preference, rr.Mx}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *NAPTR) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &NAPTR{rr.Hdr, rr.Order, rr.Preference, rr.Flags, rr.Service, rr.Regexp, rr.Replacement}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *NID) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &NID{rr.Hdr, rr.Preference, rr.NodeID}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *NIMLOC) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &NIMLOC{rr.Hdr, rr.Locator}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *NINFO) copy() RR {
|
|
|
|
ZSData := make([]string, len(rr.ZSData))
|
|
|
|
copy(ZSData, rr.ZSData)
|
2018-05-10 23:50:26 +10:00
|
|
|
return &NINFO{rr.Hdr, ZSData}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *NS) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &NS{rr.Hdr, rr.Ns}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *NSAPPTR) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &NSAPPTR{rr.Hdr, rr.Ptr}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *NSEC) copy() RR {
|
|
|
|
TypeBitMap := make([]uint16, len(rr.TypeBitMap))
|
|
|
|
copy(TypeBitMap, rr.TypeBitMap)
|
2018-05-10 23:50:26 +10:00
|
|
|
return &NSEC{rr.Hdr, rr.NextDomain, TypeBitMap}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *NSEC3) copy() RR {
|
|
|
|
TypeBitMap := make([]uint16, len(rr.TypeBitMap))
|
|
|
|
copy(TypeBitMap, rr.TypeBitMap)
|
2018-05-10 23:50:26 +10:00
|
|
|
return &NSEC3{rr.Hdr, rr.Hash, rr.Flags, rr.Iterations, rr.SaltLength, rr.Salt, rr.HashLength, rr.NextDomain, TypeBitMap}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *NSEC3PARAM) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &NSEC3PARAM{rr.Hdr, rr.Hash, rr.Flags, rr.Iterations, rr.SaltLength, rr.Salt}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
2018-12-30 20:45:18 +11:00
|
|
|
func (rr *NULL) copy() RR {
|
2019-01-03 21:33:38 +11:00
|
|
|
return &NULL{rr.Hdr, rr.Data}
|
2018-12-30 20:45:18 +11:00
|
|
|
}
|
2015-10-07 15:06:31 +11:00
|
|
|
func (rr *OPENPGPKEY) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &OPENPGPKEY{rr.Hdr, rr.PublicKey}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *OPT) copy() RR {
|
|
|
|
Option := make([]EDNS0, len(rr.Option))
|
2019-01-31 05:11:33 +11:00
|
|
|
for i, e := range rr.Option {
|
2019-12-07 08:23:18 +11:00
|
|
|
Option[i] = e.copy()
|
2019-01-31 05:11:33 +11:00
|
|
|
}
|
2018-05-10 23:50:26 +10:00
|
|
|
return &OPT{rr.Hdr, Option}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *PTR) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &PTR{rr.Hdr, rr.Ptr}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *PX) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &PX{rr.Hdr, rr.Preference, rr.Map822, rr.Mapx400}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *RFC3597) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &RFC3597{rr.Hdr, rr.Rdata}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *RKEY) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &RKEY{rr.Hdr, rr.Flags, rr.Protocol, rr.Algorithm, rr.PublicKey}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *RP) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &RP{rr.Hdr, rr.Mbox, rr.Txt}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *RRSIG) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &RRSIG{rr.Hdr, rr.TypeCovered, rr.Algorithm, rr.Labels, rr.OrigTtl, rr.Expiration, rr.Inception, rr.KeyTag, rr.SignerName, rr.Signature}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *RT) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &RT{rr.Hdr, rr.Preference, rr.Host}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
2020-05-18 22:54:09 +10:00
|
|
|
func (rr *SIG) copy() RR {
|
|
|
|
return &SIG{*rr.RRSIG.copy().(*RRSIG)}
|
|
|
|
}
|
2016-10-18 04:09:52 +11:00
|
|
|
func (rr *SMIMEA) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &SMIMEA{rr.Hdr, rr.Usage, rr.Selector, rr.MatchingType, rr.Certificate}
|
2016-10-18 04:09:52 +11:00
|
|
|
}
|
2015-10-07 15:06:31 +11:00
|
|
|
func (rr *SOA) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &SOA{rr.Hdr, rr.Ns, rr.Mbox, rr.Serial, rr.Refresh, rr.Retry, rr.Expire, rr.Minttl}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *SPF) copy() RR {
|
|
|
|
Txt := make([]string, len(rr.Txt))
|
|
|
|
copy(Txt, rr.Txt)
|
2018-05-10 23:50:26 +10:00
|
|
|
return &SPF{rr.Hdr, Txt}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *SRV) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &SRV{rr.Hdr, rr.Priority, rr.Weight, rr.Port, rr.Target}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *SSHFP) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &SSHFP{rr.Hdr, rr.Algorithm, rr.Type, rr.FingerPrint}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
Implement SVCB (#1067)
* Implement SVCB
* Fix serialization and deserialization of double quotes
* More effort (?)
4 months old commit
* DEBUG
* _
* Presentation format serialization/deserialization
* _
Remove generated
* Progress on presentation format parse & write
* _
* Finish parsing presentation format
* Regenerate
* Pack unpack
* Move to svcb.go
Scan_rr.go and types.go should be untouched now
* :bug:
Thanks ghedo
* Definitions
* TypeHTTPSSVC
* Generated
and isDuplicate
* Goodbye lenient functions
Now private key=value pairs have to be defined as structs too. They are no longer automatically named as KeyNNNNN
* Encode/decode
* Experimental svc
* Read method
* Implement some of the methods, use trick...
to report where the error is while reading it. This should be applied to EDNS too. Todo: Find if case can only contain e := new(SVC_ALPN) and rest moved out
Also fix two compile errors
* Add SVC_LOCAL methods, reorder, remove alpn value, bugs
* Errors
* Alpn, make it build
* Correct testsuite
* Fully implement parser
Change from keeping a state variable to reading in one iteration until the key=value pair is fully consumed
* Simplify and document
EDNS should be simplified too
* Attempt to fix fuzzer
And Alpn bug
* A bug and change type values to match @ghedo's implementation
* IP bug
Also there are two ip duplicating patterns, one with copy, one with append. Maybe change it to be consistent.
* Check for strictly increasing keys as required
* Don't panic on invalid alpn
* Redundant check, don't modify original array
* Size calculation
* Fix the fuzzer, match the style
* 65535 is reserved too, don't delay errors
* Check keyNNN, check for aliasform having values
* IPvNHint is an array
* Fix ipvNHint
* Rename everything
* Unrecognized keys according to the updated specification
* Skip zero-length structs in generators. Fix CI
* Doc cleanup
* Off by one
* Add parse tests
* Check if private key doesn't collide with known key, invalid tests
* Disallow IPv4 as IPv6. More tests.
Related #1107
* Style fixes
* More consistency, more tests
* :bug: Deep copy as in the documentation
a := make([]net.IP, 1)
a[0] = net.ParseIP("1.1.1.1").To4()
b := append(make([]net.IP, 0, 1), a...)
b[0] = net.ParseIP("3.1.1.1").To4()
fmt.Println(a[0][0])
* Make tests readable
* Move valid parse tests to different file
* :bug: One of previous commits not fully committed
* Test binary single value encoding/decoding and full encode/decode
* Add worst-case grows to builders, :bug: Wrong visible character range, redundant tests
* Testing improvements
And don't convert to IPv4 twice
* Doc update only
* Document worst case allocations
and ipv6 can be at most of length 39, not 40
* Redundant IP copy, consistent IPv6 behavior, fix deep copy
* isDuplicate for SVCB
* Optimizations
* echoconfig
* Svc => SVCB
* Fix CI
* Regenerate after REBASE (2)
Rebased twice on 15th and 20th May
* Rename svc, use escapeByte.
* Fix parsing whitespaces between quotes, rename ECHOHOConfig
* resolve
Remove svcbFieldLen
Use reverseInt
Uppercase SVCB
Rename key_value
"invalid" => bad
Alpn comments
> 65535 check
Unneeded slices
* a little more
read => parse
IP array meaning
Force pushed because forgot to change read in svcb_test.go
* HTTPSSVC -> HTTPS
* Use new values
* mandatory code
https://github.com/MikeBishop/dns-alt-svc/pull/205
* Resolve comments
Rename svcb-pairs
Remove SVCB_PRIVATE ranges
Comment on SVCB_KEY65535
ParseError return l.token
rename svcbKeyToString and svcbStringToKey
privatize SVCBKeyToString, SVCBStringToKey
* Refactor 1
Rename sorted, originalPairs
Use append instead of copy
Use svcb_RESERVED instead of 65535, with it now being private
"type SVCBKey uint16"
* Refactor 2
svcbKeyToString as method
svcbStringToKey updated after key 0
:bug: mandatory has missing key
Rename str
idx < 0
* Refactor 3
Use l.token as z
var key, value string
Comment wrap
0:
Sentences with '.'
keyValue => kv
* Refactor 4
* Refactor 5
len() int
* Refactor 6
* Refactor 7
* Test remove parsing
* Error messages
* Rewrite two estimate comments
* parse shouldn't modify original array :bug:
* Remove two unneeded comments
* Address review comments
Push 2 because can't build fuzzer python
Push 3 to try again
* Simplify argument duplication as per tmthrgd's suggestion
And add the relevant test
Force push edit: Make sorting code fit into one line
* Rewrite ECHConfig and address the review
* Remove the optional tab
* Add To4() Check
* More cleanup and fix mandatory not sorting bug
2020-10-11 18:09:36 +11:00
|
|
|
func (rr *SVCB) copy() RR {
|
|
|
|
Value := make([]SVCBKeyValue, len(rr.Value))
|
|
|
|
for i, e := range rr.Value {
|
|
|
|
Value[i] = e.copy()
|
|
|
|
}
|
|
|
|
return &SVCB{rr.Hdr, rr.Priority, rr.Target, Value}
|
|
|
|
}
|
2015-10-07 15:06:31 +11:00
|
|
|
func (rr *TA) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &TA{rr.Hdr, rr.KeyTag, rr.Algorithm, rr.DigestType, rr.Digest}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *TALINK) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &TALINK{rr.Hdr, rr.PreviousName, rr.NextName}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *TKEY) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &TKEY{rr.Hdr, rr.Algorithm, rr.Inception, rr.Expiration, rr.Mode, rr.Error, rr.KeySize, rr.Key, rr.OtherLen, rr.OtherData}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *TLSA) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &TLSA{rr.Hdr, rr.Usage, rr.Selector, rr.MatchingType, rr.Certificate}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *TSIG) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &TSIG{rr.Hdr, rr.Algorithm, rr.TimeSigned, rr.Fudge, rr.MACSize, rr.MAC, rr.OrigId, rr.Error, rr.OtherLen, rr.OtherData}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *TXT) copy() RR {
|
|
|
|
Txt := make([]string, len(rr.Txt))
|
|
|
|
copy(Txt, rr.Txt)
|
2018-05-10 23:50:26 +10:00
|
|
|
return &TXT{rr.Hdr, Txt}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *UID) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &UID{rr.Hdr, rr.Uid}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *UINFO) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &UINFO{rr.Hdr, rr.Uinfo}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *URI) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &URI{rr.Hdr, rr.Priority, rr.Weight, rr.Target}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
|
|
|
func (rr *X25) copy() RR {
|
2018-05-10 23:50:26 +10:00
|
|
|
return &X25{rr.Hdr, rr.PSDNAddress}
|
2015-10-07 15:06:31 +11:00
|
|
|
}
|
2021-02-27 02:35:05 +11:00
|
|
|
func (rr *ZONEMD) copy() RR {
|
|
|
|
return &ZONEMD{rr.Hdr, rr.Serial, rr.Scheme, rr.Hash, rr.Digest}
|
|
|
|
}
|