aboutsummaryrefslogtreecommitdiff
path: root/lib/dns/server.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-04-15 02:27:31 +0700
committerShulhan <ms@kilabit.info>2022-04-15 02:27:31 +0700
commitceba0704c6fcc2c3dd82876f6c45a3b24fe98fd6 (patch)
tree0d4e5ed7369eb990bf0f7876c4062c92c5bc50f9 /lib/dns/server.go
parent86c787c31de4a1c21414ee8b710276f76896f272 (diff)
downloadpakakeh.go-ceba0704c6fcc2c3dd82876f6c45a3b24fe98fd6.tar.xz
lib/dns: add method CachesClear to remove all caches
Diffstat (limited to 'lib/dns/server.go')
-rw-r--r--lib/dns/server.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/dns/server.go b/lib/dns/server.go
index 3c1f865f..96acb435 100644
--- a/lib/dns/server.go
+++ b/lib/dns/server.go
@@ -11,6 +11,7 @@ import (
"fmt"
"io"
"log"
+ "math"
"net"
"net/http"
"regexp"
@@ -249,6 +250,14 @@ func (srv *Server) PopulateCachesByRR(listRR []*ResourceRecord, from string) (
}
//
+// CachesClear remove all caches.
+//
+func (srv *Server) CachesClear() (listAnswer []*Answer) {
+ listAnswer = srv.caches.prune(math.MaxInt64)
+ return listAnswer
+}
+
+//
// RemoveCachesByNames remove the caches by domain names.
//
func (srv *Server) RemoveCachesByNames(names []string) (listAnswer []*Answer) {