Documentation ¶
Index ¶
- func FormatError(w http.ResponseWriter, comment string, errcode int)
- func IsGlobalIP(ip net.IP) bool
- func PrepareReply(req *dns.Msg) *dns.Msg
- func Unmarshal(msg *dns.Msg, resp *Response, udpSize uint16, ednsClientNetmask uint8) *dns.Msg
- type Question
- type QuestionList
- type RR
- type Response
- type UnmarshalError
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatError ¶
func FormatError(w http.ResponseWriter, comment string, errcode int)
func IsGlobalIP ¶
Example ¶
fmt.Println(IsGlobalIP(net.ParseIP("127.0.0.1"))) fmt.Println(IsGlobalIP(net.IP{192, 168, 1, 1})) fmt.Println(IsGlobalIP(net.ParseIP("8.8.8.8"))) fmt.Println(IsGlobalIP(net.IP{8, 8, 4, 4})) fmt.Println(IsGlobalIP(net.ParseIP("::1"))) fmt.Println(IsGlobalIP(net.IP{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00})) fmt.Println(IsGlobalIP(net.ParseIP("2001:4860:4860::8888"))) fmt.Println(IsGlobalIP(net.IP{0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x44})) fmt.Println(IsGlobalIP(net.ParseIP("::ffff:127.0.0.1"))) fmt.Println(IsGlobalIP(net.IP{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 192, 168, 1, 1})) fmt.Println(IsGlobalIP(net.ParseIP("::ffff:808:808"))) fmt.Println(IsGlobalIP(net.IP{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 8, 8, 4, 4}))
Output: false false true true false false true true false false true true
Types ¶
type QuestionList ¶
type QuestionList []Question
func (*QuestionList) UnmarshalJSON ¶
func (ql *QuestionList) UnmarshalJSON(b []byte) error
type Response ¶
type Response struct { // Standard DNS response code (32 bit integer) Status uint32 `json:"Status"` // Whether the response is truncated TC bool `json:"TC"` // Recursion desired RD bool `json:"RD"` // Recursion available RA bool `json:"RA"` // Whether all response data was validated with DNSSEC // FIXME: We don't have DNSSEC yet! This bit is not reliable! AD bool `json:"AD"` // Whether the client asked to disable DNSSEC CD bool `json:"CD"` Question QuestionList `json:"Question"` Answer []RR `json:"Answer,omitempty"` Authority []RR `json:"Authority,omitempty"` Additional []RR `json:"Additional,omitempty"` Comment string `json:"Comment,omitempty"` EdnsClientSubnet string `json:"edns_client_subnet,omitempty"` // Least time-to-live HaveTTL bool `json:"-"` LeastTTL uint32 `json:"-"` EarliestExpires time.Time `json:"-"` }
type UnmarshalError ¶
type UnmarshalError struct {
// contains filtered or unexported fields
}
func (UnmarshalError) Error ¶
func (e UnmarshalError) Error() string
Click to show internal directories.
Click to hide internal directories.