better handling of ipv4 & ipv6
This commit is contained in:
parent
1326a4c162
commit
7a80005c68
1 changed files with 7 additions and 4 deletions
11
node-ipc.js
11
node-ipc.js
|
@ -19,12 +19,14 @@ colors.setTheme(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var IPType=os.networkInterfaces()[
|
||||||
|
Object.keys(os.networkInterfaces())[0]
|
||||||
|
][0].family
|
||||||
|
|
||||||
var defaults={
|
var defaults={
|
||||||
appspace : 'app.',
|
appspace : 'app.',
|
||||||
socketRoot : '/tmp/',
|
socketRoot : '/tmp/',
|
||||||
networkHost : os.networkInterfaces()[
|
networkHost : (IPType=='IPv6')? '::1' : '127.0.0.1',
|
||||||
Object.keys(os.networkInterfaces())[0]
|
|
||||||
][0].address,
|
|
||||||
networkPort : 8000,
|
networkPort : 8000,
|
||||||
id : os.hostname(),
|
id : os.hostname(),
|
||||||
encoding : 'utf8',
|
encoding : 'utf8',
|
||||||
|
@ -32,7 +34,8 @@ var defaults={
|
||||||
maxConnections : 100,
|
maxConnections : 100,
|
||||||
retry : 500,
|
retry : 500,
|
||||||
maxRetries : false,
|
maxRetries : false,
|
||||||
stopRetrying : false
|
stopRetrying : false,
|
||||||
|
IPType : IPType
|
||||||
}
|
}
|
||||||
|
|
||||||
var ipc = {
|
var ipc = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue