- gofmt main.go to fix tab indentation in main() body - stats.go ComputeSummary: return nil when Answers and ByType are empty - dns/types.go: remove duplicate ParseQueryType (dead code) - formatter.go: log hook errors to stderr when Debug > 0; add Debug to Config - text.go referralID: remove redundant depth==0 branch - text.go writeServers: remove version lookup placeholder string Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
Copilot
multica-agent
parent
5a54834c5f
commit
8e7beacc22
@@ -314,8 +314,8 @@ func TestCNAMEChain(t *testing.T) {
|
||||
|
||||
func TestResponseClassificationString(t *testing.T) {
|
||||
tests := []struct {
|
||||
rc ResponseClassification
|
||||
want string
|
||||
rc ResponseClassification
|
||||
want string
|
||||
}{
|
||||
{ResponseAnswer, "answer"},
|
||||
{ResponseReferral, "referral"},
|
||||
@@ -344,10 +344,10 @@ func TestFormatRecord(t *testing.T) {
|
||||
t.Run("A record", func(t *testing.T) {
|
||||
rr := &dns.A{
|
||||
Hdr: dns.RR_Header{
|
||||
Name: "example.com.",
|
||||
Name: "example.com.",
|
||||
Rrtype: dns.TypeA,
|
||||
Class: dns.ClassINET,
|
||||
Ttl: 300,
|
||||
Class: dns.ClassINET,
|
||||
Ttl: 300,
|
||||
},
|
||||
A: MustParseIP("93.184.216.34"),
|
||||
}
|
||||
|
||||
@@ -328,4 +328,3 @@ func TestQueryNoTCPFallbackWhenDisabled(t *testing.T) {
|
||||
t.Error("expected truncated response to be returned as-is")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package dns
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
@@ -40,32 +37,6 @@ func QNameType(qtype uint16) string {
|
||||
return dns.TypeToString[qtype]
|
||||
}
|
||||
|
||||
func ParseQueryType(s string) (uint16, error) {
|
||||
s = strings.ToUpper(strings.TrimSpace(s))
|
||||
switch s {
|
||||
case "A":
|
||||
return TypeA, nil
|
||||
case "AAAA":
|
||||
return TypeAAAA, nil
|
||||
case "NS":
|
||||
return TypeNS, nil
|
||||
case "CNAME":
|
||||
return TypeCNAME, nil
|
||||
case "MX":
|
||||
return TypeMX, nil
|
||||
case "TXT":
|
||||
return TypeTXT, nil
|
||||
case "SOA":
|
||||
return TypeSOA, nil
|
||||
case "PTR":
|
||||
return TypePTR, nil
|
||||
case "ANY":
|
||||
return TypeANY, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("invalid query type: %s", s)
|
||||
}
|
||||
}
|
||||
|
||||
func DefaultEDNS0UDPSize() int {
|
||||
return 2048
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user