本文整理汇总了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)
}