fix(core): update
This commit is contained in:
@ -1 +1 @@
|
||||
export * from './smartnetwork.classes.smartnetwork';
|
||||
export * from './smartnetwork.classes.smartnetwork';
|
@ -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
|
||||
|
@ -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 };
|
||||
|
Reference in New Issue
Block a user