Skip to content

Commit

Permalink
获取内网IP时,检查family范围放宽点
Browse files Browse the repository at this point in the history
node18这个接口的结果类型有了一些变化,兼容一下比较好,参考 http://nodejs.cn/api/os/os_networkinterfaces.html
  • Loading branch information
tourze authored and ZakaryCode committed Jul 18, 2022
1 parent e4e8de5 commit b251d7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/taro-rn-runner/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function getOpenHost () {
for (const devName in interfaces) {
const isEnd = interfaces[devName]?.some(item => {
// 取IPv4, 不为127.0.0.1的内网ip
if (item.family === 'IPv4' && item.address !== '127.0.0.1' && !item.internal) {
if (['IPv4', 4, '4'].includes(item.family) && item.address !== '127.0.0.1' && !item.internal) {
result = item.address
return true
}
Expand Down

0 comments on commit b251d7a

Please sign in to comment.