Browse Source

gluon-config-mode-mesh-vpn: add tunneldigger support

Based-on-patch-by: Cyrus Fox <cyrus@lambdacore.de>
Matthias Schiffer 7 years ago
parent
commit
a49ef70c53

+ 1 - 1
package/gluon-config-mode-mesh-vpn/Makefile

@@ -14,7 +14,7 @@ define Package/gluon-config-mode-mesh-vpn
   SECTION:=gluon
   CATEGORY:=Gluon
   TITLE:=Toggle mesh-vpn and bandwidth limit
-  DEPENDS:=gluon-config-mode-core-virtual +gluon-mesh-vpn-fastd
+  DEPENDS:=gluon-config-mode-core-virtual +gluon-mesh-vpn-core
 endef
 
 define Build/Prepare

+ 4 - 4
package/gluon-config-mode-mesh-vpn/i18n/de.po

@@ -1,8 +1,8 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"PO-Revision-Date: 2015-03-19 22:05+0100\n"
-"Last-Translator: Matthias Schiffer <mschiffer@universe-factory.net>\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"
@@ -23,14 +23,14 @@ msgid "Use internet connection (mesh VPN)"
 msgstr "Internetverbindung nutzen (Mesh-VPN)"
 
 msgid ""
-"Your internet connection can be used to establish an encrypted connection "
+"Your internet connection can be used to establish a 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 "
-"verschlüsselte Verbindung zu anderen Knoten aufzubauen. Die dafür "
+"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."

+ 4 - 9
package/gluon-config-mode-mesh-vpn/i18n/fr.po

@@ -1,12 +1,12 @@
 msgid ""
 msgstr ""
-"Content-Type: text/plain; charset=UTF-8\n"
 "Project-Id-Version: PACKAGE VERSION\n"
 "PO-Revision-Date: 2015-08-12 23:30+0100\n"
 "Last-Translator:Tobias Bernot <tqbs@airmail.cc>\n"
 "Language-Team: French\n"
 "Language: fr\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"
 
@@ -23,14 +23,9 @@ msgid "Use internet connection (mesh VPN)"
 msgstr "Utiliser la connection internet (Mesh-VPN)"
 
 msgid ""
-"Your internet connection can be used to establish an encrypted 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 "
+"Your internet connection can be used to establish a 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 ""
-"Votre nœud peut partager votre accès internet grâce une communication encryptée "
-"avec d'autres nœuds. Vous pouvez limiter la bande passante utilisée par ceci. "
-"Active cette option, si vous n'avez pas d'autres nœuds atteignables par WLAN " 
-"ou si vous voulez partager votre bande passante pour le réseau MESH."
-

+ 1 - 1
package/gluon-config-mode-mesh-vpn/i18n/gluon-config-mode-mesh-vpn.pot

@@ -14,7 +14,7 @@ msgid "Use internet connection (mesh VPN)"
 msgstr ""
 
 msgid ""
-"Your internet connection can be used to establish an encrypted connection "
+"Your internet connection can be used to establish a 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 "

+ 19 - 5
package/gluon-config-mode-mesh-vpn/luasrc/lib/gluon/config-mode/wizard/0300-mesh-vpn.lua

@@ -1,7 +1,16 @@
+local fs = require "nixio.fs"
+
+local has_fastd = fs.access('/lib/gluon/mesh-vpn/fastd')
+local has_tunneldigger = fs.access('/lib/gluon/mesh-vpn/tunneldigger')
+
 return function(form, uci)
+	if not (has_fastd or has_tunneldigger) then
+		return
+	end
+
 	local msg = translate(
-		'Your internet connection can be used to establish an ' ..
-	        'encrypted connection with other nodes. ' ..
+		'Your internet connection can be used to establish a ' ..
+	        '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 ' ..
@@ -13,9 +22,14 @@ return function(form, uci)
 	local o
 
 	local meshvpn = s:option(Flag, "meshvpn", translate("Use internet connection (mesh VPN)"))
-	meshvpn.default = uci:get_bool("fastd", "mesh_vpn", "enabled")
+	meshvpn.default = uci:get_bool("fastd", "mesh_vpn", "enabled") or uci:get_bool("tunneldigger", "mesh_vpn", "enabled")
 	function meshvpn:write(data)
-		uci:set("fastd", "mesh_vpn", "enabled", data)
+		if has_fastd then
+			uci:set("fastd", "mesh_vpn", "enabled", data)
+		end
+		if has_tunneldigger then
+			uci:set("tunneldigger", "mesh_vpn", "enabled", data)
+		end
 	end
 
 	local limit = s:option(Flag, "limit_enabled", translate("Limit bandwidth"))
@@ -43,5 +57,5 @@ return function(form, uci)
 		uci:set("simple-tc", "mesh_vpn", "limit_egress", data)
 	end
 
-	return {'fastd', 'simple-tc'}
+	return {'fastd', 'tunneldigger', 'simple-tc'}
 end