go-ipset
go-ipset copied to clipboard
Added ipset.{Names,List,Add,Del,Destroy}()
What's the point of extraction List method out of IPSet struct' interface? It's the method on set, so should be binded to some set.
There's no "NewIPSet()", so what is the correct way to extract a list of a set that was created by an external program? I could use something like ipset.IPSet{Name: "SL50"}.List()
, but:
- List() uses a pointer to IPSet (while it's not really required, BTW), so
cannot call pointer method on ipset.IPSet literal
. So I have to create a temporary useless variable liketempIPSet
. - It is a hacky way (which can stop work somewhere in future), anyway.
There's "New()", but:
New creates a new set and returns an Interface to it.
(it creates a new set)
In fact, ipset.IPSet{Name: "SL50"}.List()
doesn't even work in many cases because List
doesn't call initCheck
. Unless you call some other method that does call initCheck
before, ipsetPath
will be an empty string at the time of List
call.