Comparing version 8.0.0 to 8.1.0
'use strict'; | ||
/*eslint no-magic-numbers: ["error", { "ignore": [ 0] }]*/ | ||
/** | ||
* @module entities | ||
*/ | ||
const os = require('os'); | ||
/** | ||
* @class Defaults | ||
* @description Defaults Entity | ||
*/ | ||
class Defaults{ | ||
/** | ||
* @constructor | ||
* @method constructor | ||
* @return {void} | ||
*/ | ||
constructor(){ | ||
const IPType=os.networkInterfaces()[ | ||
Object.keys(os.networkInterfaces())[0] | ||
][0].family; | ||
@@ -27,3 +40,3 @@ Object.defineProperties( | ||
writable:true, | ||
value:(IPType=='IPv6')? '::1' : '127.0.0.1' | ||
value: '' | ||
}, | ||
@@ -93,3 +106,3 @@ networkPort : { | ||
writable:true, | ||
value:IPType | ||
value: getIPType() | ||
}, | ||
@@ -103,5 +116,27 @@ tls : { | ||
); | ||
this.networkHost = (this.IPType == 'IPv6') ? '::1' : '127.0.0.1'; | ||
} | ||
} | ||
/** | ||
* method to get ip type | ||
* | ||
* @method getIPType | ||
* @return {string} ip type | ||
*/ | ||
function getIPType() { | ||
const networkInterfaces = os.networkInterfaces(); | ||
let IPType = ''; | ||
if (networkInterfaces | ||
&& Array.isArray(networkInterfaces) | ||
&& networkInterfaces.length > 0) { | ||
// getting the family of first network interface available | ||
IPType = networkInterfaces [ | ||
Object.keys( networkInterfaces )[0] | ||
][0].family; | ||
} | ||
return IPType; | ||
} | ||
module.exports=Defaults; |
{ | ||
"name": "node-ipc", | ||
"version": "8.0.0", | ||
"version": "8.1.0", | ||
"description": "A nodejs module for local and remote Inter Process Communication (IPC), Neural Networking, and able to facilitate machine learning.", | ||
@@ -5,0 +5,0 @@ "main": "node-ipc.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
126331
59
2663