Skip to content

Commit

Permalink
workaround for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Dec 2, 2024
1 parent e0cb48b commit 78d7963
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions core/utils/net.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
export function localIp(): string | undefined {
for (const info of Deno.networkInterfaces()) {
if (info.family !== "IPv4" || info.address.startsWith("127.")) {
continue;
}
// Try/catch for https://github.com/denoland/deno/issues/25420
try {
for (const info of Deno.networkInterfaces()) {
if (info.family !== "IPv4" || info.address.startsWith("127.")) {
continue;
}

return info.address;
return info.address;
}
} catch {
return undefined;
}
}

0 comments on commit 78d7963

Please sign in to comment.