8000 fix: properly detect IPv4 addresses by 3Hren · Pull Request #1460 · sonm-io/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: properly detect IPv4 addresses #1460

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

Merged
merged 1 commit into from
Sep 12, 2018

Conversation

3Hren
Copy link
Member
@3Hren 3Hren commented Sep 12, 2018

For some unknown reasons, Go developers keep IPv4 addresses in a slice of size 16(!). It's so logical, yes.

Just take a look at this another example of clean go architecture:

func IPv4(a, b, c, d byte) IP {
	p := make(IP, IPv6len)
	copy(p, v4InV6Prefix)
	p[12] = a
	p[13] = b
	p[14] = c
	p[15] = d
	return p
}

For some unknown reasons Go developers keep IPv4 addresses in a slice of size 16(!). It's so logical, yes.
@3Hren 3Hren added 💩 T: bug This PR/Issue fixes a bug S: Worker This PR/Issue changes Worker P: HIGH This PR/Issue has the high priority V: patch This PR/Issue requires patch version to be bumped labels Sep 12, 2018
Copy link
Member
@nikonov1101 nikonov1101 left a comment

Choose a reason for hiding this comment

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

wow, so clean, such go

@zavgorodnii zavgorodnii merged commit 55b3116 into master Sep 12, 2018
@zavgorodnii zavgorodnii deleted the fix/worker/proper-detect-public-ipv4 branch September 12, 2018 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P: HIGH This PR/Issue has the high priority S: Worker This PR/Issue changes Worker 💩 T: bug This PR/Issue fixes a bug V: patch This PR/Issue requires patch version to be bumped
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0