muzhang
let localhost = \'\'
try {
  const network = os.networkInterfaces()
  network[Object.keys(network)[0]].forEach(function(details) {
    if(localhost === \'\' && details.family === \'IPv4\' && !details.internal) {
      localhost = details.address
      return
    }
  });
} catch (e) {
  localhost = \'localhost\';
}

 

分类:

技术点:

相关文章:

  • 2021-10-16
  • 2021-12-09
  • 2021-08-07
  • 2021-11-15
  • 2021-11-05
  • 2021-11-05
  • 2021-11-05
  • 2021-11-05
猜你喜欢
  • 2021-09-25
  • 2021-12-24
  • 2021-08-13
  • 2022-12-23
相关资源
相似解决方案