aboutsummaryrefslogtreecommitdiff
path: root/client.go
AgeCommit message (Collapse)Author
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-22all: implement HTTP API to fetch list of block.dShulhan
Given the following request, GET /api/block.d It will return list of hosts in block.d as JSON format: { "data": { "<name>": <Blockd> ... } }
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-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-16all: use consistent parameter name for zone nameShulhan
Some zone APIs use "name" and some use "zone" for passing the zone name. This changes made all zone APIs to use "name" as parameter name.
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-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: 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-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-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-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-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-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.