-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrouterprovider.mjs
57 lines (50 loc) · 1.18 KB
/
routerprovider.mjs
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
/**
* Extend this class for each router implementation
*/
class RouterProvider {
constructor(config) {}
/**
* @returns A Promise that returns the open connection needed to make the actual lookups or rejected if the login fails
*/
async connect() {
return [];
}
/**
* @returns A Promise with lists of RouterInterface's from the router or rejected with an error
*/
async getInterfaces(session) {
return [];
}
/**
* Cleans up what is needed and closes the connection
*/
async disconnect(session) {
}
}
class RouterInterface {
constructor(type, isProtected, ssid, clients) {
this.type = type;
this.isProtected = isProtected;
this.ssid = ssid;
this.clients = clients;
}
}
class RouterClient {
constructor(macAddress, name) {
this.macAddress = macAddress;
this.name = name;
}
}
const RouterInterfaceType = {
WIFI_2_4G : "WIFI_2_4G",
WIFI_5G : "WIFI_5G",
GUEST_WIFI_2_4G : "GUEST_WIFI_2_4G",
GUEST_WIFI_5G : "GUEST_WIFI_5G",
WIRED : "WIRED"
}
export {
RouterProvider,
RouterInterface,
RouterClient,
RouterInterfaceType
};