-
-
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
Add go-sockaddr
functions
#145
Comments
Thanks @jen20 - on the surface, this looks like a great feature. Hadn't run into Since this seems like it'd pull in a huge number of new functions, I want to make sure to design this in a way that'll make sense and won't paint us into a corner later.
On the face of it, option Documenting all these new functions would be a challenge -- it'll break my non-scalable shove-everything-in-README scheme, but that's probably something needing solving anyway. We could just point to https://godoc.org/github.com/hashicorp/go-sockaddr/template, but I'm not sure how consumable that'd be for the average |
@hairyhenderson Thanks for the feedback. Hopefully I can pull in @sean- here for some further opinions. A third option might be to introduce function name spacing, since many of the
Leaving the string, array and list handling at the top level, unnamespaced level would be sensible however. And so forth. As people inevitably find this program useful I can foresee them desiring cloud platforms other than EC2 to be added - Google Cloud is an obvious choice. A namespacing approach should prevent the top level becoming cluttered, and makes it obvious what each function will operate on without naming them in an obtuse manner. With regards to documentation, I wonder if it is time to consider moving away from README documentation to something like a static site or ReadTheDocs - this is worth considering outside of the scope of these changes even? My guess is that relying on godoc will be insufficient for at least some future users. |
Hello. A few things come to mind:
Let me know what I/we can do to help! |
Thanks for the thoughtful replies, @jen20 and @sean-. I really appreciate it! First up, I'll address @jen20's comments:
Yup - I agree. I'd started writing something to that effect but I couldn't really wrap my brain around it late last night. My initial concern was that I would like all of the functions to be eventually namespaced, but compatibility would be an issue. I'm not sure why I didn't think of it last night, but the obvious answer is to transition relatively slowly and support both versions (i.e. support both There's already a bit of a namespace going on code-wise with a couple packages (
Absolutely. I use mostly AWS these days so I haven't had any real need for other platforms yet, but I'm totally open to broadening this.
I've been having the same thoughts. I've logged #146 to track that effort.
Yeah, that's my main worry. Ok, now @sean-:
I almost ended up doing this when I moved to cobra recently. But the changes would have been too drastic at the time. Plus I didn't really think that gomplate would ever be used as anything but a CLI tool. I am aware however of at least one case where someone's imported the
Yup, totally. The change itself seems pretty minimal, but I want there to be good tests and documentation accompanying it, so that's where things get a bit more complex.
Yup. I've had to resort to all kinds of shady use of
I have a slight preference for Again - thanks for all the feedback. Overall, I think this proposal is great, and I'm in favour of getting it in. The only hurdle is to complete #146 first (thought this effort can certainly start in parallel). |
Scratch that - I mocked something up and it seems to work pretty well - see b37303d. Unless there are any better ideas... 😉 |
Ha, |
@hairyhenderson Go for it (no pun intended). We're both respectively 100% committed w/ our time atm and will be for the next month or two. |
😂 Ok, I'll probably take a stab at this at some point - I'll @mention the two of you for reviews. Thanks! |
This is an issues to discuss the acceptability and design for a large feature which I think would be useful in
gomplate
- the ability to execute go-sockaddr pipelines.The go-sockaddr library was written primarily by @sean- for use in HashiCorp runtime tools to allow for evaluation of network interfaces against heuristics to avoid hard-coding interface names, IP addresses and so forth during configuration. Consul and Nomad (and I believe soon Vault) all support the templates in configuration fields such as
bind
.Templates take the form of a Go function pipeline, and provide functionality such as finding an IP address that:
GetDefaultInterfaces()
)IfByNetwork()
)IfByRFC("1918")
)OrderedIfAddrBy(args)
where args includesAscIfType
,AscNetworkSize
)IfByType("^(IPv4)$")
)IfByMaskSize(32)
)ExcludeIfs("flags", "down")
)SortIfByType()
+ReverseIfAddrs()
); andIfByRFC("6890")
)I believe this would be a fairly straightforward lift-and-shift to support all of the functions supported by
go-sockaddr
ingomplate
, and it would make rendering templates with networking aspects more flexible. Two possible approaches seem to exist:go-sockaddr
-supplied functions togomplate
directlysockaddr
which takes a template to render as a parameter.I'm happy to take a look at doing this work, but want to confirm that the feature set is of interest prior to doing so.
The text was updated successfully, but these errors were encountered: