3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

dline: Load DLINEs properly and return proper info

This commit is contained in:
Daniel Oaks 2016-11-04 22:15:14 +10:00
parent c3174bb648
commit 46307dedf2

View File

@ -135,7 +135,7 @@ func (dm *DLineManager) CheckIP(addr net.IP) (isBanned bool, info *IPBanInfo) {
return true, &addrInfo.Info return true, &addrInfo.Info
} }
} else { } else {
return true, nil return true, &addrInfo.Info
} }
} }
@ -155,7 +155,7 @@ func (dm *DLineManager) CheckIP(addr net.IP) (isBanned bool, info *IPBanInfo) {
return true, &addrInfo.Info return true, &addrInfo.Info
} }
} else { } else {
return true, nil return true, &addrInfo.Info
} }
} }
@ -349,6 +349,9 @@ func (s *Server) loadDLines() {
s.store.View(func(tx *buntdb.Tx) error { s.store.View(func(tx *buntdb.Tx) error {
//TODO(dan): We could make this safer //TODO(dan): We could make this safer
tx.AscendKeys("bans.dline *", func(key, value string) bool { tx.AscendKeys("bans.dline *", func(key, value string) bool {
// get address name
key = key[len("bans.dline "):]
// load addr/net // load addr/net
var hostAddr net.IP var hostAddr net.IP
var hostNet *net.IPNet var hostNet *net.IPNet