| Age | Commit message (Collapse) | Author |
|
Using snake case make the file naming more readable.
|
|
This is for consistency for type and variable names.
|
|
The second parameter uniquely identify the source of caches.
|
|
|
|
There are two reasons for this changes. First, to allow JSON encoded
of ResourceRecord.Value without encoded to base64.
Second, to minimize unreleased packet due to the backing storage is
still used when assigned to Value (or any []byte field in RDataXXX).
|
|
While at it add field Records that contains unpacked ResourceRecord as
mapping between domain and ResourceRecord.
This is useful for client that need to edit the RR in MasterFile.
This changes also unexport the Messages field, to access it use the method
Messages().
|
|
Previously, each record data is represented b¥ its own type, except
for A, NS, CNAME, MB, MG, NULL, PTR, and TXT; represented b¥ slice of
byte.
This changes replace all record data with an interface{}.
|
|
Instead of as methods in Server, we detach the LoadHostDir and
LostMasterDir into functions that return list of filename and their
content.
|
|
|
|
|
|
Previously, the certificate is initialized by caller. This commit changes
the certification initialization by using path to the files.
|
|
The fields in ServerOptions is refactored to have generic name.
* The IPAddress field is renamed to ListenAddress, its value is both IP
address and port.
* The Port field is removed, merged to ListenAddress.
* The DoHPort field renamed to HTTPPort.
* The DoHCertificate field is renamed to TLSCertificate.
* The DoHAllowInsecure field is renamed to TLSAllowInsecure.
All the fields now have ini tag so it can be filled by using
ini.Unmarshal().
|
|
This commit change the ServerOptions to use single port field for UDP
and TCP.
|
|
Previously, the recursion flags is on by default when we doing a Lookup.
This may leak the DNS query to parent nameserver if client actually
only want the local services.
This commit add parameter to allow or disallow recursion when doing
lookup.
|
|
Previously, we use a handler for server, like server in HTTP library, to
serve query from client based on request. The idea was to make server
more generic which allow custom cache or request handling.
This is make sense if DNS response is dynamic, but in real world it is
not. DNS record actually static, either loaded from file (hosts or zone
file) or from response by recursive server.
This commit remove the server Handler and make all request to be
handled automatically based on whether the query exist on cache or not.
|
|
Previously, we assume that the Message that passed to Send method is
already Pack-ed.
By changing the type parameter to slice of byte, we remove the assumsion
(minimize confusion on how to use the method), and caller can pass the
Message.Packet directly.
|
|
There are possibility that certificate and private key file may not
exist in file system, for example in memory or fetched from other server.
This commit replace CertFile and PrivateKeyFile on ServerOptions with
direct instance of tls.Certificate.
|
|
There are two type of answer: local and non-local.
Local answer is a DNS record that is loaded from hosts file or master
zone file.
Non-local answer is a DNS record that is received from parent name
servers.
Server caches the DNS answers in two storages: map and list.
The map caches store local and non local answers, using domain name as a
key and list of answers as value,
domain-name -> [{A,IN,...},{AAAA,IN,...}]
The list caches store non-local answers, ordered by last accessed time,
it is used to prune least frequently accessed answers.
Local caches will never get pruned.
|
|
First, server have the following method exported: ListenAndServe,
ListenAndServeDoH, ListenAndServeTCP, and ListenAndServeUDP. The last
three methods are actually called by ListenAndServe automatically, so
there is no need to export them.
Second, instance of ServerOptions is only used for bootstraping listener.
After all listener have been setting up, its not used anymore. This
commit minimize the memory usage by release the ServerOptions after
server has been started.
Third, using ListenAndServe method block the caller, unless its running
with goroutine. This change make the Start() method to be non-blocking.
Server can wait for all listeners to shutting down or error using Wait().
|
|
Using request pooling just make the implementation a little bit complex.
Implementator must know that request need to be release by using
FreeRequest to minimize memory allocation.
|
|
The previous port number, 5353, is used by another program, which make
the test run failed.
The new port number is 5300.
|
|
|
|
The kind value indicate from which connection the request is coming from.
If Kind is UDP, Sender and UDPAddr must be non nil.
If Kind is TCP, Sender must be non nil
If Kind is DoH, both Sender and UDPAddr must be nil and ResponseWriter
and ChanResponded must be non nil and initialized.
|
|
Since we have three mode for server now (UDP, TCP, DoH), more
parameters were added to ListenAndServe. To simplify this we use server
options with struct that can be passed directly to ListenAndServer.
|
|
The implementation is based on latest draft [1].
[1] https://tools.ietf.org/html/draft-ietf-doh-dns-over-https-14
|
|
|