This repository has been archived on 2024-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
orion/openwrt/wifi_cell.go

32 lines
586 B
Go
Raw Normal View History

package openwrt
import (
"fmt"
"strings"
)
// WifiCell reprensents wifi network Cell
type WifiCell struct {
// The SSID
Ssid string
// The cell mac adress
MacAdress string
}
// NewWifiCell returns a new WifiCell object
func NewWifiCell(ssid string, mac string) *WifiCell {
return &WifiCell{
Ssid: ssid,
MacAdress: mac,
}
}
// GetWifiCells retrieves all availabe wifi cells for a card !
func GetWifiCells(iface string) {
res := run("iwinfo", iface, "scan")
for _, line := range strings.Split(strings.TrimSuffix(res.Stdout, "\n"), "\n") {
fmt.Println(line)
}
}