Skip to content

Commit

Permalink
Merge pull request #78 from Peergos/fix/android-compatibility
Browse files Browse the repository at this point in the history
use alternate method to list network interfaces
  • Loading branch information
ianopolous authored Nov 20, 2023
2 parents 78528a7 + 0205f45 commit 210237f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/org/peergos/protocol/IdentifyBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static List<Multiaddr> expandWildcardAddresses(Multiaddr addr) {

public static List<Multiaddr> listNetworkAddresses(boolean includeIp6, Multiaddr addr) {
try {
return NetworkInterface.networkInterfaces()
return Collections.list(NetworkInterface.getNetworkInterfaces()).stream()
.flatMap(net -> net.getInterfaceAddresses().stream()
.map(InterfaceAddress::getAddress)
.filter(ip -> includeIp6 || ip instanceof Inet4Address))
Expand Down

0 comments on commit 210237f

Please sign in to comment.