iptables-controller.lua 2.11 KB
Newer Older
1
local mymodule = {}
2

3
mymodule.default_action = "status"
4

5
function mymodule.status(self)
6 7 8
	return self.model.getstatus()
end

9
function mymodule.details(self)
10 11 12
	return self.model.getstatusdetails()
end

13
function mymodule.filterrules(self)
14 15 16
	return self.model.getrules("filter")
end

17
function mymodule.natrules(self)
18 19 20
	return self.model.getrules("nat")
end

21
function mymodule.manglerules(self)
22 23 24
	return self.model.getrules("mangle")
end

25
function mymodule.editchain(self)
26
	return self.handle_form(self, function() return self.model.read_chain(self.clientdata.table, self.clientdata.chain or "") end, self.model.update_chain, self.clientdata, "Save", "Edit Chain", "Chain saved")
27 28
end

29
function mymodule.createchain(self)
30
	return self.handle_form(self, function() return self.model.read_chain(self.clientdata.table) end, self.model.create_chain, self.clientdata, "Create", "Create New Chain", "Chain created")
31 32
end

33
function mymodule.deletechain(self)
34
	return self.handle_form(self, self.model.get_delete_chain, self.model.delete_chain, self.clientdata, "Delete", "Delete Chain", "Chain deleted")
35 36
end

37
function mymodule.editrule(self)
38
	return self.handle_form(self, function() return self.model.read_rule(self.clientdata.table, self.clientdata.chain or "", self.clientdata.position or "") end, self.model.update_rule, self.clientdata, "Save", "Edit Rule", "Rule saved")
39 40
end

41
function mymodule.createrule(self)
42
	return self.handle_form(self, function() return self.model.read_rule(self.clientdata.table, self.clientdata.chain, self.clientdata.position) end, self.model.create_rule, self.clientdata, "Create", "Create New Rule", "Rule created")
43 44
end

45
function mymodule.deleterule(self)
46
	return self.handle_form(self, self.model.get_delete_rule, self.model.delete_rule, self.clientdata, "Delete", "Delete Rule", "Rule deleted")
47 48
end

49
function mymodule.expert(self)
50
	return self.handle_form(self, self.model.readrulesfile, self.model.updaterulesfile, self.clientdata, "Save", "Edit Rules File", "Rules File Saved")
51 52
end

53
function mymodule.startstop(self)
54
	return self.handle_form(self, self.model.get_startstop, self.model.startstop_service, self.clientdata)
55
end
56 57

return mymodule