summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-05-15all: refactoring the HTTP API for deleting zone recordShulhan
Previously, the HTTP API for deleting a record is by passing the parameters as JSON in the body. This may cause issue if HTTP client does not support sending body in DELETE method. This changes the method to pass the parameters in the query, DELETE /zone.d/rr?zone=<string>&type=<string>&record=<base64 json> Parameters, - zone: the zone name, - type: the record type, - record: the content of record with its domain name and value.
2022-05-14all: refactoring HTTP API for adding new zone.d recordShulhan
Previously, the request for adding new record on zone file is by passing the zone name and type inside the path, /zone.d/:name/rr/:type This commit changes it to pass all parameters inside the request body as JSON, { "zone": <string>, "kind": <string>, "record": <base64 string|base64 JSON> } For example, to add A record for subdomain "www" to zone file "my.zone", the request format would be, { "zone": "my.zone", "kind": "A", "record": "eyJOYW1lIjoid3d3IiwiVmFsdWUiOiIxMjcuMC4wLjEifQ==" } Where "record" value is equal to `{"Name":"www","Value":"127.0.0.1"}`. On the response, we changes it to return only the new record instead of all record in the zone.
2022-05-14cmd/resolver: implement command to create and delete zone fileShulhan
The command to create new zone file has the following signature: zone.d create <name> While command to delete zone file has the following signature: zone.d delete <name>
2022-05-14all: update documentation for resolverShulhan
Group each command and examples in its own section.
2022-05-14all: refactor the HTTP API for zone.dShulhan
Previously, the the HTTP API for creating and deleting zone file is by passing the zone file name in path of URL. This changes move the parameter name to POST body when creating new zone file and in the DELETE query when deleting zone file.
2022-05-13cmd/resolver: implement command to delete record on hosts fileShulhan
The command has the following signature, resolver hosts.d rr delete <name> <domain> Given the hosts name "hosts" and domain "my.hosts" it will delete all records that have domain name "my.hosts" inside the file.
2022-05-11all: ignore generated test files inside _test directoryShulhan
The _test directory is used as base directory when running local test (for example, by executing "make dev"). Any files inside the _test should not be ignored.
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.