From 69f34312061d5e5ef853fa28e271d93dbcfbbc6c Mon Sep 17 00:00:00 2001 From: Shulhan Date: Fri, 13 May 2022 22:58:22 +0700 Subject: all: update documentation for resolver Group each command and examples in its own section. --- _doc/resolver.adoc | 20 +++++++++++++++++--- cmd/resolver/main.go | 35 ++++++++++++++++++++++++++++++++++- 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 [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 :: + -- @@ -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 :: + -- @@ -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 :: + -- @@ -180,7 +195,6 @@ If the domain name already exists, the new record will be appended instead of replaced. -- - hosts.d rr delete :: + -- @@ -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 [type] [class] Query the domain or IP address with optional type and/or class. @@ -144,6 +148,9 @@ query [type] [class] Valid class are either IN, CS, HS. Default value is IN. + +=== MANAGING BLOCK.D + block.d disable Disable specific hosts on block.d. @@ -159,6 +166,9 @@ block.d update 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 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 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 Create new hosts file inside the hosts.d directory with specific file @@ -199,6 +215,9 @@ hosts.d get Get the content of hosts file inside the hosts.d directory by file name. + +=== MANAGING RECORD IN HOSTS.D + hosts.d rr add Insert a new record and save it to the hosts file identified by @@ -213,6 +232,8 @@ hosts.d rr delete == 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 -- cgit v1.3