| Age | Commit message (Collapse) | Author |
|
=== Enhancements
* go.mod: set Go version to 1.19 and update share module
The latest share module has several fixes and enhancements regarding
DNS library, including
* lib/dns: simplify unpackDomainName return value for end
* lib/dns: use the packet length to derive current offset
* lib/dns: handle zone file with CRLF line ending
* lib/dns: allow parsing TXT rdata without quote in zone file
* lib/dns: fix parsing SRV record from zone file
* lib/dns: fix packing and unpacking resource record HINFO
* lib/dns: fix packing, parsing, and saving MINFO resource data
* _www/doc: update the index and resolver documentation
|
|
While at it, use "_" for unused parameter on methods.
|
|
|
|
This release refactoring the resolver command as CLI to rescached server.
The resolver command now can manage environment, caches, hosts.d, and
zone.d in the server; not just query.
|
|
Previously those fields exported because web client need it to initialize
the content for /hosts.d and /zone.d pages.
Since we now have HTTP API for that, web client can call get request
to the respective API without depends on the environment.
|
|
This changes affect the dns Server where all caches related methods has
been moved to field Caches.
|
|
In the Environment, we have a field HostsBlocks that reference
an unexported type hostsFile.
In order for any package to be able to use this field, we need to
export this type.
While at it, we rename the type from hostsBlock to Blockd to make it
simple and consistent with name.
|
|
Executing "resolver version" will print the current version based
on the latest tag, number of commit, and latest commit hash:
v<TAG>.r<number-of-commit>.<commit-hash>
|
|
This is to prevent panic when hosts.d is not exist and client try to
create new hosts file on it.
|
|
Previously, running an instance of rescached assume that all
configurations and cache are located in /etc/rescached and
/var/cache/rescached.
It possible that we may want to use different base directory (or $PREFIX,
in the auto tools terms), for example "/opt/rescached" or as showed
in the "dev" task in the Makefile, we use "_test" as base directory
for running test instance.
This changes also fix an error when loading hosts file from non-existant
hosts.d directory.
|
|
This changes add new directory called "block.d" under rescached.
This directory contains hosts file fetched from URL defined in hosts
block configuration.
In this way, we did not mixed between user created hosts file and
external hosts file.
In the configuration file, we changes the hosts block format from
single line
hosts_block = <URL>
into subsection with dynamic name,
[block.d "<name>"]
name = <name>
url = <URL>
|
|
The latest share module move the Watcher and DirWatcher from package io
to package memfs, also it simplify watching files on existing MemFS
instance using method Watch.
|
|
See https://kilabit.info/journal/2022/gpl/ for more information.
|
|
Previously, the options for HTTP server initialized internally, which
make it uneasy to changes the default rescached instance when running
in development mode.
This commit move the HTTP server initialization inside the Environment
init method. If its nil, the init will set the default HTTP server
options along with the Memfs.
|
|
Previously, we initialize the rescached Server by passing the
path to configuration file and initialize the environment inside the
server.
This commit changes it to pass the instance of Environment. The idea
is to allow creating and running rescached Server without creating
configuration file first.
|
|
This changes update the code based on refactoring on lib/dns package
on share module.
|
|
The update bring new features and enhancements for DNS server.
* add support to save and load caches to/from storage
rescached now able to save and load caches to local storage upon
restart.
On POSIX, the caches is stored in /var/cache/rescached/rescached.gob,
encoded using gob.
Update #9
* remove the fallback name servers (NS) from server options
The original idea of fallback NS is to send the query to the one
define in resolv.conf, instead of using the one defined by user in
ServerOptions NameServers, when an error occured.
But, most of error usually caused by network (disconnected, time out),
so re-sending query to fallback NS does not have any effect if the
network it self is not working.
This changes remove the unnecessary and complex fallback NS from
server.
* do not cache truncated answer
Previously only answer with non-zero response code is ignored.
This changes ignore also answer where response header is truncated.
* lib/dns: make the TCP forwarders as complementary of UDP
The TCP forwarders only active when client send the DNS request as TCP.
When the server receive that request it should also forward the request
as TCP not as UDP to prevent the truncated response.
Another use case for TCP is when the response is truncated, the client
will send the query back through TCP connection. The server should
forward this request using TCP instead of UDP.
|
|
|
|
Add second parameter to method PopulateCachesByXxx for clearity.
|
|
|
|
While at it,
* update code with latest dns library
* check for empty name servers when updating environment
|
|
Currently, it allow user to add or remove new resource record from the
master zone file.
|
|
The UI will update (insert or remove) the records on cache on the fly.
|
|
To be able to edit the hosts or master file through web UI, we need to
store it some where. This changes is premilinary commit before we add
the actual UI to edit hosts file.
|
|
|
|
Previously, user can change the location where the hosts files and master
file using "rescached::dir.host" and "rescached::dir.master" options.
This change disallow chaning both options and make them static.
|
|
While at it, unexport it.
|
|
This is the first web UI (wui) where user can change configuration on
the fly.
The wui is implemented using svelte.dev and can be accessed on
http://127.0.0.1:5380.
|
|
|
|
As part of creating the web user interface, we need to know the location
of config file so we can write the new config values later.
|
|
The latest dns.Server now replace Start and Wait with ListenAndServe()
|
|
By checking error from dns.Wait we can tell if dns Server exit because
of error or not.
|
|
|
|
The configuration file now group into two section: the '[rescached]' and
'[dns "server"]' sections. All of the configuration values are loaded
using ini.Unmarshal instead of using manual parsing.
|
|
|
|
The concept of writing PID file when the program start on networking
service is not applicable or relevant anymore on systemd or launchd.
If the program already started, the second program will fail because
the port is already used.
|
|
|
|
All the server core functionalities (caches and forwarding) now
implemented inside "dns.Server". The main function of this package are
for reading options from configuration file (or from command line options)
and watching changes from system resolv.conf.
There are also some major changes on configuration file.
* "server.parent" option now use URI format instead of IP:PORT.
This will allow parent name servers to be UDP, TCP, and/or DoH
simultaneusly.
* "server.doh.parent" and "server.parent.connection" are removed,
redundant with new "server.parent" format.
* "cache.threshold" is renamed to "cache.prune_threshold".
|
|
This reverts commit da44b655f1e46281741e47a664cd96ed560e4cb9.
Reason for revert: using multiple processes to handle request queue will
result in data race when setting response ID, especially when multiple
client requests the same query.
|
|
|
|
The number of maximum routines is equal to maximum forwarder (4 routines).
|
|
Method update() on cacheworker basically contains one line statement.
Also, update the log format to print ID of query and response and
total caches.
|
|
This minimize one queue in server but slowing down the process because
each request will be handled sequentially.
|
|
There are many possibilities that can cause one request failed, we cannot
just assume that one failed request responsible for the rest of request.
|
|
This commit also remove HTTP profiling.
|
|
This cause memory race condition when processing DNS over HTTPS
|
|
|
|
|
|
This is to simplify testing process request without using channel.
|
|
|