diff --git a/doc/api/os.markdown b/doc/api/os.markdown index eff85200dd..02823acfff 100644 --- a/doc/api/os.markdown +++ b/doc/api/os.markdown @@ -109,7 +109,7 @@ Example inspection of os.cpus: idle: 1072572010, irq: 30 } } ] -### os.getNetworkInterfaces() +### os.networkInterfaces() Get a list of network interfaces: diff --git a/lib/os.js b/lib/os.js index b9b04ec869..fa8ac01513 100644 --- a/lib/os.js +++ b/lib/os.js @@ -29,10 +29,20 @@ exports.totalmem = binding.getTotalMem; exports.cpus = binding.getCPUs; exports.type = binding.getOSType; exports.release = binding.getOSRelease; -exports.getNetworkInterfaces = binding.getInterfaceAddresses; +exports.networkInterfaces = binding.getInterfaceAddresses; exports.arch = function() { return process.arch; }; exports.platform = function() { return process.platform; }; + +var warnNetworkInterfaces = true; +exports.getNetworkInterfaces = function() { + if (warnNetworkInterfaces) { + console.error("os.getNetworkInterfaces() is deprecated - use os.networkInterfaces()"); + console.trace(); + warnNetworkInterfaces = false; + } + return exports.networkInterfaces(); +}; diff --git a/test/simple/test-os.js b/test/simple/test-os.js index 225351ac88..2719382df0 100644 --- a/test/simple/test-os.js +++ b/test/simple/test-os.js @@ -63,7 +63,7 @@ if (process.platform != 'sunos') { } -var interfaces = os.getNetworkInterfaces(); +var interfaces = os.networkInterfaces(); console.error(interfaces); switch (platform) { case 'linux':