@gibme/mikrotik 1.0.2 → 1.1.1

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/index.d.ts CHANGED
@@ -1,8 +1,12 @@
1
1
  import SSH from '@gibme/ssh';
2
2
  import { BandwidthTest, Response } from './types';
3
3
  import Cache from '@gibme/cache/memory';
4
- export type BandwidthTestUpdate = BandwidthTest.Update;
5
- export type BandwidthTestOptions = BandwidthTest.Options;
4
+ export { ConnectConfig } from '@gibme/ssh';
5
+ export type Direction = BandwidthTest.Direction;
6
+ export type Protocol = BandwidthTest.Protocol;
7
+ export type Status = BandwidthTest.Status;
8
+ export type Update = BandwidthTest.Update;
9
+ export type Options = BandwidthTest.Options;
6
10
  export type Address = Response.Address;
7
11
  export type Interface = Response.Interface;
8
12
  export type Route = Response.Route;
@@ -46,7 +50,7 @@ export default class Mikrotik extends SSH {
46
50
  * @param password
47
51
  * @param options
48
52
  */
49
- bandwidth_test(target: string, username: string, password: string, options?: Partial<BandwidthTestOptions>): Promise<BandwidthTestUpdate>;
53
+ bandwidth_test(target: string, username: string, password: string, options?: Partial<Options>): Promise<Update>;
50
54
  /**
51
55
  * Pings the target IP address from the source IP address (if supplied)
52
56
  *
package/dist/index.js CHANGED
@@ -204,7 +204,9 @@ class Mikrotik extends ssh_1.default {
204
204
  best.ip = key;
205
205
  }
206
206
  }
207
- results[best.ip].active = true;
207
+ if (results[best.ip]) {
208
+ results[best.ip].active = true;
209
+ }
208
210
  return results;
209
211
  });
210
212
  }
@@ -338,8 +340,7 @@ class Mikrotik extends ssh_1.default {
338
340
  });
339
341
  }
340
342
  this.on('stream', handleStream);
341
- // set our mutex
342
- yield Mikrotik.cache.set(target, target, options.duration);
343
+ yield Mikrotik.cache.set(target, target, options.duration); // set our mutex
343
344
  yield this.stream(`/tool bandwidth-test protocol=${options.protocol} ` +
344
345
  `user=${username} password=${password} ` +
345
346
  `duration=${options.duration}s direction=${options.direction} ` +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gibme/mikrotik",
3
- "version": "1.0.2",
3
+ "version": "1.1.1",
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.0",
59
+ "@gibme/ssh": "^1.0.1",
60
60
  "@types/ip": "^1.1.3",
61
61
  "ip": "^2.0.1"
62
62
  }