p2pblock.lua 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. -- Copyright 2009 Jo-Philipp Wich <jow@openwrt.org>
  2. -- Licensed to the public under the Apache License 2.0.
  3. local sys = require "luci.sys"
  4. m = Map("freifunk_p2pblock", translate("P2P-Block"),
  5. translate("P2P-Block is a greylisting mechanism to block various peer-to-peer protocols for non-whitelisted clients."))
  6. s = m:section(NamedSection, "p2pblock", "settings", "Settings")
  7. s.anonymous = true
  8. s.addremove = false
  9. en = s:option(Flag, "_enabled", translate("Enable P2P-Block"))
  10. en.rmempty = false
  11. function en.cfgvalue()
  12. return ( sys.init.enabled("freifunk-p2pblock") and "1" or "0" )
  13. end
  14. function en.write(self, section, val)
  15. if val == "1" then
  16. sys.init.enable("freifunk-p2pblock")
  17. else
  18. sys.init.disable("freifunk-p2pblock")
  19. end
  20. end
  21. s:option(Value, "portrange", translate("Portrange"))
  22. s:option(Value, "blocktime", translate("Block Time"),
  23. translate("seconds"))
  24. s:option(DynamicList, "whitelist", translate("Whitelisted IPs"))
  25. l7 = s:option(MultiValue, "layer7", translate("Layer7-Protocols"))
  26. l7.widget = "checkbox"
  27. l7:value("aim", "AIM Chat")
  28. l7:value("bittorrent", "Bittorrent")
  29. l7:value("edonkey", "eDonkey, eMule, Kademlia")
  30. l7:value("fasttrack", "Fasttrack Protocol")
  31. l7:value("ftp", "File Transfer Protocol")
  32. l7:value("gnutella", "Gnutella")
  33. l7:value("http", "Hypertext Transfer Protocol")
  34. l7:value("ident", "Ident Protocol")
  35. l7:value("irc", "Internet Relay Chat")
  36. l7:value("jabber", "Jabber/XMPP")
  37. l7:value("msnmessenger", "MSN Messenger")
  38. l7:value("ntp", "Network Time Protocol")
  39. l7:value("pop3", "POP3 Protocol")
  40. l7:value("smtp", "SMTP Protocol")
  41. l7:value("ssl", "SSL Protocol")
  42. l7:value("vnc", "VNC Protocol")
  43. ipp2p = s:option(MultiValue, "ipp2p", translate("IP-P2P"))
  44. ipp2p.widget = "checkbox"
  45. ipp2p:value("edk", "eDonkey, eMule, Kademlia")
  46. ipp2p:value("kazaa", "KaZaA, FastTrack")
  47. ipp2p:value("gnu", "Gnutella")
  48. ipp2p:value("dc", "Direct Connect")
  49. ipp2p:value("bit", "BitTorrent, extended BT")
  50. ipp2p:value("apple", "AppleJuice")
  51. ipp2p:value("winmx", "WinMX")
  52. ipp2p:value("soul", "SoulSeek")
  53. ipp2p:value("ares", "AresLite")
  54. return m