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
Add tests for ListenIP interface/IP scoring #555
Conversation
bestScore := -1 | ||
var bestIP net.IP | ||
// Select the highest scoring IP as the best IP. | ||
for _, iface := range interfaces { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,80 @@ | |||
// Copyright (c) 2015 Uber Technologies, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: year
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping it 2015 to keep it consistent with the rest of the code, apparently the "year of first publication" is what we want:
http://www.contentious.com/2007/01/07/copyright-notice-is-the-year-really-necessary/
{ | ||
msg: "non-local up ipv4 IPAddr address", | ||
iface: net.Interface{Flags: net.FlagUp}, | ||
addr: &net.IPNet{IP: testIP}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&net.IPAddr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, thanks
{ | ||
msg: "non-local down ipv6 address", | ||
iface: net.Interface{}, | ||
addr: &net.IPAddr{IP: net.ParseIP("2001:db8:a0b:12f0::1")}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declare this IP at the top as well (dedup L65).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed feedback
@@ -0,0 +1,80 @@ | |||
// Copyright (c) 2015 Uber Technologies, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping it 2015 to keep it consistent with the rest of the code, apparently the "year of first publication" is what we want:
http://www.contentious.com/2007/01/07/copyright-notice-is-the-year-really-necessary/
{ | ||
msg: "non-local up ipv4 IPAddr address", | ||
iface: net.Interface{Flags: net.FlagUp}, | ||
addr: &net.IPNet{IP: testIP}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch, thanks
{ | ||
msg: "non-local down ipv6 address", | ||
iface: net.Interface{}, | ||
addr: &net.IPAddr{IP: net.ParseIP("2001:db8:a0b:12f0::1")}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
bestScore := -1 | ||
var bestIP net.IP | ||
// Select the highest scoring IP as the best IP. | ||
for _, iface := range interfaces { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Some prefactoring for #554