aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-05-11cmd/resolver: implement command to add new record to hosts fileShulhan
The command has the following signature, resolver hosts.d rr add <name> <domain> <value> Given the hosts file name "hosts" and domain "my.hosts" with value "127.0.0.1", it will add new line "127.0.0.1 my.hosts" to the "hosts" file. If the domain name already exists, the new record will be appended instead of replaced.
2022-04-25all: refactor the APIs to manage hosts.d resource records (RR)Shulhan
There are two APIs to manage hosts.d RR: create and delete. Previously, the create API pass the hosts name inside and values inside the path, POST /hosts.d/<name>/rr?domain=&value= This commit changes the request type to form, so all parameters move to body, POST /hosts.d/rr Content-Type: application/x-www-form-urlencoded name=&domain=&value= On delete API, we changes the name parameter to be send on query parameter along with domain to be deleted. Previously, the delete API was DELETE /hosts.d/<name>/rr?domain= now it become DELETE /hosts.d/rr?name=&domain=
2022-04-24cmd/resolver: move handling command env to resolverShulhan
2022-04-24cmd/resolver: simplify handling command "caches"Shulhan
Instead of splitting them into three methods, merge them into single method doCmdCaches.
2022-04-24cmd/resolver: simplify method to handle block.d commandShulhan
Instead of splitting them into three methods, merge them into single method.
2022-04-24cmd/resolver: implement command to manage hosts.dShulhan
The resolver cli now have command "hosts.d" to create, delete, and get the hosts file inside the hosts.d in the rescached server.
2022-04-24all: return the hosts file in response of hosts.d create and deleteShulhan
Instead of returning empty data, return the affected hosts file when creating a new one or when deleting existing one.
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-23all: fix panic if a nil HostsFiles and/or Zones is accessedShulhan
2022-04-23all: change the hosts.d HTTP API request type to form and queryShulhan
Using dynamic value in the URL path is not a good practice, so we move the API for hosts.d to create, delete, and get to form and query parameters.
2022-04-22all: changes the block.d update API request type to x-www-form-urlencodedShulhan
Instead of passing whole block.d object with single field Name set, send the request using urlencoded form.
2022-04-21cmd/resolver: implement command to disable or enable hosts in block.dShulhan
The following command enable specific hosts in block.d by name: resolver block.d enable <name> and the following command disable it resolver block.d disable <name>
2022-04-21all: implement HTTP API to enable or disable hosts on block.dShulhan
The URL /api/block.d/enable activate the hosts in block.d, while The URL /api/block.d/disable deactivate the hosts in block.d. Both of this API accept single parameter "name" in the body as application/x-www-form-urlencoded.
2022-04-20all: move all installation files into directory _sysShulhan
Previously, all files required for installing rescached scattered in different directories. This changes move all files into single directory _sys with the directory structure matched with target system.
2022-04-20_www: implement function to update block.d hosts fileShulhan
In the /block.d page, in each provider we provide a button to update the hosts file directly.
2022-04-20cmd/resolver: implement command to update block.d hosts by its nameShulhan
The following command: "resolver block.d update x" will fetch the latest hosts file from the block.d provider "x" based on its registered URL.
2022-04-20all: implement HTTP API to update hosts.dShulhan
The API receive the block.d name and if it valid, the server will fetch latest hosts file from the block provider based on the registered URL.
2022-04-20all: fix error updating hosts block if directory not existShulhan
If the hosts block file never created before and the directory to hosts block file is not exist, the hostsBlock update method will return an error. This changes fix this issue by creating the path to hosts block directory first before fetching and storing the new update.
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: rename the page and HTTP API for hosts_blocks to block.dShulhan
This is to make all terminology to be consistent, from configuration to page URL, and API.
2022-04-19all: move the rescached.cfg for test under _test directoryShulhan
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: remove malwaredomainlist.com from provider of hosts blockShulhan
The URL and contents from this provider is now empty and has not been updated.
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-16cmd/resolver: implement sub command to update environmentShulhan
The env command now accept sub command "update" with argument path to the file or "-" for standard input. The content of file is formatted using JSON, the same as output of "env" command. If the content of file is valid, server will be restarted immediately.
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-04-15cmd/resolver: check for number of answer when processing queryShulhan
If the number of Answer is zero, break the attempt and continue the next query name. This is to fix the loop end when server return OK but with zero answer.
2022-04-15cmd/resolver: replace populateQueries with lib/net ResolvConfShulhan
Since share 9329196125fe, the populateQueries has been moved to package lib/net as a method of ResolvConf.
2022-04-15all: implement API to remove all cachesShulhan
On the HTTP side, if the query parameter "name" for "DELETE /api/caches" is "all" it will remove all caches. On the resolver side, if the parameter for "caches remove" is "all" it will remove all caches. This changes require latest lib/dns on share module.
2022-04-15cmd/resolver: print the Answer ReceivedAt and AccessedAt from nowShulhan
Instead of printing the full date and time, print the ReceivedAt and AccessedAt fields in the perspective of current time. For example, 1m ago, 30s ago.
2022-04-15all: update generated manual pages for rescached and rescached.cfgShulhan
2022-04-15all: update the _AUR submodule to latest commitShulhan
2022-04-15Makefile: add task serve-doc to preview documentation using ciigoShulhan
The serve-doc command require ciigo [1] command. [1] git.sr.ht/~shulhan/ciigo
2022-04-15all: implement sub command to remove caches by domain nameShulhan
The "caches" command accept second sub command "remove" that accept single domain name to be removed from caches. This changes affect the HTTP API for caches delete to return the removed answer on the response data.
2022-04-15cmd/resolver: implement command to search the cachesShulhan
The "caches" command accept sub command "search" with a string argument. Given the following command "caches search bit", the resolver will call HTTP API to rescached server to search for caches that have name contains bit.
2022-04-14cmd/resolver: implement caches commandShulhan
The caches command fetch and print all caches from rescached server.
2022-04-14cmd/resolver: refactor the resolver as client of DNS and rescachedShulhan
Previously, the resolver command only for querying DNS server. In this changes and in the future, the resolver command will be client for DNS and rescached server.
2022-04-12cmd/resolver: use dns.NewClient to create new clientShulhan
2022-04-11all: replace internal response with lib/http.EndpointResponseShulhan
Both types are similar, since the lib/http already imported we replace the internal response to minimize duplicate and confusion later. While at it, use consistent variable naming and declaration using var in all methods.
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-15Release rescached v4.3.0 (2022-03-15)v4.3.0Shulhan
This release re-licensing the rescached under GPL 3.0 or later. See https://kilabit.info/journal/2022/gpl/ for more information.
2022-03-15all: change the rescached license to GPL 3.0 or laterShulhan
See https://kilabit.info/journal/2022/gpl/ for more information.
2022-03-14go.mod: update all dependenciesShulhan
2022-02-09Release rescached v4.2.0 (2022-02-09)v4.2.0Shulhan
=== New features * www: implement functionality to remove cache by record name === Bug fixes * www: check for possible null on NameServers environment * www: fix caches record type showing "undefined" === Chores * all: fix format of all asciidoc files * cmd/rescached: add command "embed" and to run in development mode
2022-02-09_doc: add index file and symlinks to CHANGELOG and READMEShulhan
The idea is to be able to view all content of documentation inside the _doc file using the following command: _doc$ ciigo serve
2022-02-09all: fix format of all asciidoc filesShulhan
This is to make the adoc files parsed and rendered correctly by asciidocgo and asciidoc tools.
2022-02-09all: reformat CHANGELOG to make generated HTML readableShulhan
The CHANGELOG.adoc file is formatted using asciidoc markup. So, to make the rendered HTML readable, it must adhere to the asciidoc format, especially when formatting the list content.
2022-02-08all: update git submodule AURShulhan
2022-02-08go.mod: update module share to v0.34.0Shulhan
Changes, * lib/memfs: skip mount if the Root node has been initialized * lib/http: remove field memfs.Options in ServerOptions