Clear file-backend hosts cache.
This commit is contained in:
parent
48b8c9a58e
commit
0c1b4738cd
6
hosts.go
6
hosts.go
@ -145,6 +145,8 @@ func (f *FileHosts) Refresh() {
|
|||||||
}
|
}
|
||||||
defer buf.Close()
|
defer buf.Close()
|
||||||
|
|
||||||
|
f.clear()
|
||||||
|
|
||||||
scanner := bufio.NewScanner(buf)
|
scanner := bufio.NewScanner(buf)
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
|
|
||||||
@ -175,6 +177,10 @@ func (f *FileHosts) Refresh() {
|
|||||||
logger.Debug("update hosts records from %s", f.file)
|
logger.Debug("update hosts records from %s", f.file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *FileHosts) clear() {
|
||||||
|
f.hosts = make(map[string]string)
|
||||||
|
}
|
||||||
|
|
||||||
func (f *FileHosts) isDomain(domain string) bool {
|
func (f *FileHosts) isDomain(domain string) bool {
|
||||||
if f.isIP(domain) {
|
if f.isIP(domain) {
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user