本文整理汇总了Golang中parser/dns.DNS类的典型用法代码示例。如果您正苦于以下问题:Golang DNS类的具体用法?Golang DNS怎么用?Golang DNS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DNS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: RD
func RD(d dns.DNS) {
fmt.Printf("RD: ")
if d.GetRD() {
fmt.Println("Recursion Desired")
} else {
fmt.Println("Recursion not Desired")
}
}
示例2: AA
func AA(d dns.DNS) {
fmt.Printf("AA: ")
if d.GetAA() {
fmt.Println("Authorative")
} else {
fmt.Println("Non authorative")
}
}
示例3: QNAME
func QNAME(d dns.DNS, num int) {
qname, err := d.GetQNAME(num)
if err != nil {
fmt.Println(err.Error(), "\n")
return
}
fmt.Println("QNAME: ", qname)
}
示例4: RA
func RA(d dns.DNS) {
fmt.Printf("RA: ")
if d.GetRA() {
fmt.Println("Recursion Available")
} else {
fmt.Println("Recursion not Available")
}
}
示例5: Z
func Z(d dns.DNS) {
fmt.Printf("Z: ")
if d.GetZ() == 0 {
fmt.Println("Reserved")
} else {
fmt.Printf("Should be 0 but is %d \n", d.GetZ())
}
}
示例6: QR
func QR(d dns.DNS) {
fmt.Printf("QR: ")
if d.GetQR() {
fmt.Println("1 Response")
} else {
fmt.Println("0 Query")
}
}
示例7: TC
func TC(d dns.DNS) {
fmt.Printf("TC: ")
if d.GetTC() {
fmt.Println("Truncated")
} else {
fmt.Println("Not truncated")
}
}
示例8: QTYPE
func QTYPE(d dns.DNS, num int) {
field, err := d.GetQTYPE(num)
if err != nil {
fmt.Println(err.Error(), "\n")
return
}
fmt.Printf("QTYPE: ")
switch field {
case 1:
fmt.Println("A")
case 2:
fmt.Println("NS")
case 3:
fmt.Println("MD")
case 4:
fmt.Println("MF")
case 5:
fmt.Println("CNAME")
case 6:
fmt.Println("SOA")
case 7:
fmt.Println("MB")
case 8:
fmt.Println("MG")
case 9:
fmt.Println("MR")
case 10:
fmt.Println("NULL")
case 11:
fmt.Println("WKS")
case 12:
fmt.Println("PTR")
case 13:
fmt.Println("HINFO")
case 14:
fmt.Println("MINFO")
case 15:
fmt.Println("MX")
case 16:
fmt.Println("TXT")
case 28:
fmt.Println("AAAA")
case 252:
fmt.Println("AXFR")
case 253:
fmt.Println("MAILB")
case 254:
fmt.Println("MAILA")
case 255:
fmt.Println("*")
default:
fmt.Printf("NOT VALID %d \n", field)
}
}
示例9: OPCODE
func OPCODE(d dns.DNS) {
fmt.Printf("OPCODE: ")
switch d.GetOPCODE() {
case 0:
fmt.Println("0 QUERY")
case 1:
fmt.Println("1 IQUERY")
default:
fmt.Println(">1 RESERVED")
}
}
示例10: RCODE
func RCODE(d dns.DNS) {
fmt.Printf("RCODE: ")
switch d.GetRCODE() {
case 0:
fmt.Println("0 No error condition")
case 1:
fmt.Println("1 Format error")
case 2:
fmt.Println("2 Server failure")
case 3:
if d.GetAA() {
fmt.Println("3 Name error")
} else {
fmt.Println("3 ERROR! Only meaningful if AA is set")
}
case 4:
fmt.Println("4 Not implemented")
case 5:
fmt.Println("5 Refused")
default:
fmt.Println(">5 Reserved for future use")
}
}
示例11: QCLASS
func QCLASS(d dns.DNS, num int) {
field, err := d.GetQCLASS(num)
if err != nil {
fmt.Println(err.Error(), "\n")
return
}
fmt.Printf("QCLASS: ")
switch field {
case 1:
fmt.Println("IN")
case 2:
fmt.Println("CS")
case 3:
fmt.Println("CH")
case 4:
fmt.Println("HS")
case 255:
fmt.Println("*")
default:
fmt.Printf("NOT VALID %d \n", field)
}
}
示例12: ARNAME
func ARNAME(d dns.DNS, num int, field string) {
var resString string
var ident string
resString = ""
switch field {
case "an":
resString, _ = d.GetANNAME(num)
ident = "ANNAME:"
case "ns":
resString, _ = d.GetNSNAME(num)
ident = "NSNAME:"
case "ar":
resString, _ = d.GetARNAME(num)
ident = "ARNAME:"
}
fmt.Println(ident, resString)
rdata, _ := d.GetANRDATA(num)
fmt.Println("RDATA", rdata)
}
示例13: QDCOUNT
func QDCOUNT(d dns.DNS) {
fmt.Println("QDCOUNT:", d.GetQDCOUNT())
}
示例14: ID
func ID(d dns.DNS) {
fmt.Println("ID:", d.GetID())
}
示例15: NSCOUNT
func NSCOUNT(d dns.DNS) {
fmt.Println("NSCOUNT:", d.GetNSCOUNT())
}