WiSet moduleΒΆ
High level ipset support.
When IPSet module is providing a direct netlink socket with low level
functions, a WiSet
object is built to map ipset objects from kernel.
It helps to add/remove entries, list content, etc.
For example, adding an entry with pr2modules.ipset.IPSet
object
implies to set a various number of parameters:
>>> ipset = IPSet()
>>> ipset.add("foo", "1.2.3.4/24", etype="net")
>>> ipset.close()
When they are discovered by a WiSet
:
>>> wiset = load_ipset("foo")
>>> wiset.add("1.2.3.4/24")
Listing entries is also easier using WiSet
, since it parses for you
netlink messages:
>>> wiset.content
{'1.2.3.0/24': IPStats(packets=None, bytes=None, comment=None,
timeout=None, skbmark=None, physdev=False)}