aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-04-01 16:11:24 +0700
committerShulhan <ms@kilabit.info>2023-04-01 16:15:08 +0700
commit3e188c30249222b58504ca87da66564b31f63d11 (patch)
treeb3a4b8ecb11e73d6304d587c97894f77acae9325
parent482ff43bdd061d194875920f43ae335a69053946 (diff)
downloadrescached-3e188c30249222b58504ca87da66564b31f63d11.tar.xz
all: update go doc comments
While at it, use "_" for unused parameter on methods.
-rw-r--r--blockd.go1
-rw-r--r--client.go3
-rw-r--r--cmd/rescached/main.go6
-rw-r--r--cmd/resolver/doc.go2
-rw-r--r--cmd/resolver/main.go5
-rw-r--r--cmd/resolverbench/main.go1
-rw-r--r--httpd.go8
-rw-r--r--rescached.go5
8 files changed, 19 insertions, 12 deletions
diff --git a/blockd.go b/blockd.go
index 398bb96..f1d4b9b 100644
--- a/blockd.go
+++ b/blockd.go
@@ -18,6 +18,7 @@ const (
lastUpdatedFormat = "2006-01-02 15:04:05 MST"
)
+// Blockd define the container for each block.d section in configuration.
type Blockd struct {
lastUpdated time.Time
diff --git a/client.go b/client.go
index 3ac35e4..34e7137 100644
--- a/client.go
+++ b/client.go
@@ -176,6 +176,7 @@ func (cl *Client) Caches() (answers []*dns.Answer, err error) {
return answers, nil
}
+// CachesRemove request to remove caches by its domain name.
func (cl *Client) CachesRemove(q string) (listAnswer []*dns.Answer, err error) {
var (
logp = "CachesRemove"
@@ -523,7 +524,7 @@ func (cl *Client) ZonedDelete(name string) (zone *dns.Zone, err error) {
return zone, nil
}
-// ZoneRecords fetch the zone records by its name.
+// ZonedRecords fetch the zone records by its name.
func (cl *Client) ZonedRecords(zone string) (zoneRecords dns.ZoneRecords, err error) {
var (
logp = "ZonedRecords"
diff --git a/cmd/rescached/main.go b/cmd/rescached/main.go
index 6173943..e94be5e 100644
--- a/cmd/rescached/main.go
+++ b/cmd/rescached/main.go
@@ -1,6 +1,12 @@
// SPDX-FileCopyrightText: 2018 M. Shulhan <ms@kilabit.info>
// SPDX-License-Identifier: GPL-3.0-or-later
+// Program rescached server that caching internet name and address on local
+// memory for speeding up DNS resolution.
+//
+// Rescached primary goal is only to caching DNS queries and answers, used by
+// personal or small group of users, to minimize unneeded traffic to outside
+// network.
package main
import (
diff --git a/cmd/resolver/doc.go b/cmd/resolver/doc.go
index 03222c0..8396dec 100644
--- a/cmd/resolver/doc.go
+++ b/cmd/resolver/doc.go
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
/*
-Command resolver is command line interface (CLI) for DNS and rescached server.
+Program resolver is command line interface (CLI) for DNS and rescached server.
# SYNOPSIS
diff --git a/cmd/resolver/main.go b/cmd/resolver/main.go
index c8e5fe7..848d679 100644
--- a/cmd/resolver/main.go
+++ b/cmd/resolver/main.go
@@ -36,9 +36,8 @@ const (
subCmdUpdate = "update"
)
-var (
- Usage string // Contains usage of program, overwritten by build.
-)
+// Usage of program, overwritten by build.
+var Usage string
func main() {
var (
diff --git a/cmd/resolverbench/main.go b/cmd/resolverbench/main.go
index 3e35e24..0821d29 100644
--- a/cmd/resolverbench/main.go
+++ b/cmd/resolverbench/main.go
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: 2018 M. Shulhan <ms@kilabit.info>
// SPDX-License-Identifier: GPL-3.0-or-later
+// Program resolverbench program to benchmark DNS server or resolver.
package main
import (
diff --git a/httpd.go b/httpd.go
index 4a19e19..4a13524 100644
--- a/httpd.go
+++ b/httpd.go
@@ -331,7 +331,7 @@ func (srv *Server) httpdRun() {
// ...
// }
// }
-func (srv *Server) httpApiBlockdList(epr *libhttp.EndpointRequest) (resBody []byte, err error) {
+func (srv *Server) httpApiBlockdList(_ *libhttp.EndpointRequest) (resBody []byte, err error) {
var (
res = libhttp.EndpointResponse{}
)
@@ -495,7 +495,7 @@ func (srv *Server) httpApiBlockdFetch(epr *libhttp.EndpointRequest) (resBody []b
return json.Marshal(&res)
}
-func (srv *Server) httpApiCaches(epr *libhttp.EndpointRequest) (resBody []byte, err error) {
+func (srv *Server) httpApiCaches(_ *libhttp.EndpointRequest) (resBody []byte, err error) {
var (
res = libhttp.EndpointResponse{}
answers = srv.dns.Caches.ExternalLRU()
@@ -580,7 +580,7 @@ func (srv *Server) httpApiCachesDelete(epr *libhttp.EndpointRequest) (resBody []
// {
// "data": <Environment>
// }
-func (srv *Server) httpApiEnvironmentGet(epr *libhttp.EndpointRequest) (resBody []byte, err error) {
+func (srv *Server) httpApiEnvironmentGet(_ *libhttp.EndpointRequest) (resBody []byte, err error) {
var (
res = libhttp.EndpointResponse{}
)
@@ -1138,7 +1138,7 @@ func (srv *Server) apiHostsdRecordDelete(epr *libhttp.EndpointRequest) (resbody
// ...
// }
// }
-func (srv *Server) apiZoned(epr *libhttp.EndpointRequest) (resb []byte, err error) {
+func (srv *Server) apiZoned(_ *libhttp.EndpointRequest) (resb []byte, err error) {
var (
res = libhttp.EndpointResponse{}
)
diff --git a/rescached.go b/rescached.go
index 494c936..c0ee3de 100644
--- a/rescached.go
+++ b/rescached.go
@@ -17,9 +17,8 @@ import (
"github.com/shuLhan/share/lib/memfs"
)
-var (
- Version = `4.4.0` // Contains version of program, overwritten by build.
-)
+// Version of program, overwritten by build.
+var Version = `4.4.0`
// Server implement caching DNS server.
type Server struct {