package
0.53.1
Repository: https://github.com/shulhan/share.git
Documentation: pkg.go.dev

# Functions

GetSystemHosts return path to system hosts file.
GetSystemNameServers return list of system name servers by reading resolv.conf formatted file in path.
LoadHostsDir load all of hosts formatted files inside a directory.
LoadZoneDir load DNS record from zone formatted files in directory "dir".
LookupPTR accept an IP address (either IPv4 or IPv6) and return a single answer as domain name on success or an error on failed.
NewClient create new DNS client using the name server URL.
NewDoHClient will create new DNS client with HTTP connection.
NewDoTClient will create new DNS client over TLS connection.
NewHostsFile create and store the host records in file defined by "path".
NewMessage create, initialize, and return new message.
NewMessageAddress create new DNS message for hostname that contains one or more A or AAAA addresses.
NewMessageFromRR create new message with one RR as an answer.
NewRDataSOA create and initialize the new SOA record using default values for Serial, Refresh, Retry, Expiry, and Minimum.
NewServer create and initialize DNS server.
NewTCPClient will create new DNS client with TCP network connection.
NewUDPClient will create new DNS client with UDP network connection.
NewUDPClientPool create pool for UDP connection using list of name servers.
NewZone create and initialize new zone.
ParseHostsFile parse the content of hosts file as packed DNS message.
ParseNameServers parse list of nameserver into UDP addresses.
ParseZone parse zone from raw bytes.
ParseZoneFile parse zone file.
RecordTypeFromAddress return RecordTypeA or RecordTypeAAAA if addr is valid IPv4 or IPv6 address, respectively, otherwise it will return 0.

# Constants

Log cache operations, including new record, updating records, and pruning record in caches.
Log low level DNS connection and packet, including request and response.
Log error on DNS level, in example EMPTY answer, ERR_NAME, ERR_NOT_IMPLEMENTED, ERR_REFUSED.
DefaultHTTPPort define default port for DNS over HTTPS.
DefaultPort define default DNS remote or listen port for UDP and TCP connection.
1 Hour.
1 Day.
1 Hour.
Default SOA record value.
DefaultTLSPort define default remote and listen port for DNS over TLS.
List of known hosts file by OS.
List of known hosts file by OS.
An inverse query (IQUERY), obsolete by RFC3425.
A standard query (QUERY).
A server status request (STATUS).
Format error - The name server was unable to interpret the query.
Name Error - Meaningful only for responses from an authoritative name server, this code signifies that the domain name referenced in the query does not exist.
Server failure - The name server was unable to process this query due to a problem with the name server.
Not Implemented - The name server does not support the requested kind of query.
No error condition.
Refused - The name server refuses to perform the specified operation for policy reasons.
Any class.
The CHAOS class.
Hesiod [Dyer 87].
The Internet.
Empty query class.
1 - A host address.
IPv6 address.
A request for all records.
A request for a transfer of an entire zone.
5 - The canonical name for an alias.
13 - Host information.
A request for mail agent RRs (Obsolete - see MX).
A request for mailbox-related records (MB, MG or MR).
7 - A mailbox domain name (EXPERIMENTAL).
3 - A mail destination (Obsolete - use MX).
4 - A mail forwarder (Obsolete - use MX).
8 - A mail group member (EXPERIMENTAL).
14 - Mailbox or mail list information.
9 - A mail rename domain name (EXPERIMENTAL).
15 - Mail exchange.
2 - An authoritative name server.
10 - A null RR (EXPERIMENTAL).
An OPT pseudo-RR (sometimes called a meta-RR).
12 - A domain name pointer.
6 - Marks the start of a zone of authority.
A SRV RR for locating service.
16 - Text strings.
11 - A well known service description.
Empty record type.

# Variables

List of error messages.
List of error messages.
List of error messages.
List of error messages.
List of error messages.
RecordClasses contains a mapping between string representation of record class to their numeric value, ordered by key alphabetically.
RecordClassName contains a mapping between the record class value and its string representation, ordered by key alphabetically.
RecordTypeNames contains mapping between record type and and their string representation, ordered alphabetically.
RecordTypes contains a mapping between string representation of DNS record type with their numeric value, ordered by key alphabetically.

# Structs

Answer maintain the record of DNS response for cache.
Caches of DNS answers.
DoHClient client for DNS over HTTPS.
DoTClient client for DNS over TLS.
HostsFile represent content of single hosts file.
Message represent a DNS message.
MessageHeader the header includes fields that specify which of the remaining sections are present, and also specify whether the message is a query or a response, a standard query or some other opcode, etc.
MessageQuestion contains the "question" in most queries.
RDataHINFO HINFO records are used to acquire general information about a host.
RDataMINFO define a resource record for type MINFO.
RDataMX MX records cause type A additional section processing for the host specified by EXCHANGE.
RDataOPT define format of RDATA for OPT.
RDataSOA contains the authority of zone.
RDataSRV define a resource record for type SRV.
RDataWKS The WKS record is used to describe the well known services supported by a particular protocol on a particular internet address.
ResourceRecord The answer, authority, and additional sections all share the same format: a variable number of resource records, where the number of records is specified in the corresponding count field in the header.
Server defines DNS server.
ServerOptions describes options for running a DNS server.
TCPClient for DNS with TCP connection and list of remote addresses.
UDPClient for DNS with UDP connection.
UDPClientPool contains a pool of UDP client connections.
Zone represent a group of domain names shared a single root domain.

# Interfaces

Client is interface that implement sending and receiving DNS message.

# Type aliases

OpCode define a custom type for DNS header operation code.
RecordClass represent the class for resource record.
RecordType A two octet code which specifies the type of the record.
ResponseCode define response code in message header.