Compare commits

...

7 Commits

Author SHA1 Message Date
67682892ae 1.1.19 2020-08-12 16:29:04 +00:00
5c13987686 fix(core): update 2020-08-12 16:29:03 +00:00
97841e0973 1.1.18 2019-11-23 19:33:49 +00:00
c8ccde9d84 1.1.17 2019-11-23 16:07:05 +00:00
654a4c6b54 fix(core): update 2019-11-23 16:07:04 +00:00
12b8793c19 1.1.16 2019-11-19 23:01:22 +00:00
24e861e5b4 fix(security): add snyk config 2019-11-19 23:01:21 +00:00
6 changed files with 9921 additions and 801 deletions

4
.snyk Normal file
View File

@ -0,0 +1,4 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.13.5
ignore: {}
patch: {}

10672
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartnetwork",
"version": "1.1.15",
"version": "1.1.19",
"private": false,
"description": "network diagnostics",
"main": "dist/index.js",
@ -12,21 +12,21 @@
"build": "(tsbuild)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.17",
"@gitzone/tstest": "^1.0.28",
"@pushrocks/tapbundle": "^3.2.0",
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tstest": "^1.0.43",
"@pushrocks/tapbundle": "^3.2.9",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0"
},
"dependencies": {
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartstring": "^3.0.14",
"@types/default-gateway": "^3.0.0",
"@types/portscanner": "^2.1.0",
"@pushrocks/smartstring": "^3.0.18",
"@types/default-gateway": "^3.0.1",
"default-gateway": "^5.0.5",
"portscanner": "^2.2.0",
"isopen": "^1.3.0",
"public-ip": "^4.0.2",
"speedtest-net": "^1.6.0",
"systeminformation": "^4.15.3"
"systeminformation": "^4.26.10"
},
"files": [
"ts/**/*",

View File

@ -34,4 +34,9 @@ tap.test('should get the default gateway', async () => {
console.log(gatewayResult);
});
tap.test('should get public ips', async () => {
const ips = await testSmartNetwork.getPublicIps();
console.log(ips);
});
tap.start();

View File

@ -114,12 +114,9 @@ export class SmartNetwork {
const domainPart = domainArg.split(':')[0];
const port = portArg ? portArg : parseInt(domainArg.split(':')[1], 10);
plugins.portscanner.checkPortStatus(port, domainPart, (err, status) => {
if (err) {
// console.log(err);
return done.resolve(false);
}
if (status === 'open') {
plugins.isopen(domainPart, port, (response) => {
console.log(response);
if (response[port.toString()].isOpen) {
done.resolve(true);
} else {
done.resolve(false);
@ -150,4 +147,13 @@ export class SmartNetwork {
ipv6: defaultGateway[1]
};
}
public async getPublicIps () {
return {
v4: await plugins.publicIp.v4({
timeout: 1000,
onlyHttps: true
})
};
}
}

View File

@ -10,8 +10,9 @@ import * as smartstring from '@pushrocks/smartstring';
export { smartpromise, smartstring };
// @third party scope
import * as portscanner from 'portscanner';
import isopen from 'isopen';
import publicIp from 'public-ip';
import speedtestNet from 'speedtest-net';
import * as systeminformation from 'systeminformation';
export { speedtestNet, portscanner, systeminformation };
export { isopen, publicIp, speedtestNet, systeminformation };