NetIP randomly shows IPv4 and IPv6

Mandatory information

  • NetIP Version: 0.1.0
  • Operating System Version: Windows 10 10.0.19044.0

Summary

Randomly shows IP v4 in both the IPv4 and the IPv6. Then randomly show IPv6 both in IPv4 and IPv6.

Steps to reproduce

Open the application, randomly shows different results.

Expected result

Show IPv4 and IPv6 in their appropriate positions.

Current result

Relevant logs and/or screenshots

NetIP_6ulJ4ucnFF

Additional context

Possible fixes

NetIP_OFaYcqjGV3

another screenshot, as new users can’t do two in a post

Hello and thanks for submitting this issue!

This is an odd one… NetIP uses icanhazip.com to obtain the computer’s public IP.

It specifically uses ipv4.icanhazip.com and ipv6.icanhazip.com to respectively get the IPv4 and IPv6. It shouldn’t be able to output v4 instead of v6 and vice versa.

Could you check what these links return in a web browser to see if they have the same issue?

After searching a bit, I found these old issues on the icanhazip archive repo that could be related to your issue:

icanhazip is owned & maintained by Cloudflare since 2021 (blog post annoucement). I don’t know what Cloudflare did on the code since then, and I can’t reproduce the error on my end, unfortunately.

I see 3 possible fixes:

  • Check the format of the string returned by the request. If it contains dots . where we expected IPv6 or if it contains : where we expected IPv4, don’t display the incorrect value. It’s an easy regex fix that could do the job.
  • Force each HttpClient request to use respectively IPv4 or IPv6. (Example). Not sure if it’ll help if the provider is returning the incorrect the value anyway.
  • Customize Public IP Providers. It’s a planned feature that would mitigate the issue if icanhazip is struggling to return the correct public ip.

Hey! Thank you for your response.

Today I can’t reproduce the bug, the browser returns the correct ip, and NetIP returns the correct ip in the appropriate position no matter how many times I refresh. So, that makes me think that is an API issue? According to the forum posts it is quite sporadic…

Could I ask for a feature request? If you change the API, a nice feature I could not find in other apps for Windows. The geo based country flag shown somewhere in the app or even instead of the icon. Just like Display my ip for MacOS does
https://apps.apple.com/us/app/display-my-ip/id1493408723?mt=12
or this app for Linux: https://github.com/icamys/locindicator

Yep, it confirms what I thought. The problem is probably on the icanhazip side. I’m validating this issue nonetheless to implement the two first fixes I suggested earlier. It will be fixed for v0.2.0. Customized Public IP Providers will come in another next patch. :wink:

Bug validated.

Issue #7 on the repository tracker.


That’s a great idea! I’m continuing the discussion about it in Customize Public IP Providers to avoid off-topic.

1 Like

Bug completed & merged into branch develop.

Scheduled for release v0.2.0.