fix(core): update

This commit is contained in:
2022-02-17 00:03:13 +01:00
parent 068177b09d
commit c308589d28
6 changed files with 83 additions and 3 deletions

View File

@ -1 +1 @@
export * from './smartnetwork.classes.smartnetwork';
export * from './smartnetwork.classes.smartnetwork';

View File

@ -16,6 +16,19 @@ export class SmartNetwork {
return test;
}
public async ping(hostArg: string, timeoutArg: number = 500): Promise<boolean> {
if (process.getuid() !== 0 ) {
console.log('icmp not allowed for nonroot!');
return;
}
const result = await plugins.icmp.ping(hostArg, timeoutArg).catch();
if (result) {
return true;
} else {
return false;
}
}
/**
* returns a promise with a boolean answer
* note: false also resolves with false as argument

View File

@ -13,7 +13,8 @@ export { smartpromise, smartstring };
// @third party scope
const isopen = require('isopen');
import publicIp from 'public-ip';
const icmp = require('icmp');
import * as publicIp from 'public-ip';
import * as systeminformation from 'systeminformation';
export { isopen, publicIp, systeminformation };
export { isopen, icmp, publicIp, systeminformation };