refact: refactored api.rest controller

This commit is contained in:
evilsocket 2018-03-13 13:57:52 +01:00
commit cc01a99579
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
2 changed files with 77 additions and 58 deletions

View file

@ -156,6 +156,20 @@ func (w *WiFi) Get(mac string) (*AccessPoint, bool) {
return ap, found
}
func (w *WiFi) GetClient(mac string) (*Station, bool) {
w.Lock()
defer w.Unlock()
mac = NormalizeMac(mac)
for _, ap := range w.aps {
if client, found := ap.Get(mac); found == true {
return client, true
}
}
return nil, false
}
func (w *WiFi) Clear() error {
w.aps = make(map[string]*AccessPoint)
return nil