aboutsummaryrefslogtreecommitdiff
path: root/cmd
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.
2023-04-01all: update go doc commentsShulhan
While at it, use "_" for unused parameter on methods.
2022-06-09all: change the HTTP API to update hosts in block.dShulhan
We have HTTP API to enable or disable block.d by batch by passing all block.d records. The name of HTTP API is /v2/block.d/update and this is duplicate with API to update the content of hosts in block.d. This changes fix this by creating new HTTP API /v2/block.d/fetch that fetch the latest hosts file from specific block.d by its name. While at it, - reformat html and JavaScript files using js-beautify - rename constants and methods for HTTP APIs - add and update comments for some HTTP APIs
2022-05-22all: use the exported Blockd type instead of interface{}Shulhan
Since we have exported the Blockd type from rescached package, any Blockd operation on the HTTP server and on the client on cmd/resolver can use it instead of using interface{}.
2022-05-22cmd/resolver: implement command to list hosts in block.dShulhan
Given the following command $ resolver block.d It will print all hosts in block.d in the JSON format, for example { "pgl.yoyo.org": { "Name": "pgl.yoyo.org", "URL": "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts\u0026showintro=0\u0026startdate[day]=\u0026startdate[month]=\u0026startdate[year]=\u0026mimetype=plaintext", "LastUpdated": "2022-04-20 01:54:30 WIB", "IsEnabled": false }, "someonewhocares.org": { "Name": "someonewhocares.org", "URL": "http://someonewhocares.org/hosts/hosts", "LastUpdated": "2022-04-20 00:53:22 WIB", "IsEnabled": false }, "winhelp2002.mvps.org": { "Name": "winhelp2002.mvps.org", "URL": "http://winhelp2002.mvps.org/hosts.txt", "LastUpdated": "2022-04-20 01:35:38 WIB", "IsEnabled": false } }
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-05-22cmd/resolver: changes the help flag to commandShulhan
Executing "resolver help" will print the command usage.
2022-05-22all: simplify cmd/resolver documentationShulhan
It is hard to keep the documentation in sync between manual page, the Go documentation, and command line usage. A changes in manual page need to be copied into two different places. To simplify this, we make the Go doc comment as summary and the command line usage is set from output of `go tool doc ./cmd/resolver`.
2022-05-22all: move the documentation under _www/doc directoryShulhan
This also allow the latest/released documentation viewed on the web user interface under /doc path. While at it, reformat HTML and CSS files using js-beautify and JavaScript files using clang-format [1]. [1] https://google.github.io/styleguide/jsguide.html#formatting
2022-05-17cmd/resolver: implement command to delete record on zoneShulhan
Given the following command $ resolver zone.d rr delete <zone> <"@" | subdomain> <type> <class> <value> It will delete the record in zone by given subdomain, type, class, and value.
2022-05-16cmd/resolver: implement command to get records on zoneShulhan
Given the following command, $ resolver zone.d rr get <zone> It will fetch and print all records in the specific <zone>.
2022-05-16cmd/resolver: add command to fetch and print all zonesShulhan
The command has the following format, resolver zone.d
2022-05-15cmd/resolver: implement command to add new record to zoneShulhan
The command has the following signature, zone.d rr add <zone> <"@" | subdomain> <ttl> <type> <class> <value> ...:: The domain name can be set to origin using "@" or empty string, subdomain (without ending with "."), or fully qualified domain name (end with "."). If ttl is set to 0, it will default to 604800 (7 days). List of valid type are A, NS, CNAME, PTR, MX, TXT, and AAAA. List of valid class are IN, CS, HS.
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-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-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-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-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-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-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-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-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: 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-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-27cmd/resolver: realign struct optionsShulhan
This save the memory size from 80 to 72 bytes (-8 bytes).
2021-12-27cmd/rescached: add command "embed" and to run in development modeShulhan
This two commands is used internally for development. The "embed" command embed all files inside "_www" directory into Go file "memfs_generate.go". This command replace "internal/generate_memfs.go". The "dev" command run the rescached server in development mode using "cmd/rescached/rescached.cfg.test" as the configuration. The "dev" command listen on DNS port 5350, so to prevent conflict with live rescached server, we run script _bin/nft_dnstest_chain.sh to redirect UDP and TCP requests from port 53 to port 5350.
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: remove using tcp scheme in config and documentationShulhan
Using TCP for parent name server is discouraged, because most of server disallow keeping the connection alive. The valid use case for TCP connection is when server received truncated UDP answer. Using UDP as parent scheme, will automatically assume that the server also capable of handling query in TCP. This is required when client (for example, your browser) re-send the query after receiving truncated UDP answer. Any query received by rescached through TCP will forwarded to the parent name server as TCP too, using the same address and port defined in one of UDP parent. While at it, use Cloudflare DNS server as default in configuration and as example in documentation.
2021-11-14cmd/resolver: fix redundant new linesShulhan
2021-01-26Release rescached v4.0.0 (2021-01-25)v4.0.0Shulhan
== New features Rescached now have a web user interface (wui) that can be accessed at http://127.0.0.1:5380. The interface can be used to monitoring caches, managing caches, environment, blocked hosts, internal hosts files, and zone files. == Breaking changes * The `rescached::dir.hosts` now default to "/etc/rescached/hosts.d" * The `rescached::dir.master` now default to "/etc/rescached/zone.d"
2021-01-25rescached: set tls.allow_insecure option to trueShulhan
Since the default parent is DNS over TLS, https://18.136.35.199, which is run using self-signed certificate, we need to allow_insecure to true to make the forward can connect without error.
2021-01-24all: update the configurations and expired certificatesShulhan
Remove empty options in configurations to minimize confusion and comment options that have default values.