fix: showing meta fields when available in net.show (ref #66)

This commit is contained in:
evilsocket 2018-02-22 19:08:58 +01:00
commit d6fe8fc663
2 changed files with 51 additions and 30 deletions

View file

@ -42,3 +42,18 @@ func (m *Meta) Get(name string) interface{} {
}
return ""
}
func (m *Meta) Each(cb func(name string, value interface{})) {
m.Lock()
defer m.Unlock()
for k, v := range m.m {
cb(k, v)
}
}
func (m *Meta) Empty() bool {
m.Lock()
defer m.Unlock()
return len(m.m) == 0
}