fix(network): fix stun error on startup if no network available

Fixed #7
This commit is contained in:
Alexey Kasyanchuk
2018-03-04 00:21:29 +03:00
parent 5832626fd2
commit 3bed2b13cb
3 changed files with 27 additions and 11 deletions

View File

@ -0,0 +1,10 @@
// https://stackoverflow.com/questions/15270902/check-for-internet-connectivity-in-nodejs
module.exports = function checkInternet(cb) {
require('dns').lookup('google.com',function(err) {
if (err && err.code == "ENOTFOUND") {
cb(false);
} else {
cb(true);
}
})
}