-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathvpn.js
36 lines (32 loc) · 968 Bytes
/
vpn.js
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
'use strict';
class VPN {
constructor(opts) {
this.host = opts.HostName;
this.ip = opts.IP;
this.score = opts.Score;
this.ping = opts.Ping;
this.countryLong = opts.CountryLong;
this.countryShort = opts.CountryShort;
this.numVpnSessions = opts.NumVpnSessions;
this.uptime = opts.Uptime;
this.totalUsers = opts.TotalUsers;
this.totalTraffic = opts.TotalTraffic;
this.logType = opts.LogType;
this.operator = opts.Operator;
this.message = opts.Message;
this.openVPN_ConfigData_Base64 = opts.OpenVPN_ConfigData_Base64;
}
get countryNames() {
const names = [];
if (this.countryShort) names.push(this.countryShort.toLowerCase());
if (this.countryLong) names.push(this.countryLong.toLowerCase());
return names;
}
get config() {
if (!this.openVPN_ConfigData_Base64) {
return null;
}
return Buffer.from(this.openVPN_ConfigData_Base64, 'base64');
}
}
module.exports = VPN;