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

ip: Add helpers to determine if an IP address is private #1513

Conversation

sjoerdsimons
Copy link
Contributor

Add IsPrivate methods to IP4 and IP6 to determine if a ip address is in
the private range. similar to IsPrivate of net.IP in newer golang
versions.

Signed-off-by: Sjoerd Simons [email protected]

Description

Add some helpers for determining of address are in a private range or not; useful for determining if masquarading should be enabled.

Todos

  • Tests
  • Documentation
  • Release note

Release Note

None required

Add IsPrivate methods to IP4 and IP6 to determine if a ip address is in
the private range. similar to IsPrivate of net.IP in newer golang
versions.

Signed-off-by: Sjoerd Simons <[email protected]>
@manuelbuil
Copy link
Collaborator

Are you planning on implementing the code that will apply masq if it is private?

@sjoerdsimons
Copy link
Contributor Author

fwiw here is an example usage: sjoerdsimons/k3s@f53921d

that's my old k3s branch for the previous rounds of wireguard dualstacking; I was submitting as i was prepping an MR to k3s for what is now merged in flannel which will also use this commit ;).

@luthermonson
Copy link
Contributor

@sjoerdsimons can we just upgrade go however needed and use the net.IP functionaliry?

@sjoerdsimons
Copy link
Contributor Author

@sjoerdsimons can we just upgrade go however needed and use the net.IP functionaliry?

I don't know what flannels policy is for updating the Go version. But iirc (it's been a while) if that's updated to a new enough version most if not all of this patch would unneeded indeed

@sjoerdsimons sjoerdsimons deleted the wip/private-range-helper.go branch January 15, 2022 20:42
@sjoerdsimons sjoerdsimons restored the wip/private-range-helper.go branch January 23, 2022 10:30
@sjoerdsimons
Copy link
Contributor Author

looks like i accidentally closed this one; woops

@sjoerdsimons sjoerdsimons reopened this Jan 23, 2022
@sjoerdsimons sjoerdsimons deleted the wip/private-range-helper.go branch January 23, 2022 10:37
@sjoerdsimons
Copy link
Contributor Author

Sorry for the noise; now i remember why i deleted the relevant branch; the branch name ending in .go confuses the flannel testsuite and on cannot change the source branch of an MR in github 🤦

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.

3 participants