forked from theojulienne/go-wireless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ap.go
29 lines (24 loc) · 735 Bytes
/
ap.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package wireless
import "net"
// AP represents an access point seen by the scan networks command
type AP struct {
ID int `json:"id"`
RSSI int `json:"rssi"`
BSSID net.HardwareAddr `json:"bssid"`
SSID string `json:"ssid"`
ESSID string `json:"essid"`
Flags []string `json:"flags"`
Signal int `json:"signal"`
Frequency int `json:"frequency"`
}
// APs models a collection of access points
type APs []AP
// FindBySSID will find an AP by the given SSID or return false
func (nets APs) FindBySSID(ssid string) (AP, bool) {
for _, n := range nets {
if n.SSID == ssid {
return n, true
}
}
return AP{}, false
}