本文整理匯總了Golang中github.com/abh/geodns/Godeps/_workspace/src/github.com/miekg/dns.EDNS0_SUBNET.Family方法的典型用法代碼示例。如果您正苦於以下問題:Golang EDNS0_SUBNET.Family方法的具體用法?Golang EDNS0_SUBNET.Family怎麽用?Golang EDNS0_SUBNET.Family使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/abh/geodns/Godeps/_workspace/src/github.com/miekg/dns.EDNS0_SUBNET
的用法示例。
在下文中一共展示了EDNS0_SUBNET.Family方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: exchangeSubnet
func exchangeSubnet(c *C, name string, dnstype uint16, ip string) *dns.Msg {
msg := new(dns.Msg)
msg.SetQuestion(name, dnstype)
o := new(dns.OPT)
o.Hdr.Name = "."
o.Hdr.Rrtype = dns.TypeOPT
e := new(dns.EDNS0_SUBNET)
e.Code = dns.EDNS0SUBNET
e.SourceScope = 0
e.Address = net.ParseIP(ip)
e.Family = 1 // IP4
e.SourceNetmask = net.IPv4len * 8
o.Option = append(o.Option, e)
msg.Extra = append(msg.Extra, o)
c.Log("msg", msg)
return dorequest(c, msg)
}