aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-05-13 22:58:22 +0700
committerShulhan <ms@kilabit.info>2022-05-14 01:22:49 +0700
commit69f34312061d5e5ef853fa28e271d93dbcfbbc6c (patch)
tree4254cfea5e3ea686426e549b3f36e46dfc8f4f35
parent4e5ae6b15752c0a2a98b3414c5b88e0df43af4e4 (diff)
downloadrescached-69f34312061d5e5ef853fa28e271d93dbcfbbc6c.tar.xz
all: update documentation for resolver
Group each command and examples in its own section.
-rw-r--r--_doc/resolver.adoc20
-rw-r--r--cmd/resolver/main.go35
2 files changed, 51 insertions, 4 deletions
diff --git a/_doc/resolver.adoc b/_doc/resolver.adoc
index 9951ad5..3885315 100644
--- a/_doc/resolver.adoc
+++ b/_doc/resolver.adoc
@@ -63,6 +63,8 @@ Default to "https://127.0.0.1:5380" if its empty.
== COMMANDS
+=== QUERY
+
query <domain / ip-address> [type] [class]::
+
--
@@ -94,6 +96,9 @@ List of valid types,
The "class" parameter is optional, its either IN (default), CS, or HS.
--
+
+=== MANAGING BLOCK.D
+
block.d disable <name>::
+
--
@@ -116,6 +121,8 @@ restarted.
--
+=== MANAGING CACHES
+
caches::
+
--
@@ -137,6 +144,9 @@ Remove the domain name from rescached caches.
If the parameter is "all", it will remove all caches.
--
+
+=== MANAGING ENVIRONMENT
+
env::
+
--
@@ -151,6 +161,9 @@ If the argument is "-", the new environment is read from stdin.
If the environment is valid, the server will be restarted.
--
+
+=== MANAGING HOSTS.D
+
hosts.d create <name>::
+
--
@@ -171,6 +184,8 @@ Get the content of hosts file inside the hosts.d directory by file name.
--
+=== MANAGING RECORD IN HOSTS.D
+
hosts.d rr add <name> <domain> <value>::
+
--
@@ -180,7 +195,6 @@ If the domain name already exists, the new record will be appended
instead of replaced.
--
-
hosts.d rr delete <name> <domain>::
+
--
@@ -195,7 +209,7 @@ Upon exit and success +resolver+ will return 0, or 1 otherwise.
== EXAMPLES
-=== QUERY EXAMPLES
+=== QUERY
Query the IPv4 address for kilabit.info,
@@ -287,7 +301,7 @@ Get the content of hosts file named "myhosts" inside the hosts.d directory,
}
]
-=== MANAGING RECORD ON HOSTS.D
+=== MANAGING RECORD IN HOSTS.D
Add new record "127.0.0.1 my.hosts" to hosts file named "hosts",
diff --git a/cmd/resolver/main.go b/cmd/resolver/main.go
index fac894c..7126651 100644
--- a/cmd/resolver/main.go
+++ b/cmd/resolver/main.go
@@ -93,7 +93,9 @@ func main() {
func help() {
fmt.Println(`
-= resolver: command line interface for DNS and rescached server
+= resolver
+
+resolver is command line interface for DNS and rescached server
== Usage
@@ -130,6 +132,8 @@ The following options affect the commands operation.
== Commands
+=== QUERY
+
query <domain / ip-address> [type] [class]
Query the domain or IP address with optional type and/or class.
@@ -144,6 +148,9 @@ query <domain / ip-address> [type] [class]
Valid class are either IN, CS, HS.
Default value is IN.
+
+=== MANAGING BLOCK.D
+
block.d disable <name>
Disable specific hosts on block.d.
@@ -159,6 +166,9 @@ block.d update <name>
On success, the hosts file will be updated and the server will be
restarted.
+
+=== MANAGING CACHES
+
caches
Fetch and print all caches from rescached server.
@@ -174,6 +184,9 @@ caches remove <string>
Remove the domain name from rescached caches.
If the parameter is "all", it will remove all caches.
+
+=== MANAGING ENVIRONMENT
+
env
Fetch the current server environment and print it as JSON format to
@@ -185,6 +198,9 @@ env update <path-to-file / "-">
If the argument is "-", the new environment is read from stdin.
If the environment is valid, the server will be restarted.
+
+=== MANAGING HOSTS.D
+
hosts.d create <name>
Create new hosts file inside the hosts.d directory with specific file
@@ -199,6 +215,9 @@ hosts.d get <name>
Get the content of hosts file inside the hosts.d directory by file
name.
+
+=== MANAGING RECORD IN HOSTS.D
+
hosts.d rr add <name> <domain> <value>
Insert a new record and save it to the hosts file identified by
@@ -213,6 +232,8 @@ hosts.d rr delete <name> <domain>
== Examples
+=== QUERY
+
Query the IPv4 address for kilabit.info,
$ resolver query kilabit.info
@@ -236,6 +257,9 @@ name server kilabit.info,
$ resolver -insecure -ns=https://kilabit.info/dns-query query kilabit.info
+
+=== MANAGING CACHES
+
Inspect the rescached's caches on server at http://127.0.0.1:5380,
$ resolver -server=http://127.0.0.1:5380 caches
@@ -252,6 +276,9 @@ Remove all caches in the server,
$ resolver caches remove all
+
+=== MANAGING ENVIRONMENT
+
Fetch and print current server environment,
$ resolver env
@@ -264,6 +291,9 @@ Update the server environment by reading JSON from standard input,
$ cat /tmp/env.json | resolver env update -
+
+=== MANAGING HOSTS.D
+
Create new hosts file named "myhosts" inside the hosts.d directory,
$ resolver hosts.d create myhosts
@@ -294,6 +324,9 @@ Get the content of hosts file named "myhosts" inside the hosts.d directory,
}
]
+
+=== MANAGING RECORD IN HOSTS.D
+
Add new record "127.0.0.1 my.hosts" to hosts file named "hosts",
$ resolver hosts.d rr add hosts my.hosts 127.0.0.1