client: imp code
This commit is contained in:
parent
548a15c000
commit
025c29bcd2
|
@ -146,8 +146,8 @@ func (r *Runtime) SetWHOIS(info *whois.Info) {
|
|||
r.whois = info
|
||||
}
|
||||
|
||||
// Unset clears a cs information.
|
||||
func (r *Runtime) Unset(cs Source) {
|
||||
// unset clears a cs information.
|
||||
func (r *Runtime) unset(cs Source) {
|
||||
switch cs {
|
||||
case SourceWHOIS:
|
||||
r.whois = nil
|
||||
|
@ -162,8 +162,8 @@ func (r *Runtime) Unset(cs Source) {
|
|||
}
|
||||
}
|
||||
|
||||
// IsEmpty returns true if there is no information from any source.
|
||||
func (r *Runtime) IsEmpty() (ok bool) {
|
||||
// isEmpty returns true if there is no information from any source.
|
||||
func (r *Runtime) isEmpty() (ok bool) {
|
||||
return r.whois == nil &&
|
||||
r.arp == nil &&
|
||||
r.rdns == nil &&
|
||||
|
|
|
@ -51,9 +51,9 @@ func (ri *RuntimeIndex) Delete(ip netip.Addr) {
|
|||
// the specified source and returns the number of removed clients.
|
||||
func (ri *RuntimeIndex) DeleteBySource(src Source) (n int) {
|
||||
for ip, rc := range ri.index {
|
||||
rc.Unset(src)
|
||||
rc.unset(src)
|
||||
|
||||
if rc.IsEmpty() {
|
||||
if rc.isEmpty() {
|
||||
delete(ri.index, ip)
|
||||
n++
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue