Documentation ¶
Index ¶
Constants ¶
View Source
const ( REC_DISERED = 1 << 8 REC_AVAILABLE = 1 << 7 REVERSE_DNS_IPV4_DOMAIN = ".in-addr.arpa" REVERSE_DNS_IPV6_DOMAIN = "ip6.arpa" A = 1 AAAA = 28 SOA = 6 PTR = 12 QCLASS = 1 RES_OK = 0 RES_FORMAT_ERROR = 1 RES_SERVER_FAILURE = 2 RES_NAME_ERROR = 3 RES_NOT_IMPLEMENTED = 4 RES_REFUSED = 5 MAX_LABEL_LENGTH = 63 MAX_RESPONSE_LENGTH = 512 )
Variables ¶
This section is empty.
Functions ¶
func GetResponse ¶
func ParseDNSResponse ¶
func ParseDNSResponse(response []byte, debug bool) (*DNSQuery, *DNSResponse)
Types ¶
type DNSHeader ¶
type DNSHeader struct { ID uint16 `json:"id"` // an unsigned 16 bit integer containing the transaction id generated by the software who made the request. Flags uint16 `json:"-"` // an unsigned 16 bit integer containing various service flags that are communicated between the DNS client and the DNS server. QDCount uint16 `json:"questions"` // an unsigned 16 bit integer specifying the number of entries in the question section. ANCount uint16 `json:"answers"` // an unsigned 16 bit integer specifying the number of resource records in the answer section. NSCount uint16 `json:"-"` // an unsigned 16 bit integer specifying the number of name server resource records in the authority records section. ARCount uint16 `json:"-"` // an unsigned 16 bit integer specifying the number of resource records in the additional records section. }
func NewDNSHeader ¶
func NewDNSHeader() *DNSHeader
type DNSQuestion ¶
type DNSQuestion struct { QuestionName []byte // Encoded domain using the RFC 1035 instructions QuestionType uint16 // QTYPE field of RFC 1035 QuestionClass uint16 // QCLASS field of RFC 1035, default = 1 }
func NewDNSQuestion ¶
func NewDNSQuestion(domain string, class uint16) *DNSQuestion
type DNSResource ¶
type DNSResource struct { Header *DNSResourceHeader Data []byte }
func NewDNSResource ¶
func NewDNSResource(header *DNSResourceHeader, data []byte) *DNSResource
type DNSResourceHeader ¶
type DNSResourceHeader struct { Name string `json:"domain"` Type uint16 `json:"type"` Class uint16 `json:"class"` TTL uint32 `json:"ttl"` Length uint16 `json:"length"` }
func NewDNSResourceHeader ¶
func NewDNSResourceHeader(name string, resourceType, class uint16, ttl uint32, length uint16) *DNSResourceHeader
type DNSResponse ¶
type DNSResponse struct { Header *DNSHeader Answers []*DNSResource }
func (*DNSResponse) ToJSON ¶
func (response *DNSResponse) ToJSON(writter io.Writer)
type DNSStringAnswer ¶
type DNSStringAnswer struct { Header *DNSResourceHeader `json:"metadata"` Data string `json:"resource"` }
func NewDNSStringAnswer ¶
func NewDNSStringAnswer(header *DNSResourceHeader, data string) *DNSStringAnswer
type DNSStringResponse ¶
type DNSStringResponse struct { Header *DNSHeader `json:"header"` Answers []*DNSStringAnswer `json:"answers"` }
func NewDNSStringResponse ¶
func NewDNSStringResponse(header *DNSHeader, answersLength int) *DNSStringResponse
Click to show internal directories.
Click to hide internal directories.