diff options
Diffstat (limited to 'awall/ipset.lua')
-rw-r--r-- | awall/ipset.lua | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/awall/ipset.lua b/awall/ipset.lua index 68e7293..73dea04 100644 --- a/awall/ipset.lua +++ b/awall/ipset.lua @@ -14,7 +14,7 @@ IPSet = awall.object.class(awall.object.Object) function IPSet:init(config) self.config = config end function IPSet:commands() - local res = {} + local res = {'# ipset file generated by awall\n'} if self.config then for name, ipset in pairs(self.config) do if not ipset.type then ipset:error('Type not defined') end @@ -37,8 +37,13 @@ function IPSet:create() end end +function IPSet:print(file) + if not file then file = io.stdout end + for i, line in ipairs(self:commands()) do file:write(line) end +end + function IPSet:dump(ipsfile) local file = io.output(ipsfile) - for i, line in ipairs(self:commands()) do file:write(line) end + self:print(file) file:close() end |