- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 193
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
Adding sockaddr namespace #271
Conversation
88675f5
to
97cd199
Compare
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.
I'm looking forward to being able to use this.
funcs/sockaddr.go
Outdated
sockaddrNSInit sync.Once | ||
) | ||
|
||
// SockaddrNS - the crypto namespace |
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.
Cargo-culted crypto
?
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.
😂 good old copy-pasta 🍝
test/integration/sockaddr_test.go
Outdated
{{ . | sockaddr.Attr "address" }} | ||
{{end}}`) | ||
result.Assert(c, icmd.Expected{ExitCode: 0, Out: "127.0.0.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.
I need to go back and write a helper function that's builtin to go-sockaddr
that makes testing easier.
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.
the ability to inject some fake interface/address state to go-sockaddr
would be useful for testing, but not entirely crucial...
97cd199
to
8cedf44
Compare
Signed-off-by: Dave Henderson <[email protected]>
00949cf
to
f798294
Compare
Signed-off-by: Dave Henderson <[email protected]>
f798294
to
95d516d
Compare
Fixes #145
Adds a pile of functions from the
go-sockaddr
package:sockaddr.GetAllInterfaces
sockaddr.GetDefaultInterfaces
sockaddr.GetPrivateInterfaces
sockaddr.GetPublicInterfaces
sockaddr.Sort
sockaddr.Exclude
sockaddr.Include
sockaddr.Attr
sockaddr.Join
sockaddr.Limit
sockaddr.Offset
sockaddr.Unique
sockaddr.Math
sockaddr.GetPrivateIP
sockaddr.GetPrivateIPs
sockaddr.GetPublicIP
sockaddr.GetPublicIPs
sockaddr.GetInterfaceIP
sockaddr.GetInterfaceIPs
I tried to closely match the function names that are exported in github.com/hashicorp/go-sockaddr/template, though couldn't directly import the
FuncMap
s defined therein, because I'd like these to be namespaced./cc @jen20 @sean-