@mytmpvpn/mytmpvpn-common 6.0.2 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/models/vpn.js +3 -2
- package/package.json +1 -1
package/dist/src/models/vpn.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.metricsToClient = exports.vpnToClient = exports.vpnIdToWgFileName = exports.getVpnFrom = exports.newVpn = exports.checkValidConfig = exports.validateVpnNbAgainstQuota = exports.vpnAgainstQuotaPredicate = exports.getVpnConfigTypes = exports.VpnType = exports.fromRank = exports.toRank = exports.VpnState = void 0;
|
|
4
4
|
const errors_1 = require("../errors");
|
|
5
5
|
const peanuts_1 = require("./peanuts");
|
|
6
|
+
const loglevel_1 = require("loglevel");
|
|
6
7
|
var VpnState;
|
|
7
8
|
(function (VpnState) {
|
|
8
9
|
VpnState["Failed"] = "Failed";
|
|
@@ -102,7 +103,7 @@ function checkValidMaxPeanuts(userId, currentBalance, maxPeanuts, vpnConfigLimit
|
|
|
102
103
|
if (Number.isNaN(peanuts) || !Number.isFinite(peanuts)) {
|
|
103
104
|
throw new errors_1.InvalidVpnConfigError(`Config maxPeanuts is invalid: ${maxPeanuts}`);
|
|
104
105
|
}
|
|
105
|
-
|
|
106
|
+
loglevel_1.default.debug(`Validating peanuts for ${userId}, peanuts: ${peanuts}, currentBalance: ${currentBalance}`);
|
|
106
107
|
return validateMaxPeanuts(peanuts, currentBalance, vpnConfigLimits);
|
|
107
108
|
}
|
|
108
109
|
function checkValidVpnType(jsonType) {
|
|
@@ -234,7 +235,7 @@ function vpnIdToWgFileName(vpnId) {
|
|
|
234
235
|
const number = seps[2];
|
|
235
236
|
// Let's make sure the end file is of 15 char max
|
|
236
237
|
const result = `${ddhhmmss}${ccld}${location}${number}`.substring(0, 15);
|
|
237
|
-
|
|
238
|
+
loglevel_1.default.info(`Transforming ${vpnId} to ${result}`);
|
|
238
239
|
return result;
|
|
239
240
|
}
|
|
240
241
|
exports.vpnIdToWgFileName = vpnIdToWgFileName;
|