Added gluon-config-mode-tunneldigger

This commit is contained in:
CyrusFox 2015-10-09 00:11:04 +02:00
commit 119ac32540
4 changed files with 158 additions and 0 deletions

View File

@ -0,0 +1,36 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-tunneldigger
PKG_VERSION:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(GLUONDIR)/include/package.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/gluon-config-mode-tunneldigger
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Toggle tunneldigger and bandwidth limit
DEPENDS:=gluon-config-mode-core-virtual +gluon-mesh-vpn-tunneldigger +gluon-simple-tc
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
$(call GluonBuildI18N,gluon-config-mode-tunneldigger,i18n)
endef
define Package/gluon-config-mode-tunneldigger/install
$(CP) ./files/* $(1)/
$(call GluonInstallI18N,gluon-config-mode-tunneldigger,$(1))
endef
$(eval $(call BuildPackage,gluon-config-mode-tunneldigger))

View File

@ -0,0 +1,64 @@
local cbi = require "luci.cbi"
local i18n = require "luci.i18n"
local uci = luci.model.uci.cursor()
local M = {}
function M.section(form)
local msg = i18n.translate('Your internet connection can be used to establish a ' ..
'L2TP VPN connection with other nodes. ' ..
'Enable this option if there are no other nodes reachable ' ..
'over WLAN in your vicinity or you want to make a part of ' ..
'your connection\'s bandwidth available for the network. You can limit how ' ..
'much bandwidth the node will use at most.')
local s = form:section(cbi.SimpleSection, nil, msg)
local o
o = s:option(cbi.Flag, "_meshvpn", i18n.translate("Use internet connection (mesh VPN via L2TP")"))
o.default = uci:get_bool("tunneldigger", "broker", "enabled") and o.enabled or o.disabled
o.rmempty = false
o = s:option(cbi.Flag, "_limit_enabled", i18n.translate("Limit bandwidth"))
o:depends("_meshvpn", "1")
o.default = uci:get_bool("gluon-simple-tc", "mesh_vpn", "enabled") and o.enabled or o.disabled
o.rmempty = false
o = s:option(cbi.Value, "_limit_ingress", i18n.translate("Downstream (kbit/s)"))
o:depends("_limit_enabled", "1")
o.value = uci:get("gluon-simple-tc", "mesh_vpn", "limit_ingress")
o.rmempty = false
o.datatype = "integer"
o = s:option(cbi.Value, "_limit_egress", i18n.translate("Upstream (kbit/s)"))
o:depends("_limit_enabled", "1")
o.value = uci:get("gluon-simple-tc", "mesh_vpn", "limit_egress")
o.rmempty = false
o.datatype = "integer"
end
function M.handle(data)
uci:set("tunneldigger", "broker", "enabled", data._meshvpn)
uci:save("tunneldigger")
uci:commit("tunneldigger")
-- checks for nil needed due to o:depends(...)
if data._limit_enabled ~= nil then
uci:set("gluon-simple-tc", "mesh_vpn", "interface")
uci:set("gluon-simple-tc", "mesh_vpn", "enabled", data._limit_enabled)
uci:set("gluon-simple-tc", "mesh_vpn", "ifname", "mesh-vpn")
if data._limit_ingress ~= nil then
uci:set("gluon-simple-tc", "mesh_vpn", "limit_ingress", data._limit_ingress)
end
if data._limit_egress ~= nil then
uci:set("gluon-simple-tc", "mesh_vpn", "limit_egress", data._limit_egress)
end
uci:commit("gluon-simple-tc")
uci:commit("gluon-simple-tc")
end
end
return M

View File

@ -0,0 +1,36 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-10-07 00:32+0100\n"
"Last-Translator: Cyrus Fox <cyrus@lambdacore.de>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Downstream (kbit/s)"
msgstr "Downstream (kbit/s)"
msgid "Limit bandwidth"
msgstr "Bandbreite begrenzen"
msgid "Upstream (kbit/s)"
msgstr "Upstream (kbit/s)"
msgid "Use internet connection (mesh VPN via L2TP)"
msgstr "Internetverbindung nutzen (Mesh-VPN via L2TP)"
msgid ""
"Your internet connection can be used to establish a L2TP VPN connection "
"with other nodes. Enable this option if there are no other nodes reachable "
"over WLAN in your vicinity or you want to make a part of your connection's "
"bandwidth available for the network. You can limit how much bandwidth the "
"node will use at most."
msgstr ""
"Dein Knoten kann deine Internetverbindung nutzen um darüber eine "
"L2TP-VPN Verbindung zu anderen Knoten aufzubauen. Die dafür "
"genutzte Bandbreite kannst du beschränken. Aktiviere die Option, falls keine "
"per WLAN erreichbaren Nachbarknoten in deiner Nähe sind oder du deine "
"Internetverbindung für das Mesh-Netzwerk zur Verfügung stellen möchtest."

View File

@ -0,0 +1,22 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Downstream (kbit/s)"
msgstr ""
msgid "Limit bandwidth"
msgstr ""
msgid "Upstream (kbit/s)"
msgstr ""
msgid "Use internet connection (mesh VPN via L2TP)"
msgstr ""
msgid ""
"Your internet connection can be used to establish a L2TP VPN connection "
"with other nodes. Enable this option if there are no other nodes reachable "
"over WLAN in your vicinity or you want to make a part of your connection's "
"bandwidth available for the network. You can limit how much bandwidth the "
"node will use at most."
msgstr ""