| Age | Commit message (Collapse) | Author |
|
This release bring major changes on dns package.
Most notable changes are adding caches and query forwarding (recursion),
and removing the server handler.
=== Breaking Changes
* `dns`:
** refactor server to use Start(), Wait(), and Stop()
** use direct certificate instance on ServerOptions
** rename Send to Write, and change the parameter type to slice of byte
** remove "elapsed" parameter on Message.IsExpired()
** unexport the Request type
** remove receiver interface
** unexport connection type
** remove unused address parameter on client's Query()
** unexport all fields from UDP and TCP clients
** remove TCPPort on ServerOptions
* `http`:
** change server initialization using options
* `io`:
** simplify Watcher to use callback instead of channel
* `memfs`:
** refactoring go generate file to use type from memfs
=== New Features
* `crypto`: new package that provide a wrapper for standard crypto
library
* `dns`:
** add caches to server
** add method to set AA, Query, RD, RCode on Message
** add mapping of response code to human readable names
** implement recursion, forwarding request to parent name servers
** check for zero TTL on authorities and additionals RR on IsExpired
* `io`:
** implement naive directory change notification, DirWatcher
* `memfs`:
** add parameter to make reading file content become optional
** add method to unmount directory
** add method to check if memfs contains mounted directory
** add method to update node content and information
** export the method to add new child
** add method to remove child from any node
* `smtp`: add field DKIMOptions to Domain
=== Bug Fixes
* `dns`:
** fix data race issue when running test
** set the TTL offset when packing resource record
** fix parsing TXT from zone file
* `http`:
** allow serving directory with slash
* `memfs`:
** fix possible invalid system path on file with symbolic link
** refresh the directory tree in Development mode if page not found
=== Documentation
* add documentation for Sender Policy Framework (RFC 7208)
|
|
|
|
|
|
|
|
We can move the boolean field "DoHAllowInsecure" to the bottom of struct
to make the struct aligned, but it will make the fields "unstructured".
We prefer the options grouped by their usage.
|
|
Previous runXxxForwarder methods on server, pass the remote address as
TCPAddr and UDPAddr, while inside the method we convert them to string.
To minimize calling String(), we change the parameter type into string.
|
|
|
|
|
|
|
|
|
|
Previous log format for response with error code is,
dns: response error <question>, code: <error-code>
The new format is
dns: ! <connection-type> <error-code> <ID>:<question>
This give a consistent format with the rest of request and response.
|
|
The isResponseValid already log the cause of invalid, there is no need
to repeat the same log at process response routine.
|
|
When UDP client got read timeout, the next read from the same connection
may read the previous response. This will cause a mismatch between
request and response for subsequence forward operations.
To handle this, we close the UDP connection and start a new one.
|
|
Since the server accept empty answers on query response (as long as
the response code is OK), the response message should be expired if one
of resource record in authority or additional is zero.
|
|
This is a quick fix, may not work, we will need to investigate it more
later.
|
|
If the program run in Development mode, any request URL that does not
exist in mapped path will trigger the memfs to rescan the directory
structure.
|
|
When the DirWatcher start or when new file is added to directory, start
watching all regular files inside directory for modification.
|
|
There are two other reasons for using callback: first, implementor of
Watcher does not need to create its own iteration to consume the channel;
second, it can be used by DirWatcher to watch modified file.
|
|
The implication for exporting NewNode function is the parent parameter
can be nil, and if its nil the SysPath and Path will be derived from
FileInfo.Name().
The reason for exporting this function is to allow creating independent
node from FileInfo.
|
|
DirWatcher watch for new or deleted files in root directory and its sub
directories using timer.
|
|
|
|
The child will be removed if and only if child is part of parent node's
childs; otherwise the method will return nil.
|
|
|
|
|
|
Previous new node function only initialize the node information based
on file information by calling os.Stat on path parameter. The content
and its type is loaded through separated methods.
This change combine all process so that when calling newNode it will be
ready to use, completely loaded and initialize.
|
|
The method will update node content and/or information in memory
based on new file information.
This method only check if the node name is equal with new file name, but
it's not checking whether the node is part of memfs (node is parent or
have the same root node).
|
|
Method IsMounted will return true if a directory in file system has been
mounted to memory; otherwise it will return false.
|
|
The method Unmount can be used to clear the memory and remount another
directory into memory file system.
|
|
Previously, when a directory is mount-ed, all the content of file will
be mapped to memory as long as its size less than MaxFileSize.
The new parameter "withContent" allow the file content to be mapped or not
mapped to memory. If its false, the MemFS will behave as directory tree.
|
|
Previous Go generated file use their own Node and provide single function
Get() to get the node based on path. This method does not work when
using it directly with memfs. For example, on server that contains
instance of memfs and want to use the output from GoGenerate, it would
need to add their own wrapper for Get() and memfs.Get().
It should be more simple than that.
This change add global variable GeneratedPathNode to memfs package, that
will be set by file from go generate. If the GeneratedPathNode is not
nil, memfs will use it as internal mapping of path and node.
|
|
Previously, if a directory contains "index.html" and client request the
directory with slash, server will return 404. For example,
"/a/index.html" accessed through "/a/" will return an error but "/a" or
"/a/index.html" will return the content of "index.html".
This commit fix this issue by checking if memfs.Get return an
os.ErrNotExist or not. If its ErrNotExist, concat the request path
with "index.html".
|
|
Previously, we only pass the root directory to be served and custom
http Server connection when creating new server.
This commit use a custom type to initialize server using ServerOptions.
This model is more robust and flexible. Caller can set custom address,
setting filter to include or exclude specific files in file system, and
allow development mode.
|
|
|
|
As long as the response is OK (response code 0), we should accept response
with no answer RR. One of the case is when query is AAAA and the domain
does not have IPv6 address, it would response with empty answer with
response code OK.
|
|
|
|
The worker prune process will run based on prune delay and it will remove
any cached answer that has not been accessed less than prune threshold
value.
|
|
Also, remove process of moving the answer to the back of LRU when doing
upsert on caches, since this is already handled by get().
|
|
If debug.Value is set to value greater than 1, server will print each
processed request, forward, and response.
The debug information prefixed with single character to differentiate
single action,
< : incoming request from client
> : the answer is sent to client
! : no answer found on cache and the query is not recursive
^ : request is forwarded to parent name server
- : answer exist on cache but its expired
+ : new answer is added to caches
# : the expired answer is renewed and updated on caches
Following the prefix is message ID and question, separated by colon.
|
|
If the answer found in cache, local or non local, when processing it
as response it should be pass as local; otherwise the same answer will
moved to back twice.
|
|
|
|
This commit change the ServerOptions to use single port field for UDP
and TCP.
|
|
Client should use the SetTimeout and/or SetRemoteAddr to modify the
fields.
|
|
The parameter address is not used anymore, even on UDP client. The
address is default to the parsed nameserver when creating client.
|
|
Previously, we need the UDP address of client to write back response to
client on UDP connection and http ResponseWriter to write back response
to client of DoH connection.
This changes simplify the sender using io.Writer.
On UDP connection, writer is an instance of UDPClient with
connection reference to UDP server and with peer address.
On TCP connection, writer is a TCP connection from accept.
On Doh connection, writer is http ResponseWriter.
|
|
Since the caches and forwarding now is handled internally, and Request
has been unexported, there is no need for exporting the connection type
anymore.
|
|
The interface is not used anymore, client should provide only Lookup and
Query to minimize API.
|
|
Since the caches and forwarding now is handled internally, there is no
need for exporting the request anymore.
|
|
The forwarding routines will be running only if there is at least one
valid NameServers on ServerOptions.
The request will be forwarded only if IsRD (is recursion desired) flag is
set.
|
|
This mapping can be used to print an error message based on error code
on response.
|
|
Since this function is called after the TTL has been subtracted, there is
no need to compare them with elapsed time; we only need to check if
TTL is zero or not.
|