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

fix: wrong IP address on iOS #132

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

julian-baumann
Copy link

This should address the issue of iOS devices providing an incorrect IP address.

I've read online, that this approach might not always work, because it is technically not guaranteed, that the default WiFi interface on iOS is named "en0". But practically I haven't had any issues with it.
While this solution might theoretically not work in every case, it represents a quick and practical fix that should prove effective for most iOS devices on most occasions. Compared to the previous situation where the IP address was consistently incorrect, this update should significantly improve the likelihood of obtaining the correct IP address most of the time.
During my testing, the correct IP address was consistently obtained on a variety of iOS devices across multiple Wi-Fi networks. I haven't encountered any problems with this approach so far.

@EstebanBorai EstebanBorai changed the title Fix wrong IP address on iOS fix: wrong IP address on iOS Jan 31, 2024
Copy link
Owner

@EstebanBorai EstebanBorai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @julian-baumann! Thanks for opening this PR, can you give a check on the clippy issues please?

Comment on lines +135 to +137
#[cfg(any(
target_os = "ios"
))]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be condensed into:

Suggested change
#[cfg(any(
target_os = "ios"
))]
#[cfg(target_os = "ios")]

Comment on lines +223 to +225
#[cfg(any(
target_os = "ios"
))]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be condensed into:

Suggested change
#[cfg(any(
target_os = "ios"
))]
#[cfg(target_os = "ios")]

@EstebanBorai
Copy link
Owner

This should address the issue of iOS devices providing an incorrect IP address.

I've read online, that this approach might not always work, because it is technically not guaranteed, that the default WiFi interface on iOS is named "en0". But practically I haven't had any issues with it. While this solution might theoretically not work in every case, it represents a quick and practical fix that should prove effective for most iOS devices on most occasions. Compared to the previous situation where the IP address was consistently incorrect, this update should significantly improve the likelihood of obtaining the correct IP address most of the time. During my testing, the correct IP address was consistently obtained on a variety of iOS devices across multiple Wi-Fi networks. I haven't encountered any problems with this approach so far.

Interesting. Do you think we could have a fallback in case en0 is not found?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants