forked from mdlayher/wifi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.go
79 lines (64 loc) · 2.1 KB
/
client.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package wifi
import (
"time"
)
// A Client is a type which can access WiFi device actions and statistics
// using operating system-specific operations.
type Client struct {
c *client
}
// New creates a new Client.
func New() (*Client, error) {
c, err := newClient()
if err != nil {
return nil, err
}
return &Client{
c: c,
}, nil
}
// Close releases resources used by a Client.
func (c *Client) Close() error {
return c.c.Close()
}
// Connect starts connecting the interface to the specified ssid.
func (c *Client) Connect(ifi *Interface, ssid string) error {
return c.c.Connect(ifi, ssid)
}
// Dissconnect disconnects the interface.
func (c *Client) Disconnect(ifi *Interface) error {
return c.c.Disconnect(ifi)
}
// Connect starts connecting the interface to the specified ssid using WPA.
func (c *Client) ConnectWPAPSK(ifi *Interface, ssid, psk string) error {
return c.c.ConnectWPAPSK(ifi, ssid, psk)
}
// Interfaces returns a list of the system's WiFi network interfaces.
func (c *Client) Interfaces() ([]*Interface, error) {
return c.c.Interfaces()
}
// BSS retrieves the BSS associated with a WiFi interface.
func (c *Client) BSS(ifi *Interface) (*BSS, error) {
return c.c.BSS(ifi)
}
// StationInfo retrieves all station statistics about a WiFi interface.
//
// Since v0.2.0: if there are no stations, an empty slice is returned instead
// of an error.
func (c *Client) StationInfo(ifi *Interface) ([]*StationInfo, error) {
return c.c.StationInfo(ifi)
}
// SurveyInfo retrieves the survey information about a WiFi interface.
func (c *Client) SurveyInfo(ifi *Interface) ([]*SurveyInfo, error) { return c.c.SurveyInfo(ifi) }
// SetDeadline sets the read and write deadlines associated with the connection.
func (c *Client) SetDeadline(t time.Time) error {
return c.c.SetDeadline(t)
}
// SetReadDeadline sets the read deadline associated with the connection.
func (c *Client) SetReadDeadline(t time.Time) error {
return c.c.SetReadDeadline(t)
}
// SetWriteDeadline sets the write deadline associated with the connection.
func (c *Client) SetWriteDeadline(t time.Time) error {
return c.c.SetWriteDeadline(t)
}