proto_openconnect.lua 920 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. -- Copyright 2012 David Woodhouse
  2. -- Licensed to the public under the Apache License 2.0.
  3. local netmod = luci.model.network
  4. local interface = luci.model.network.interface
  5. local proto = netmod:register_protocol("openconnect")
  6. function proto.get_i18n(self)
  7. return luci.i18n.translate("OpenConnect (CISCO AnyConnect)")
  8. end
  9. function proto.ifname(self)
  10. return "vpn-" .. self.sid
  11. end
  12. function proto.get_interface(self)
  13. return interface(self:ifname(), self)
  14. end
  15. function proto.opkg_package(self)
  16. return "openconnect"
  17. end
  18. function proto.is_installed(self)
  19. return nixio.fs.access("/lib/netifd/proto/openconnect.sh")
  20. end
  21. function proto.is_floating(self)
  22. return true
  23. end
  24. function proto.is_virtual(self)
  25. return true
  26. end
  27. function proto.get_interfaces(self)
  28. return nil
  29. end
  30. function proto.contains_interface(self, ifc)
  31. return (netmod:ifnameof(ifc) == self:ifname())
  32. end
  33. netmod:register_pattern_virtual("^vpn-%w")