Clear file-backend hosts cache.

This commit is contained in:
kenshinx 2015-10-20 14:01:41 +08:00
parent 48b8c9a58e
commit 0c1b4738cd

View File

@ -145,6 +145,8 @@ func (f *FileHosts) Refresh() {
}
defer buf.Close()
f.clear()
scanner := bufio.NewScanner(buf)
for scanner.Scan() {
@ -175,6 +177,10 @@ func (f *FileHosts) Refresh() {
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 {
if f.isIP(domain) {
return false