Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include IP address for all available interfaces in connection info #52

Closed
respectTheCode opened this issue Apr 9, 2019 · 15 comments · Fixed by #256
Closed

Include IP address for all available interfaces in connection info #52

respectTheCode opened this issue Apr 9, 2019 · 15 comments · Fixed by #256
Labels
enhancement New feature or request released

Comments

@respectTheCode
Copy link

Describe the Feature

The connection info should include the IP address for all connected network interfaces (cellular, wifi, wired, vpn?)

Possible Implementations

Add a map of network interface and their IP addresses to the connection info.

Related Issues

react-native-device-info/react-native-device-info#635
#51

@respectTheCode respectTheCode added the enhancement New feature or request label Apr 9, 2019
@matt-oakes
Copy link
Collaborator

👋 Thanks for the request. I have added some notes below to help with future implementation:


Android: Use a method like this but maybe using getHostAddress to support ipv6 addresses.

iOS: Use a method to get the IP address, like this.

@mikehardy
Copy link
Contributor

mikehardy commented Apr 22, 2019

react-native-device-info does like the link you mentioned for android - deployed code: https://github.com/react-native-community/react-native-device-info/blob/master/android/src/main/java/com/learnium/RNDeviceInfo/RNDeviceModule.java#L67

@mikehardy
Copy link
Contributor

@respectTheCode
Copy link
Author

react-native-device-info only returns the WiFi IP and ignores all other network interfaces. It could easily be added to react-native-device-info but it was decided that it should be added here instead. See the link under related issues.

@mikehardy
Copy link
Contributor

@respectTheCode I know, I'm the react-native-device-info guy :-), I was just trying to offer a hot link to the code we have as I try to work with @matt-oakes so that netinfo is more awesome than device-info was in this area. 🤞

@respectTheCode
Copy link
Author

any update on this?

@matt-oakes
Copy link
Collaborator

@respectTheCode If there's no post here, there is no update on it. Contributions are always welcome 🙂

@matt-oakes
Copy link
Collaborator

Android and iOS support added in #122 🎉

@respectTheCode
Copy link
Author

This still only includes the IP address for en0

@matt-oakes
Copy link
Collaborator

@respectTheCode That was outside the scope of the initial PR. Feel free to send one over to add support for the other network interfaces.

@respectTheCode
Copy link
Author

This ticket shouldn't be closed as it wasn't resolved

@mikehardy
Copy link
Contributor

You have a point, as originally stated the ticket was to support the rest of the network interfaces. The title is misleading. I believe it still lacks a motivated person to make the PR though

@mikehardy mikehardy reopened this Sep 3, 2019
@mikehardy mikehardy changed the title Include IP address in connection info Include IP address for all available interfaces in connection info Sep 3, 2019
@matt-oakes
Copy link
Collaborator

Thanks @mikehardy, you are right that the title miss-lead me.

@respectTheCode You clearly need this feature. Are you able to submit a pull request to add support for it? It's not a feature I personally need so the likelihood that I'll write it myself it basically 0%. Please let me know if you need some pointers on where to start with making a pull request to add this feature 🙂 I can give you some pointers on where to make the modifications.

@mikehardy
Copy link
Contributor

I would say the react-native-network-info package has a stronger implementation of this feature if it is a requirement for you, in their getIPV4Address method: https://github.com/pusherman/react-native-network-info/blob/master/ios/RNNetworkInfo.m#L168 / https://github.com/pusherman/react-native-network-info/blob/master/android/src/main/java/com/pusherman/networkinfo/RNNetworkInfo.java#L140 - this could be the basis of implementation as well

In fact @matt-oakes you might want to see if you and @pusherman want to collaborate - seems like an API surface area duplication and potential to perhaps have multiple active maintainers in one repo?

@react-native-community-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 5.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants