aboutsummaryrefslogtreecommitdiff
path: root/environment.go
AgeCommit message (Collapse)Author
2023-07-27[wip] cmd/rescached: add telemetry using questdbdev-telemetryShulhan
The telemetry collect the Go runtime/metrics and forward it to questdb instance in localhost.
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-12all: fixes HTTP API for updating environmentShulhan
There are two issues when updating environment. One is on the front, where debug value is send as string. Another one is the back, where new environment overwrite all of options where it should only update only DNS server options and Debug fields.
2022-06-12_www/block.d: fix the variable names on hosts block.dShulhan
In the commit 0b92dbb8463d, we changes the field HostsBlocks in Environment to HostBlockd, but we forgot to changes the code in the web. This changes fix this issue.
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-04-23all: fix panic if a nil HostsFiles and/or Zones is accessedShulhan
2022-04-19all: always call Environment initShulhan
This is to make sure that all required fields that are empty in the configuration initialized to its default values.
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-16all: apply suggestions from linterShulhan
List of changes, * Remove unused constants keyIsEnabled, keyIsSystem, and keyLastUpdated. * Use the method String on instance of Duration instead of fmt.Sprintf. * Replace any usage of io/ioutil package with its replacement. * Check for error from calling Environment.init and Zone.Add. * Prefix all returned error on hostsBlock.update method. * Add "lint" task as part of default target, build.
2022-04-16cmd/resolver: implement command to fetch and print server environmentShulhan
The "env" command fetch the current server environment and print as ini format to stdout.
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: realign all structsShulhan
This minimize storage size allocated by * hostBlocks: from 88 to 80 bytes (-8 bytes) * Environment: from 344 to 288 bytes (-56 bytes)
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-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: make enabling and disabling hosts block without restartShulhan
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: use log.SetPrefix to prefix the log outputShulhan
2020-07-26all: add user interface to configure source of hosts blockShulhan
The user interface, which can be accessed at http://127.0.0.1:5380/#hostsblock, contains list of hosts block sources that can be enabled or disabled using check box. If enabled and the file is outdated, it will fetch the latest list and store it at /etc/rescached/hosts.d/<name>, where name is the domain name of source.
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.