Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
67682892ae | |||
5c13987686 | |||
97841e0973 | |||
c8ccde9d84 | |||
654a4c6b54 |
10646
package-lock.json
generated
10646
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartnetwork",
|
"name": "@pushrocks/smartnetwork",
|
||||||
"version": "1.1.16",
|
"version": "1.1.19",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "network diagnostics",
|
"description": "network diagnostics",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -12,21 +12,21 @@
|
|||||||
"build": "(tsbuild)"
|
"build": "(tsbuild)"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.17",
|
"@gitzone/tsbuild": "^2.1.25",
|
||||||
"@gitzone/tstest": "^1.0.28",
|
"@gitzone/tstest": "^1.0.43",
|
||||||
"@pushrocks/tapbundle": "^3.2.0",
|
"@pushrocks/tapbundle": "^3.2.9",
|
||||||
"tslint": "^5.20.1",
|
"tslint": "^5.20.1",
|
||||||
"tslint-config-prettier": "^1.18.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartpromise": "^3.0.6",
|
"@pushrocks/smartpromise": "^3.0.6",
|
||||||
"@pushrocks/smartstring": "^3.0.14",
|
"@pushrocks/smartstring": "^3.0.18",
|
||||||
"@types/default-gateway": "^3.0.0",
|
"@types/default-gateway": "^3.0.1",
|
||||||
"@types/portscanner": "^2.1.0",
|
|
||||||
"default-gateway": "^5.0.5",
|
"default-gateway": "^5.0.5",
|
||||||
"portscanner": "^2.2.0",
|
"isopen": "^1.3.0",
|
||||||
|
"public-ip": "^4.0.2",
|
||||||
"speedtest-net": "^1.6.0",
|
"speedtest-net": "^1.6.0",
|
||||||
"systeminformation": "^4.15.3"
|
"systeminformation": "^4.26.10"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
|
@ -34,4 +34,9 @@ tap.test('should get the default gateway', async () => {
|
|||||||
console.log(gatewayResult);
|
console.log(gatewayResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test('should get public ips', async () => {
|
||||||
|
const ips = await testSmartNetwork.getPublicIps();
|
||||||
|
console.log(ips);
|
||||||
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
@ -114,12 +114,9 @@ export class SmartNetwork {
|
|||||||
const domainPart = domainArg.split(':')[0];
|
const domainPart = domainArg.split(':')[0];
|
||||||
const port = portArg ? portArg : parseInt(domainArg.split(':')[1], 10);
|
const port = portArg ? portArg : parseInt(domainArg.split(':')[1], 10);
|
||||||
|
|
||||||
plugins.portscanner.checkPortStatus(port, domainPart, (err, status) => {
|
plugins.isopen(domainPart, port, (response) => {
|
||||||
if (err) {
|
console.log(response);
|
||||||
// console.log(err);
|
if (response[port.toString()].isOpen) {
|
||||||
return done.resolve(false);
|
|
||||||
}
|
|
||||||
if (status === 'open') {
|
|
||||||
done.resolve(true);
|
done.resolve(true);
|
||||||
} else {
|
} else {
|
||||||
done.resolve(false);
|
done.resolve(false);
|
||||||
@ -150,4 +147,13 @@ export class SmartNetwork {
|
|||||||
ipv6: defaultGateway[1]
|
ipv6: defaultGateway[1]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async getPublicIps () {
|
||||||
|
return {
|
||||||
|
v4: await plugins.publicIp.v4({
|
||||||
|
timeout: 1000,
|
||||||
|
onlyHttps: true
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,9 @@ import * as smartstring from '@pushrocks/smartstring';
|
|||||||
export { smartpromise, smartstring };
|
export { smartpromise, smartstring };
|
||||||
|
|
||||||
// @third party scope
|
// @third party scope
|
||||||
import * as portscanner from 'portscanner';
|
import isopen from 'isopen';
|
||||||
|
import publicIp from 'public-ip';
|
||||||
import speedtestNet from 'speedtest-net';
|
import speedtestNet from 'speedtest-net';
|
||||||
import * as systeminformation from 'systeminformation';
|
import * as systeminformation from 'systeminformation';
|
||||||
|
|
||||||
export { speedtestNet, portscanner, systeminformation };
|
export { isopen, publicIp, speedtestNet, systeminformation };
|
||||||
|
Reference in New Issue
Block a user