@gibme/mikrotik 1.1.1 → 1.1.2

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -8
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -54,16 +54,21 @@ class Mikrotik extends ssh_1.default {
54
54
  const address = _network[0];
55
55
  const cidr = parseInt(_network[1]);
56
56
  const [gateway, iface] = (() => {
57
- if (route.gateway.includes('%')) {
58
- return route.gateway.split('%', 2);
59
- }
60
- else if (ip_1.default.isV4Format(route.gateway)) {
61
- const ip = ips.filter(ip => ip.isLocal(route.gateway)).shift();
62
- return [route.gateway, ip === null || ip === void 0 ? void 0 : ip.iface];
57
+ if (route.gateway) {
58
+ if (route.gateway.includes('%')) {
59
+ return route.gateway.split('%', 2);
60
+ }
61
+ else if (ip_1.default.isV4Format(route.gateway)) {
62
+ const ip = ips.filter(ip => ip.isLocal(route.gateway)).shift();
63
+ return [route.gateway, ip === null || ip === void 0 ? void 0 : ip.iface];
64
+ }
65
+ else {
66
+ const ip = ips.filter(ip => ip.iface === route.gateway).shift();
67
+ return [ip === null || ip === void 0 ? void 0 : ip.ipaddress, route.gateway];
68
+ }
63
69
  }
64
70
  else {
65
- const ip = ips.filter(ip => ip.iface === route.gateway).shift();
66
- return [ip === null || ip === void 0 ? void 0 : ip.ipaddress, route.gateway];
71
+ return [undefined, undefined];
67
72
  }
68
73
  })();
69
74
  const distance = parseInt(route.distance);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gibme/mikrotik",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "A simple mikrotik helper/wrapper",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "@gibme/cache": "^1.1.5",
59
- "@gibme/ssh": "^1.0.1",
59
+ "@gibme/ssh": "^1.0.2",
60
60
  "@types/ip": "^1.1.3",
61
61
  "ip": "^2.0.1"
62
62
  }