aboutsummaryrefslogtreecommitdiff
path: root/rescached.go
AgeCommit message (Collapse)Author
2026-02-03all: add option to set minimum TTLShulhan
In the rescached.cfg, we add option where user can force the minimum TTL in the DNS answer. This option is not a standard and not recommended used in public facing network. It should be used only for personal and private network.
2026-01-26all: remove prefix "rescached:" on loggingShulhan
Adding those prefix make the log context redundant in journald.
2025-12-27Release rescached v4.4.4 (2025-12-27)v4.4.4Shulhan
This release mostly chores. **💧 all: replace golangci-lint with "go vet"** **💧 all: replace debug package with internal Debug variabel** The [debug.Value] will be removed in the next release of pakakeh.go. **💧 internal/cmd/gocheck: add internal static analyzers** Instead of using binary fieldalignment and shadow, run them by creating command that call the same Analyzer internally. This analyzers help finding possible panic on httpd.go. **💧 make: remove build task from install tasks** The build task should be run by user, while install tasks run by root. If we make build depends on install then the binaries will rebuild by user root. **💧 Makefile: do not run "embed" when building rescached** The embed command should be run once when the assets file in _www changes. **💧 all: cleaning README and expand the index in documentation** In the README, we remove the EXIT STATUS and AUTHOR sections. Those sections are not informative. In the index, we expand the preamble to include short information about what is rescached. **💧 make: fix building resolver** Seems like the "go tool doc" subcommand has been removed on latest release of Go.
2025-01-26all: replace debug package with internal Debug variabelShulhan
The [debug.Value] will be removed in the next release of pakakeh.go.
2025-01-11go.mod: update all dependenciesShulhan
2024-09-07Release rescached v4.4.3 (2024-09-07)v4.4.3Shulhan
=== Enhancements * cmd/rescached: add sub command to print the current version Running "rescached version" now will print the program version. * support SVCB record (type 64) and HTTPS record (type 65) The latest update on "lib/dns" package support RFC 9460, SVCB record (type 64) and HTTPS record (type 65). === Chores * all: replace module "share" with "pakakeh.go" The module "share" has been moved to new repository at SourceHut and we rename it to make it more unique instead of common English words "share". * all: move repository to SourceHut The new repository and project page for rescached is at https://sr.ht/~shulhan/rescached .
2024-03-21all: replace module "share" with "pakakeh.go"Shulhan
The module "share" has been moved to new repository at SourceHut and we rename it to make it more unique instead of common English words "share".
2023-11-09Release rescached v4.4.2 (2023-11-10)v4.4.2Shulhan
* all: remove loading system hosts file:: Loading and caching system hosts file (for example, /etc/hosts in POSIX) will leaks internal hosts if the rescached server is open to public. The system hosts file are handled by nssswitch.conf "files" internally so no need to loading it. * cmd/resolver: replace "math/rand" with "crypto/rand":: The random number from "math/rand" is predictable if the seed is known. Even though the random number here is only for generating unique request ID, we still need to prevent this by using more secure random number.
2023-09-23go.mod: update all dependencies and set Go mod version to 1.20Shulhan
The update on share module affect the following changes, * lib/dns: removing dns.ZoneRecords, replacing it with map[string][]*dns.ResourceRecord * lib/dns: file Name in Zone renamed to Origin * lib/dns: replace call to Caches.InternalPopulate with InternalPopulateZone that accept zone as parameter
2023-09-23all: remove loading system hosts fileShulhan
Loading and caching system hosts file (for example, /etc/hosts in POSIX) will leaks internal hosts if the rescached server is open to public. The system hosts file are handled by nssswitch.conf "files" internally so no need to loading it.
2023-04-01Release rescached v4.4.1 (2023-04-01)v4.4.1Shulhan
=== 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
2023-04-01all: update go doc commentsShulhan
While at it, use "_" for unused parameter on methods.
2023-04-01all: remove ineffectual assignment to errShulhan
2022-08-06Release rescached v4.4.0 (2022-08-06)v4.4.0Shulhan
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.
2022-06-12all: un-export HostsFiles and Zones fields on EnvironmentShulhan
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.
2022-06-09go.mod: update to share module v0.38.0Shulhan
This changes affect the dns Server where all caches related methods has been moved to field Caches.
2022-05-22all: export and rename the hostsBlock type to BlockdShulhan
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.
2022-05-22cmd/resolver: add command to print the program versionShulhan
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>
2022-04-23all: create hosts.d directory if not existShulhan
This is to prevent panic when hosts.d is not exist and client try to create new hosts file on it.
2022-04-19all: add option to set the base directoryShulhan
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.
2022-04-19all: refactoring the hosts blocks format and locationShulhan
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>
2022-04-11go.mod: update to latest share the moduleShulhan
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.
2022-03-15all: change the rescached license to GPL 3.0 or laterShulhan
See https://kilabit.info/journal/2022/gpl/ for more information.
2021-12-21all: move HTTP server option to EnvironmentShulhan
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.
2021-12-19all: refactoring Server initializationShulhan
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.
2021-12-04all: sync with latest share moduleShulhan
This changes update the code based on refactoring on lib/dns package on share module.
2021-11-14all: update share moduleShulhan
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.
2021-01-20all: rewrite the web user interface and the APIsShulhan
2020-08-25go.mod: update with latest share packageShulhan
Add second parameter to method PopulateCachesByXxx for clearity.
2020-08-23all: replace the internal hosts file with dns.HostsFileShulhan
2020-08-22all: change "Master" word to "Zone"Shulhan
While at it, * update code with latest dns library * check for empty name servers when updating environment
2020-08-17all: implement web UI to manage master zone filesShulhan
Currently, it allow user to add or remove new resource record from the master zone file.
2020-07-26all: implement UI to create, update, delete hosts file in hosts.dShulhan
The UI will update (insert or remove) the records on cache on the fly.
2020-07-26all: store the loaded hosts and master filesShulhan
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.
2020-07-26all: use log.SetPrefix to prefix the log outputShulhan
2020-07-26all: make host and master directory staticShulhan
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.
2020-07-26all: rename Options to environmentShulhan
While at it, unexport it.
2020-07-26all: implement the user interface to change configurationShulhan
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.
2020-07-26rescached: stop watching file resolv.conf on StopShulhan
2020-07-26cmd/rescached: move parsing config file to rescached packageShulhan
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.
2019-12-26go.mod: update dependenciesShulhan
The latest dns.Server now replace Start and Wait with ListenAndServe()
2019-10-24rescached: return error from dns.WaitShulhan
By checking error from dns.Wait we can tell if dns Server exit because of error or not.
2019-10-17rescached: support serving and forwarding DNS over TLSShulhan
2019-10-16all: refactoring configuration fileShulhan
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.
2019-10-15rescached: log the DoH address and port on StartShulhan
2019-09-29all: remove the usage of writing PID fileShulhan
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.
2019-07-09all: add prefix to the log output with "rescached: "Shulhan
2019-07-05all: refactoring with latest update on dns packageShulhan
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".
2019-03-22Revert "rescached: run multiple routines to process request queue"Shulhan
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.
2019-03-02rescached: simplify the logic of return on processForwardResponseShulhan