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

@ -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