Skip to content
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

Added ipset.{Names,List,Add,Del,Destroy}() #5

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

xaionaro
Copy link

No description provided.

@vanch
Copy link

vanch commented Feb 21, 2018

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.

@xaionaro
Copy link
Author

xaionaro commented Feb 21, 2018

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 like tempIPSet.
  • 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)

@xaionaro xaionaro changed the title Added ipset.Names() and ipset.List() Added ipset.{Names,List,Add,Del,Destroy}() Mar 13, 2018
@WGH-
Copy link

WGH- commented Apr 5, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants