Add text and JSON formatters with real-time progress via traverser hooks, summary statistics, and CLI integration for --show-* and --json flags. Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
multica-agent
parent
876542b2de
commit
5a54834c5f
+32
-1
@@ -1,6 +1,11 @@
|
||||
package dns
|
||||
|
||||
import "github.com/miekg/dns"
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
const (
|
||||
TypeA uint16 = dns.TypeA
|
||||
@@ -35,6 +40,32 @@ 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