chore: resolve external IP with just an http request#8516
Merged
Conversation
mattsse
approved these changes
May 30, 2024
Collaborator
mattsse
left a comment
There was a problem hiding this comment.
fine with removing igd-next, don't think this is actually useful.
I also, don't think we really need DNS queries
crates/net/nat/src/lib.rs
Outdated
Comment on lines
+183
to
+186
| let response = reqwest::get("http://ipinfo.io/ip").await.ok()?; | ||
| let response = response.error_for_status().ok()?; | ||
| let text = response.text().await.ok()?; | ||
| text.trim().parse().ok() |
Collaborator
There was a problem hiding this comment.
public_ip::addr does a bit more than that, for example DNS queries
but we can add support natively I think, and this should be sufficient
but can we do "http://bot.whatismyipaddress.com" as well? then we're on par with public_ip for the HTTP part at least
turns out this API was shut down:
Member
Author
There was a problem hiding this comment.
public_ip::addr does a bit more than that, for example DNS queries
yes would be nice if it was maintained tho :D
3379521 to
05ead79
Compare
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes two dependencies used solely for getting the external IP:
which will be duplicating old versions of reqwest, hyper and http after #7018