summaryrefslogtreecommitdiff
path: root/httpd.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-05-29 00:50:05 +0700
committerShulhan <ms@kilabit.info>2022-06-09 23:50:27 +0700
commitb4e49485f815db682def487191c129f8904d85eb (patch)
tree6b790b2e65b493682b0e10253fc028e4fce6c6c1 /httpd.go
parent5c354863c9c6fcc080f2407e6f7adea41fa4371d (diff)
downloadrescached-b4e49485f815db682def487191c129f8904d85eb.tar.xz
go.mod: update to share module v0.38.0
This changes affect the dns Server where all caches related methods has been moved to field Caches.
Diffstat (limited to 'httpd.go')
-rw-r--r--httpd.go24
1 files changed, 12 insertions, 12 deletions
diff --git a/httpd.go b/httpd.go
index 5e59641..e9e9af0 100644
--- a/httpd.go
+++ b/httpd.go
@@ -498,7 +498,7 @@ func (srv *Server) httpApiBlockdFetch(epr *libhttp.EndpointRequest) (resBody []b
func (srv *Server) httpApiCaches(epr *libhttp.EndpointRequest) (resBody []byte, err error) {
var (
res = libhttp.EndpointResponse{}
- answers = srv.dns.CachesLRU()
+ answers = srv.dns.Caches.ExternalLRU()
)
res.Code = http.StatusOK
if len(answers) == 0 {
@@ -531,7 +531,7 @@ func (srv *Server) httpApiCachesSearch(epr *libhttp.EndpointRequest) (resBody []
return nil, &res
}
- listMsg = srv.dns.SearchCaches(re)
+ listMsg = srv.dns.Caches.ExternalSearch(re)
if listMsg == nil {
listMsg = make([]*dns.Message, 0)
}
@@ -556,9 +556,9 @@ func (srv *Server) httpApiCachesDelete(epr *libhttp.EndpointRequest) (resBody []
return nil, &res
}
if q == "all" {
- answers = srv.dns.CachesClear()
+ answers = srv.dns.Caches.ExternalClear()
} else {
- answers = srv.dns.RemoveCachesByNames([]string{q})
+ answers = srv.dns.Caches.ExternalRemoveNames([]string{q})
}
res.Code = http.StatusOK
@@ -751,7 +751,7 @@ func (srv *Server) blockdEnable(hb *Blockd) (err error) {
return fmt.Errorf("%s: %w", logp, err)
}
- err = srv.dns.PopulateCachesByRR(hfile.Records, hfile.Path)
+ err = srv.dns.Caches.InternalPopulateRecords(hfile.Records, hfile.Path)
if err != nil {
return fmt.Errorf("%s: %w", logp, err)
}
@@ -773,7 +773,7 @@ func (srv *Server) blockdDisable(hb *Blockd) (err error) {
return fmt.Errorf("%s: unknown hosts block: %q", logp, hb.Name)
}
- srv.dns.RemoveLocalCachesByNames(hfile.Names())
+ srv.dns.Caches.InternalRemoveNames(hfile.Names())
err = hb.disable()
if err != nil {
@@ -885,7 +885,7 @@ func (srv *Server) apiHostsdDelete(epr *libhttp.EndpointRequest) (resbody []byte
}
// Remove the records associated with hosts file.
- srv.dns.RemoveLocalCachesByNames(hfile.Names())
+ srv.dns.Caches.InternalRemoveNames(hfile.Names())
err = hfile.Delete()
if err != nil {
@@ -1013,7 +1013,7 @@ func (srv *Server) apiHostsdRecordAdd(epr *libhttp.EndpointRequest) (resbody []b
return nil, &res
}
- err = srv.dns.PopulateCachesByRR([]*dns.ResourceRecord{rr}, hostsFileName)
+ err = srv.dns.Caches.InternalPopulateRecords([]*dns.ResourceRecord{rr}, hostsFileName)
if err != nil {
res.Code = http.StatusInternalServerError
res.Message = err.Error()
@@ -1076,7 +1076,7 @@ func (srv *Server) apiHostsdRecordDelete(epr *libhttp.EndpointRequest) (resbody
return nil, &res
}
- srv.dns.RemoveLocalCachesByNames([]string{domainName})
+ srv.dns.Caches.InternalRemoveNames([]string{domainName})
res.Code = http.StatusOK
res.Message = "domain name '" + domainName + "' has been removed from hosts file"
@@ -1190,7 +1190,7 @@ func (srv *Server) apiZonedDelete(epr *libhttp.EndpointRequest) (resb []byte, er
names = append(names, name)
}
- srv.dns.RemoveLocalCachesByNames(names)
+ srv.dns.Caches.InternalRemoveNames(names)
delete(srv.env.Zones, zoneName)
err = zone.Delete()
@@ -1365,7 +1365,7 @@ func (srv *Server) apiZonedRRAdd(epr *libhttp.EndpointRequest) (resb []byte, err
}
listRR = []*dns.ResourceRecord{rr}
- err = srv.dns.PopulateCachesByRR(listRR, zoneFile.Path)
+ err = srv.dns.Caches.InternalPopulateRecords(listRR, zoneFile.Path)
if err != nil {
res.Code = http.StatusBadRequest
res.Message = "PopulateCacheByRR: " + err.Error()
@@ -1485,7 +1485,7 @@ func (srv *Server) apiZonedRRDelete(epr *libhttp.EndpointRequest) (resbody []byt
}
// Remove the RR from caches.
- rr, err = srv.dns.RemoveCachesByRR(rr)
+ rr, err = srv.dns.Caches.InternalRemoveRecord(rr)
if err != nil {
res.Message = err.Error()
return nil, &res