| Age | Commit message (Collapse) | Author |
|
While at it, use "_" for unused parameter on methods.
|
|
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
|
|
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{}.
|
|
Given the following request,
GET /api/block.d
It will return list of hosts in block.d as JSON format:
{
"data": {
"<name>": <Blockd>
...
}
}
|
|
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.
|
|
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.
|
|
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.
|
|
Given the following command,
$ resolver zone.d rr get <zone>
It will fetch and print all records in the specific <zone>.
|
|
The command has the following format,
resolver zone.d
|
|
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.
|
|
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>
|
|
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.
|
|
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.
|
|
The resolver cli now have command "hosts.d" to create, delete, and get
the hosts file inside the hosts.d in the rescached server.
|
|
Instead of passing whole block.d object with single field Name set,
send the request using urlencoded form.
|
|
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.
|
|
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.
|
|
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.
|
|
The "env" command fetch the current server environment and print as
ini format to stdout.
|
|
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.
|
|
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.
|
|
The caches command fetch and print all caches from rescached server.
|