diff options
| author | Shulhan <ms@kilabit.info> | 2024-04-13 15:36:44 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-04-13 15:36:44 +0700 |
| commit | 45775b26680a8ad06e5e0a334301fa4b5b91af2c (patch) | |
| tree | dbca0d5cddd635f4d22ae560e2cdba896ba69b3f | |
| parent | 8e0c347f8a2fcf7e0f754b84fcaa3a7049e20af5 (diff) | |
| download | pakakeh.go-45775b26680a8ad06e5e0a334301fa4b5b91af2c.tar.xz | |
lib/dns: make server accept record type ANY
The record type ANY contains multiple A, AAAA or any known resource
records that we already support.
| -rw-r--r-- | lib/dns/record_type.go | 6 | ||||
| -rw-r--r-- | lib/dns/record_type_test.go | 2 | ||||
| -rw-r--r-- | lib/dns/server.go | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/dns/record_type.go b/lib/dns/record_type.go index 569b0b33..dae8232b 100644 --- a/lib/dns/record_type.go +++ b/lib/dns/record_type.go @@ -39,7 +39,7 @@ const ( RecordTypeAXFR RecordType = 252 // A request for a transfer of an entire zone RecordTypeMAILB RecordType = 253 // A request for mailbox-related records (MB, MG or MR) RecordTypeMAILA RecordType = 254 // A request for mail agent RRs (Obsolete - see MX) - RecordTypeALL RecordType = 255 // A request for all records + RecordTypeANY RecordType = 255 // A request for all records. ) // RecordTypes contains a mapping between string representation of DNS record @@ -47,7 +47,7 @@ const ( var RecordTypes = map[string]RecordType{ "A": RecordTypeA, "AAAA": RecordTypeAAAA, - "ALL": RecordTypeALL, + `ANY`: RecordTypeANY, "AXFR": RecordTypeAXFR, "CNAME": RecordTypeCNAME, "HINFO": RecordTypeHINFO, @@ -77,7 +77,7 @@ var RecordTypes = map[string]RecordType{ var RecordTypeNames = map[RecordType]string{ RecordTypeA: "A", RecordTypeAAAA: "AAAA", - RecordTypeALL: "ALL", + RecordTypeANY: `ANY`, RecordTypeAXFR: "AXFR", RecordTypeCNAME: "CNAME", RecordTypeHINFO: "HINFO", diff --git a/lib/dns/record_type_test.go b/lib/dns/record_type_test.go index 1b2796e4..6b491cab 100644 --- a/lib/dns/record_type_test.go +++ b/lib/dns/record_type_test.go @@ -14,5 +14,5 @@ func TestRecordType(t *testing.T) { test.Assert(t, "RecordTypeA", RecordTypeA, RecordType(1)) test.Assert(t, "RecordTypeTXT", RecordTypeTXT, RecordType(16)) test.Assert(t, "RecordTypeAXFR", RecordTypeAXFR, RecordType(252)) - test.Assert(t, "RecordTypeALL", RecordTypeALL, RecordType(255)) + test.Assert(t, `RecordTypeANY`, RecordTypeANY, RecordType(255)) } diff --git a/lib/dns/server.go b/lib/dns/server.go index ec5835f4..96c4f0fc 100644 --- a/lib/dns/server.go +++ b/lib/dns/server.go @@ -561,7 +561,7 @@ func (srv *Server) isImplemented(msg *Message) bool { } switch msg.Question.Type { case RecordTypeAAAA, RecordTypeSRV, RecordTypeOPT, RecordTypeAXFR, - RecordTypeMAILB, RecordTypeMAILA, + RecordTypeMAILB, RecordTypeMAILA, RecordTypeANY, RecordTypeSVCB, RecordTypeHTTPS: return true } |
