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

net: consider dns addresses as public #220

Merged
merged 4 commits into from
Sep 14, 2023
Merged

Conversation

sukunrt
Copy link
Member

@sukunrt sukunrt commented Sep 7, 2023

This resolves the discussion here: libp2p/go-libp2p#2553 (review)

For some users this might cause unexpected behaviour e.g. here it looks like the user does want this function to return true only for IP addresses. I can imagine there are some others who want this.

Most of the cases I eyeballed are not affected by this change and in some cases are positively impacted as they do expect dns addresses to pass this check.

Ideally it'd have been nicer if the existing method was IsPublicIPAddr and so we could just add IsPublicAddr with this behaviour.

The suffix check is not too expensive. The method takes 90-100ns with IP addresses. It takes 125ns with dns addresses on my m1 macbook.

@sukunrt
Copy link
Member Author

sukunrt commented Sep 13, 2023

I've fixed the list of reserved names.

I'm rejecting all reverse dns lookup addresses because they work only with PTR DNS queries.
cc @marten-seemann

Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

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

Lists look reasonable and roughly what I would've expected.

Can you add a comment where you took these from?

net/private.go Outdated Show resolved Hide resolved
@sukunrt
Copy link
Member Author

sukunrt commented Sep 14, 2023

The individual entries have the corresponding RFC except reverse lookup domains. Should I mention that this is a cut down version of special use domains from wikipedia?

@marten-seemann
Copy link
Contributor

Yes, it's fine to cite Wikipedia here. I just want to make sure that if we need to come back to this at some point in the future, we can figure out where this originated.

@marten-seemann marten-seemann merged commit a124954 into master Sep 14, 2023
16 checks passed
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