From 0799528687691f28c85a321cc6d7d2b54d24953b Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Sun, 22 Nov 2020 17:20:27 +0100 Subject: [PATCH 01/45] Fix MPTCP init script --- mptcp/files/etc/init.d/mptcp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mptcp/files/etc/init.d/mptcp b/mptcp/files/etc/init.d/mptcp index 57e4fa63d..95c9a4fb9 100755 --- a/mptcp/files/etc/init.d/mptcp +++ b/mptcp/files/etc/init.d/mptcp @@ -470,7 +470,7 @@ reload_service() { return 0 } -service_triggers_load_interface() { is_supported_interface "$1" && ifaces="${ifaces}${1} "; } +service_triggers_load_interface() { ifaces="${ifaces}${1} "; } service_triggers() { local ifaces n From 5a8bad2672de3ac033c951c47ea666f4b230d855 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Sun, 22 Nov 2020 18:18:57 +0100 Subject: [PATCH 02/45] Fix typo --- luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua index b01d7a126..3a07d144d 100644 --- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua +++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua @@ -9,7 +9,7 @@ module("luci.controller.openmptcprouter", package.seeall) function index() local ucic = luci.model.uci.cursor() - menuentry = ucic:get("openmptcprouter","settings","menu") pr "OpenMPTCProuter" + menuentry = ucic:get("openmptcprouter","settings","menu") or "OpenMPTCProuter" entry({"admin", "system", menuentry:lower()}, alias("admin", "system", menuentry:lower(), "wizard"), _(menuentry), 1) entry({"admin", "system", menuentry:lower(), "wizard"}, template("openmptcprouter/wizard"), _("Settings Wizard"), 1) entry({"admin", "system", menuentry:lower(), "wizard_add"}, post("wizard_add")) From 24eafaf6939bec93a4ba1611bfced81df932ec68 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Mon, 23 Nov 2020 20:19:04 +0100 Subject: [PATCH 03/45] Fix omr-test-speed, bind it to an interface if requested --- openmptcprouter/files/bin/omr-test-speed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmptcprouter/files/bin/omr-test-speed b/openmptcprouter/files/bin/omr-test-speed index fb433b625..b01279773 100755 --- a/openmptcprouter/files/bin/omr-test-speed +++ b/openmptcprouter/files/bin/omr-test-speed @@ -29,6 +29,6 @@ else domain=$(echo $HOST | awk -F/ '{print $3}') hostip=$(dig +nocmd +noall +answer A $domain | grep -v CNAME | awk '{print $5}' | tr -d "\n") ipset add ss_rules_dst_bypass_all $hostip - curl -4 $HOST >/dev/null || echo + curl -4 --interface $INTERFACE $HOST >/dev/null || echo ipset del ss_rules_dst_bypass_all $hostip fi From d6012f881b7cf62a21189e2f12e3dc731b80f02c Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Mon, 23 Nov 2020 20:19:49 +0100 Subject: [PATCH 04/45] Fix omr-iperf use with arguments --- openmptcprouter/files/bin/omr-iperf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openmptcprouter/files/bin/omr-iperf b/openmptcprouter/files/bin/omr-iperf index aec04c761..dcacabcae 100755 --- a/openmptcprouter/files/bin/omr-iperf +++ b/openmptcprouter/files/bin/omr-iperf @@ -1,5 +1,6 @@ #!/bin/sh SERVER=$1 +shift [ -z "$SERVER" ] && SERVER="vps" KEY=$(uci -q get iperf.$SERVER.key) USER=$(uci -q get iperf.$SERVER.user) @@ -9,7 +10,7 @@ PORTS=$(uci -q get iperf.$SERVER.ports | sed 's/,/ /g') PORT="${PORTS%% *}" echo $KEY | base64 -d > /tmp/iperf.pem if [ -n "$PASSWORD" ] && [ -n "$USER" ] && [ -n "$KEY" ]; then - IPERF3_PASSWORD=$PASSWORD iperf3 --username $USER --rsa-public-key-path /tmp/iperf.pem -c $HOST -p $PORT ${@:2} + IPERF3_PASSWORD=$PASSWORD iperf3 --username $USER --rsa-public-key-path /tmp/iperf.pem -c $HOST -p $PORT ${@} else - iperf3 -c $HOST -p $PORT ${@:2} + iperf3 -c $HOST -p $PORT ${@} fi From c9e66e4d0c974a3f0d9459c66dda0696dffc9d04 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Mon, 23 Nov 2020 20:20:14 +0100 Subject: [PATCH 05/45] Commit changes for system --- openmptcprouter/files/etc/uci-defaults/2060-omr-system | 1 + 1 file changed, 1 insertion(+) diff --git a/openmptcprouter/files/etc/uci-defaults/2060-omr-system b/openmptcprouter/files/etc/uci-defaults/2060-omr-system index 67bd16809..2308efa62 100755 --- a/openmptcprouter/files/etc/uci-defaults/2060-omr-system +++ b/openmptcprouter/files/etc/uci-defaults/2060-omr-system @@ -17,6 +17,7 @@ EOF uci -q set openmptcprouter.settings.scaling_min_freq=$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq | tr -d "\n") uci -q set openmptcprouter.settings.scaling_max_freq=$(cat /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq | tr -d "\n") uci -q set openmptcprouter.settings.scaling_governor='performance' + uci -q commit openmptcprouter } exit 0 \ No newline at end of file From dd255dff4680aa3fca082c0f661e89d9be9c2931 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Wed, 25 Nov 2020 17:26:48 +0100 Subject: [PATCH 06/45] Fix path --- luci-app-mptcp/luasrc/view/mptcp/multipath.htm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/luci-app-mptcp/luasrc/view/mptcp/multipath.htm b/luci-app-mptcp/luasrc/view/mptcp/multipath.htm index 3e72fa34b..8d375c359 100644 --- a/luci-app-mptcp/luasrc/view/mptcp/multipath.htm +++ b/luci-app-mptcp/luasrc/view/mptcp/multipath.htm @@ -906,13 +906,13 @@ window.setTimeout(function() <% if curifname == "all" then %> <%:Download:%> - +
-
<%:Upload:%> - +
-
@@ -920,7 +920,7 @@ window.setTimeout(function() <% else %> - +
-

From bd542abb0226ef61a2c2b9512a8c01c112815da6 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Wed, 25 Nov 2020 17:27:14 +0100 Subject: [PATCH 07/45] Use 9 instead of 09 for init --- omr-update/files/etc/init.d/omr-update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omr-update/files/etc/init.d/omr-update b/omr-update/files/etc/init.d/omr-update index 3c18cb745..0199bb214 100755 --- a/omr-update/files/etc/init.d/omr-update +++ b/omr-update/files/etc/init.d/omr-update @@ -2,7 +2,7 @@ # Copyright (C) 2018 Ycarus (Yannick Chabanois) # Released under GPL 3. See LICENSE for the full terms. -START=09 +START=9 STOP=98 boot() { From 374d25abcec0bc270500828574f8ea455a2c951d Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Wed, 25 Nov 2020 17:28:01 +0100 Subject: [PATCH 08/45] Fix system settings --- openmptcprouter/files/etc/uci-defaults/2060-omr-system | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openmptcprouter/files/etc/uci-defaults/2060-omr-system b/openmptcprouter/files/etc/uci-defaults/2060-omr-system index 2308efa62..3b578e3fc 100755 --- a/openmptcprouter/files/etc/uci-defaults/2060-omr-system +++ b/openmptcprouter/files/etc/uci-defaults/2060-omr-system @@ -6,9 +6,9 @@ uci -q batch <<-EOF >/dev/null commit system set rpcd.@rpcd[0].timeout=120 commit rpcd - luci.apply.timeout='20' + set luci.apply.timeout='20' commit luci - fstab.@global[0].check_fs='1' + set fstab.@global[0].check_fs='1' commit fstab EOF From 564a93000bc33e8e3692d1c01a04e1953f244be0 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Wed, 25 Nov 2020 21:24:46 +0100 Subject: [PATCH 09/45] Restart rpcd if needed --- mptcp/files/usr/share/omr/post-tracking.d/post-tracking | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mptcp/files/usr/share/omr/post-tracking.d/post-tracking b/mptcp/files/usr/share/omr/post-tracking.d/post-tracking index bb686c9fa..e7cd3f311 100755 --- a/mptcp/files/usr/share/omr/post-tracking.d/post-tracking +++ b/mptcp/files/usr/share/omr/post-tracking.d/post-tracking @@ -815,6 +815,12 @@ if [ "$(pgrep v2ray)" = "" ] && [ "$(uci -q get v2ray.main.enabled)" = "1" ] && sleep 5 fi +if [ "$(pgrep rpcd)" = "" ] && [ -f /etc/init.d/rpcd ]; then + _log "Can't find rpcd, restart it..." + /etc/init.d/rpcd restart + sleep 5 +fi + if [ "$(uci -q get v2ray.main.enabled)" = "1" ] && [ -f /etc/init.d/v2ray ] && [ "$(pgrep -f omr-tracker-v2ray)" = "" ]; then _log "Can't find omr-tracker-v2ray, restart omr-tracker..." /etc/init.d/omr-tracker restart From c5460c667c79c587da47fdc840439597063b7dc2 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 26 Nov 2020 11:13:52 +0100 Subject: [PATCH 10/45] Continue if v2ray ip rule already set --- v2ray-core/files/usr/bin/v2ray-rules | 4 ++-- v2ray-core/files/usr/bin/v2ray-rules6 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/v2ray-core/files/usr/bin/v2ray-rules b/v2ray-core/files/usr/bin/v2ray-rules index b37c8a3ae..2d6642274 100755 --- a/v2ray-core/files/usr/bin/v2ray-rules +++ b/v2ray-core/files/usr/bin/v2ray-rules @@ -229,8 +229,8 @@ v2r_rules_iptchains_init_() { fi ;; udp) - ip rule add fwmark 1 lookup 100 - ip route add local default dev lo table 100 + ip rule add fwmark 1 lookup 100 || true + ip route add local default dev lo table 100 || true forward_rules="-A v2r_${rule}_forward -p udp -j TPROXY --on-port "$o_redir_udp_port" --tproxy-mark 0x01/0x01" ;; esac diff --git a/v2ray-core/files/usr/bin/v2ray-rules6 b/v2ray-core/files/usr/bin/v2ray-rules6 index 31a00da24..14f51e5dd 100755 --- a/v2ray-core/files/usr/bin/v2ray-rules6 +++ b/v2ray-core/files/usr/bin/v2ray-rules6 @@ -215,8 +215,8 @@ v2ray_rules6_iptchains_init_() { fi ;; udp) - ip -f inet6 rule add fwmark 1 lookup 100 - ip -f inet6 route add local default dev lo table 100 + ip -f inet6 rule add fwmark 1 lookup 100 || true + ip -f inet6 route add local default dev lo table 100 || true forward_rules=" -A v2r6_${rule}_forward -p udp -j TPROXY --on-port "$o_redir_udp_port" --tproxy-mark 0x01/0x01 -A v2r6_${rule}_forward -p tcp -j TPROXY --on-port "$o_redir_udp_port" --tproxy-mark 0x01/0x01 From c0ebeeee018ca482331282f9a40a7273cfa3dd22 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 26 Nov 2020 11:14:05 +0100 Subject: [PATCH 11/45] Continue if shadowsocks ip rule already set --- shadowsocks-libev/files/ss-rules | 4 ++-- shadowsocks-libev/files/ss-rules6 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shadowsocks-libev/files/ss-rules b/shadowsocks-libev/files/ss-rules index 5cb75dd57..732d9d620 100755 --- a/shadowsocks-libev/files/ss-rules +++ b/shadowsocks-libev/files/ss-rules @@ -229,8 +229,8 @@ ss_rules_iptchains_init_() { fi ;; udp) - ip rule add fwmark 1 lookup 100 - ip route add local default dev lo table 100 + ip rule add fwmark 1 lookup 100 || true + ip route add local default dev lo table 100 || true forward_rules="-A ssr_${rule}_forward -p udp -j TPROXY --on-port "$o_redir_udp_port" --tproxy-mark 0x01/0x01" ;; esac diff --git a/shadowsocks-libev/files/ss-rules6 b/shadowsocks-libev/files/ss-rules6 index 729f496c3..1c25b43bf 100755 --- a/shadowsocks-libev/files/ss-rules6 +++ b/shadowsocks-libev/files/ss-rules6 @@ -211,8 +211,8 @@ ss_rules6_iptchains_init_() { fi ;; udp) - ip -f inet6 rule add fwmark 1 lookup 100 - ip -f inet6 route add local default dev lo table 100 + ip -f inet6 rule add fwmark 1 lookup 100 || true + ip -f inet6 route add local default dev lo table 100 || true forward_rules="-A ssr6_${rule}_forward -p udp -j TPROXY --on-port "$o_redir_udp_port" --tproxy-mark 0x01/0x01" ;; esac From 92aba34441fd78ec775de9e07905210907f13938 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 26 Nov 2020 16:27:37 +0100 Subject: [PATCH 12/45] Status logo in settings --- .../luasrc/view/openmptcprouter/wanstatus.htm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm index f4836fecf..b35f3344f 100644 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm @@ -32,8 +32,9 @@ -%> <%+header%> <% -local ucic = luci.model.uci.cursor() -menuentry = ucic:get("openmptcprouter","settings","menu") or "openmptcprouter" +local ucic = luci.model.uci.cursor() +local menuentry = ucic:get("openmptcprouter","settings","menu") or "openmptcprouter" +local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openmptcprouter.png" %> @@ -107,7 +108,7 @@ menuentry = ucic:get("openmptcprouter","settings","menu") or "openmptcprouter" } } temp += ''; - var equipmentIcon = ''; + var equipmentIcon = ''; var title = String.format("%s (%s)", mArray.openmptcprouter.hostname, mArray.openmptcprouter.local_addr); var statusMessageClass = ""; var statusIcon = "<%=resource%>/openmptcprouter/images/statusOK.png"; From 9c4b42a310516b2e45747d287972f7b8138806ee Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 26 Nov 2020 16:28:21 +0100 Subject: [PATCH 13/45] Remove getting speed from SQM --- .../luasrc/view/openmptcprouter/wizard.htm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm index 2fb57a315..59aaf2f0f 100644 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm @@ -737,15 +737,15 @@ local upload = "0" download = uci:get("network",ifname,"downloadspeed") or "0" upload = uci:get("network",ifname,"uploadspeed") or "0" - if download == "0" or upload == "0" then - if nixio.fs.access("/etc/init.d/sqm") then - download = uci:get("sqm",ifname,"download") - upload = uci:get("sqm",ifname,"upload") - else - download = uci:get("qos",ifname,"download") - upload = uci:get("qos",ifname,"upload") - end - end + --if download == "0" or upload == "0" then + -- if nixio.fs.access("/etc/init.d/sqm") then + -- download = uci:get("sqm",ifname,"download") + -- upload = uci:get("sqm",ifname,"upload") + -- else + -- download = uci:get("qos",ifname,"download") + -- upload = uci:get("qos",ifname,"upload") + -- end + --end %>
From 75fa539abb78ce682a0cda7a7c124d44124e3416 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 26 Nov 2020 16:31:13 +0100 Subject: [PATCH 14/45] Add server name in log and openvpn update key function --- .../files/etc/init.d/openmptcprouter-vps | 48 ++++++++++++++----- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/openmptcprouter/files/etc/init.d/openmptcprouter-vps b/openmptcprouter/files/etc/init.d/openmptcprouter-vps index c34a0bf8e..3c94e42e0 100755 --- a/openmptcprouter/files/etc/init.d/openmptcprouter-vps +++ b/openmptcprouter/files/etc/init.d/openmptcprouter-vps @@ -6,7 +6,7 @@ START=99 USE_PROCD=1 -EXTRA_COMMANDS="set_pihole backup_send backup_get backup_list set_vps_firewall" +EXTRA_COMMANDS="set_pihole backup_send backup_get backup_list set_vps_firewall get_openvpn_key" _parse_result() { result=$("echo $1 | jsonfilter -q -e '@.result'") @@ -114,6 +114,27 @@ _set_openvpn_vps() { fi } +get_openvpn_key() { + servername=$2 + [ -z "$vps_config" ] && vps_config=$(_get_json "config") + [ -z "$vps_config" ] && return + openvpn_client_key="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.client_key')" + [ -n "$openvpn_client_key" ] && { + echo $openvpn_client_key | base64 -d > /etc/luci-uploads/client.key + } + openvpn_client_crt="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.client_crt')" + [ -n "$openvpn_client_crt" ] && { + echo $openvpn_client_crt | base64 -d > /etc/luci-uploads/client.crt + } + openvpn_client_ca="$(echo "$vps_config" | jsonfilter -q -e '@.openvpn.client_ca')" + [ -n "$openvpn_client_ca" ] && { + echo $openvpn_client_ca | base64 -d > /etc/luci-uploads/ca.crt + } + [ -n "$openvpn_client_key" ] && [ -n "$openvpn_client_crt" ] && [ -n "$openvpn_client_ca" ] && { + /etc/init.d/openvpn restart + } +} + _get_ss_redir() { config_get cf_ebpf $1 ebpf [ "$cf_ebpf" = "1" ] && ebpf="true" @@ -166,7 +187,7 @@ _set_ss_server_vps() { if [ "$current_obfs_plugin" != "$obfs_plugin" ] || [ "$current_obfs_type" != "$obfs_type" ] || [ "$current_port" != "$port" ] || [ "$current_method" != "$method" ] || [ "$current_key" != "$key" ] || [ "$current_ebpf" != "$ebpf" ] || [ "$current_obfs" != "$obfs" ] || [ "$current_fast_open" != "$fast_open" ] || [ "$current_no_delay" != "$no_delay" ]; then local settings settings='{"port": '$port',"method":"'$method'","fast_open":'$fast_open',"reuse_port":true,"no_delay":'$no_delay',"mptcp":true,"key":"'$key'","ebpf":'$ebpf',"obfs":'$obfs',"obfs_plugin":"'$obfs_plugin'","obfs_type":"'$obfs_type'"}' - echo $(_set_json "shadowsocks" "$settings") + _set_json "shadowsocks" "$settings" fi } @@ -906,7 +927,7 @@ _set_vps_firewall() { vps_config="" _login [ -z "$token" ] && { - logger -t "OMR-VPS" "Can't get token, try later" + logger -t "OMR-VPS" "Can't get ${fwservername} token, try later" uci -q batch <<-EOF >/dev/null set openmptcprouter.${fwservername}.admin_error=1 EOF @@ -967,7 +988,7 @@ _set_config_from_vps() { [ -z "$vps_config" ] && vps_config=$(_get_json "config") [ -z "$vps_config" ] && return - logger -t "OMR-VPS" "Get config from VPS..." + logger -t "OMR-VPS" "Get config from server ${servername}..." noerror=1 # get VPS ip vpsip="$(uci -q get openmptcprouter.${servername}.ip)" @@ -1371,7 +1392,7 @@ _backup_send() { vps_config="" _login [ -z "$token" ] && { - logger -t "OMR-VPS" "Can't get token, try later" + logger -t "OMR-VPS" "Can't get ${servername} token, try later" uci -q batch <<-EOF >/dev/null set openmptcprouter.${servername}.admin_error=1 EOF @@ -1412,7 +1433,7 @@ _backup_get_and_apply() { vps_config="" _login [ -z "$token" ] && { - logger -t "OMR-VPS" "Can't get token, try later" + logger -t "OMR-VPS" "Can't get ${servername} token, try later" uci -q batch <<-EOF >/dev/null set openmptcprouter.${servername}.admin_error=1 EOF @@ -1446,7 +1467,7 @@ _backup_list() { vps_config="" _login [ -z "$token" ] && { - logger -t "OMR-VPS" "Can't get token, try later" + logger -t "OMR-VPS" "Can't get ${servername} token, try later" uci -q batch <<-EOF >/dev/null set openmptcprouter.${servername}.admin_error=1 EOF @@ -1483,6 +1504,7 @@ _config_service() { [ -z "$(uci -q get openmptcprouter.${servername}.password)" ] && return [ -z "$(uci -q get openmptcprouter.${servername}.port)" ] && return [ -z "$(uci -q get openmptcprouter.${servername}.ip)" ] && return + [ "$(uci -q get openmptcprouter.${servername}.disabled)" = "1" ] && return token="" vps_config="" _login @@ -1491,9 +1513,9 @@ _config_service() { _ping_server status=$? if $(exit $status); then - reason="can ping server" + reason="can ping server ${servername}" else - reason="can't ping server" + reason="can't ping server ${servername}" fi port="$(uci -q get openmptcprouter.${servername}.port)" server="$(uci -q get openmptcprouter.${servername}.ip)" @@ -1505,19 +1527,21 @@ _config_service() { if [ "$(uci -q get openmptcprouter.${servername}.username)" != "openmptcprouter" ]; then reason="$reason, custom username" fi - logger -t "OMR-VPS" "Can't get token, try later ($reason)" + logger -t "OMR-VPS" "Can't get ${servername} token, try later ($reason)" uci -q batch <<-EOF >/dev/null set openmptcprouter.${servername}.admin_error=1 EOF return } error=0 - [ "$(uci -q get openmptcprouter.${servername}.get_config)" = "1" ] && { + [ "$(uci -q get openmptcprouter.${servername}.get_config)" = "1" ] && [ "$(uci -q get openmptcprouter.${servername}.master)" = "1" ] && { _set_config_from_vps _get_gre_tunnel } - _get_vps_config + [ "$(uci -q get openmptcprouter.${servername}.master)" = "1" ] && { + _get_vps_config + } [ -z "$vps_config" ] && vps_config=$(_get_json "config") [ -z "$vps_config" ] && return user_permission="$(echo "$vps_config" | jsonfilter -q -e '@.user.permission')" From dd6e5d07f83574a5b7ff02fd34ae9c4c6d9de174 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 26 Nov 2020 16:31:36 +0100 Subject: [PATCH 15/45] Update OpenVPN key when server change --- omr-tracker/files/bin/omr-tracker-server | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/omr-tracker/files/bin/omr-tracker-server b/omr-tracker/files/bin/omr-tracker-server index 7b652c26d..e7c759b16 100755 --- a/omr-tracker/files/bin/omr-tracker-server +++ b/omr-tracker/files/bin/omr-tracker-server @@ -65,6 +65,7 @@ _check_master() { add_list openvpn.omr.remote=$ip commit openvpn EOF + /etc/init.d/openmptcprouter-vps get_openvpn_key $name >/dev/null 2>/dev/null /etc/init.d/shadowsocks-libev restart >/dev/null 2>/dev/null /etc/init.d/v2ray restart >/dev/null 2>/dev/null /etc/init.d/glorytun restart >/dev/null 2>/dev/null @@ -88,7 +89,7 @@ _check_backup() { _check_server $ip $port [ "$server_ping" = true ] && [ "$(uci -q get shadowsocks-libev.sss0.server | tr -d '\n')" = "$ip" ] && break [ "$server_ping" = true ] && [ "$(uci -q get shadowsocks-libev.sss0.server | tr -d '\n')" != "$ip" ] && { - logger -t "OMR-Tracker-Server" "User backup server $1 ($ip)" + logger -t "OMR-Tracker-Server" "Use backup server $1 ($ip)" uci -q batch <<-EOF >/dev/null set shadowsocks-libev.sss0.server=$ip commit shadowsocks-libev @@ -105,6 +106,7 @@ _check_backup() { add_list openvpn.omr.remote=$ip commit openvpn EOF + /etc/init.d/openmptcprouter-vps get_openvpn_key $name >/dev/null 2>/dev/null /etc/init.d/shadowsocks-libev restart >/dev/null 2>/dev/null /etc/init.d/v2ray restart >/dev/null 2>/dev/null /etc/init.d/glorytun restart >/dev/null 2>/dev/null From 9abe48ca8fbd5e369a1ac6d52d69eedc105225ee Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 26 Nov 2020 16:32:15 +0100 Subject: [PATCH 16/45] Add BBR2 dependency --- openmptcprouter-full/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmptcprouter-full/Makefile b/openmptcprouter-full/Makefile index 8afa8bbcb..0d060fa9a 100644 --- a/openmptcprouter-full/Makefile +++ b/openmptcprouter-full/Makefile @@ -78,7 +78,7 @@ MY_DEPENDS := \ !TARGET_mvebu:kmod-usb-net-huawei-cdc-ncm !TARGET_mvebu:kmod-usb-net-rndis !TARGET_mvebu:kmod-usb-net-cdc-ether !TARGET_mvebu:kmod-usb-net-ipheth !TARGET_mvebu:usbmuxd \ kmod-rt2800-usb kmod-rtl8xxxu kmod-rtl8192cu kmod-net-rtl8192su \ !TARGET_mvebu:luci-proto-qmi wpad-basic kmod-mt7601u kmod-rtl8187 \ - luci-app-mlvpn mlvpn 464xlat !TARGET_mvebu:kmod-usb-net-smsc75xx kmod-zram kmod-swconfig swconfig kmod-ipt-nat kmod-ipt-nat6 luci-app-https-dns-proxy kmod-tcp-nanqinlang iptables-mod-ipopt igmpproxy ss iptraf-ng \ + luci-app-mlvpn mlvpn 464xlat !TARGET_mvebu:kmod-usb-net-smsc75xx kmod-zram kmod-swconfig swconfig kmod-ipt-nat kmod-ipt-nat6 luci-app-https-dns-proxy kmod-tcp-nanqinlang kmod-tcp-bbr2 iptables-mod-ipopt igmpproxy ss iptraf-ng \ luci-app-acl block-mount blockd fstools luci-app-shutdown libwebp luci-proto-gre tcptraceroute luci-proto-mbim kmod-rtl8xxxu kmod-ath9k-htc luci-app-ttyd luci-mod-dashboard (TARGET_x86||TARGET_x86_64):rtl8192eu-firmware kmod-usb2 libustream-wolfssl (TARGET_x86||TARGET_x86_64):kmod-ixgbevf \ hwinfo (TARGET_x86||TARGET_x86_64):dmidecode # luci-theme-bootstrap luci-theme-openwrt-2020 luci-theme-openwrt luci-app-status From 4e6ba9a587fb03d1d221133a2b4866c43e2f0e10 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 27 Nov 2020 18:12:10 +0100 Subject: [PATCH 17/45] Fix typo --- luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm index 59aaf2f0f..0973622ab 100644 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm @@ -470,7 +470,7 @@
From 9b30f42277f1d40a482011137705539e93327c96 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 27 Nov 2020 18:12:31 +0100 Subject: [PATCH 18/45] Update firewall app to upstream --- .../htdocs/luci-static/resources/view/firewall/rules.js | 1 + .../htdocs/luci-static/resources/view/firewall/zones.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js b/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js index 8cb1a1242..bacbbd704 100644 --- a/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js +++ b/luci-app-firewall/htdocs/luci-static/resources/view/firewall/rules.js @@ -308,6 +308,7 @@ return view.extend({ o.value('network-redirect'); o.value('network-unknown'); o.value('network-unreachable'); + o.value('packet-too-big'); o.value('parameter-problem'); o.value('port-unreachable'); o.value('precedence-cutoff'); diff --git a/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js b/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js index 5e2b6cd81..00e272677 100644 --- a/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js +++ b/luci-app-firewall/htdocs/luci-static/resources/view/firewall/zones.js @@ -177,9 +177,11 @@ return view.extend({ } return Promise.all(tasks).then(function(zone_networks) { - if (zone_networks[0]) + if (zone_networks[0]) { + zone_networks[0].clearNetworks(); for (var i = 1; i < zone_networks.length; i++) zone_networks[0].addNetwork(zone_networks[i].getName()); + } }); }; From a445cba3c7dec1b05dc4b10c6ec5269cbb6f53d5 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 27 Nov 2020 18:13:04 +0100 Subject: [PATCH 19/45] Update wireless from upstream --- luci-mod-network/Makefile | 2 +- .../resources/view/network/wireless.js | 20 ++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/luci-mod-network/Makefile b/luci-mod-network/Makefile index 962817219..7a043dc40 100644 --- a/luci-mod-network/Makefile +++ b/luci-mod-network/Makefile @@ -4,7 +4,7 @@ # # This is free software, licensed under the Apache License, Version 2.0 . # -# From https://github.com/openwrt/luci/commit/5ca328440b3a41ab6d415ec96f9db4339715de67 +# From https://github.com/openwrt/luci/commit/83c912716e482000e92443cffc3202726314f480 include $(TOPDIR)/rules.mk diff --git a/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js b/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js index dc75c9509..bb9877217 100644 --- a/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js +++ b/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js @@ -1634,7 +1634,7 @@ return view.extend({ o = ss.taboption('encryption', form.Flag, 'wpa_disable_eapol_key_retries', _('Enable key reinstallation (KRACK) countermeasures'), _('Complicates key reinstallation attacks on the client side by disabling retransmission of EAPOL-Key frames that are used to install keys. This workaround might cause interoperability issues and reduced robustness of key negotiation especially in environments with heavy traffic load.')); add_dependency_permutations(o, { mode: ['ap', 'ap-wds'], encryption: ['psk2', 'psk-mixed', 'sae', 'sae-mixed', 'wpa2', 'wpa3', 'wpa3-mixed'] }); - if (L.hasSystemFeature('hostapd', 'cli') && L.hasSystemFeature('wpasupplicant')) { + if (L.hasSystemFeature('hostapd', 'wps') && L.hasSystemFeature('wpasupplicant')) { o = ss.taboption('encryption', form.Flag, 'wps_pushbutton', _('Enable WPS pushbutton, requires WPA(2)-PSK/WPA3-SAE')) o.enabled = '1'; o.disabled = '0'; @@ -1742,7 +1742,7 @@ return view.extend({ E('span', { 'style': s }, '%h'.format(network.formatWifiEncryption(res.encryption))), E('div', { 'class': 'right' }, E('button', { 'class': 'cbi-button cbi-button-action important', - 'click': L.bind(this.handleJoin, this, radioDev, res) + 'click': ui.createHandlerFn(this, 'handleJoin', radioDev, res) }, _('Join Network'))) ]); @@ -1790,17 +1790,19 @@ return view.extend({ s.handleJoinConfirm = function(radioDev, bss, form, ev) { var nameopt = L.toArray(form.lookupOption('name', '_new_'))[0], passopt = L.toArray(form.lookupOption('password', '_new_'))[0], + ssidopt = L.toArray(form.lookupOption('ssid', '_new_'))[0], bssidopt = L.toArray(form.lookupOption('bssid', '_new_'))[0], zoneopt = L.toArray(form.lookupOption('zone', '_new_'))[0], replopt = L.toArray(form.lookupOption('replace', '_new_'))[0], nameval = (nameopt && nameopt.isValid('_new_')) ? nameopt.formvalue('_new_') : null, passval = (passopt && passopt.isValid('_new_')) ? passopt.formvalue('_new_') : null, + ssidval = (ssidopt && ssidopt.isValid('_new_')) ? ssidopt.formvalue('_new_') : null, bssidval = (bssidopt && bssidopt.isValid('_new_')) ? bssidopt.formvalue('_new_') : null, zoneval = zoneopt ? zoneopt.formvalue('_new_') : null, enc = L.isObject(bss.encryption) ? bss.encryption : null, is_wep = (enc && Array.isArray(enc.wep)), - is_psk = (enc && Array.isArray(enc.wpa) && L.toArray(enc.authentication).filter(function(a) { return a == 'psk' })), - is_sae = (enc && Array.isArray(enc.wpa) && L.toArray(enc.authentication).filter(function(a) { return a == 'sae' })); + is_psk = (enc && Array.isArray(enc.wpa) && L.toArray(enc.authentication).filter(function(a) { return a == 'psk' }).length > 0), + is_sae = (enc && Array.isArray(enc.wpa) && L.toArray(enc.authentication).filter(function(a) { return a == 'sae' }).length > 0); if (nameval == null || (passopt && passval == null)) return; @@ -1841,6 +1843,9 @@ return view.extend({ uci.set('wireless', section_id, 'bssid', bss.bssid); } + if (ssidval != null) + uci.set('wireless', section_id, 'ssid', ssidval); + if (is_sae) { uci.set('wireless', section_id, 'encryption', 'sae'); uci.set('wireless', section_id, 'key', passval); @@ -1886,7 +1891,7 @@ return view.extend({ }; s.handleJoin = function(radioDev, bss, ev) { - this.handleScanAbort(ev); + poll.remove(this.pollFn); var m2 = new form.Map('wireless'), s2 = m2.section(form.NamedSection, '_new_'), @@ -1911,6 +1916,11 @@ return view.extend({ ]).then(this.renderContents.bind(this)); }; + if (bss.ssid == null) { + name = s2.option(form.Value, 'ssid', _('Network SSID'), _('The correct SSID must be manually specified when joining a hidden wireless network')); + name.rmempty = false; + }; + replace = s2.option(form.Flag, 'replace', _('Replace wireless configuration'), _('Check this option to delete the existing networks from this radio.')); name = s2.option(form.Value, 'name', _('Name of the new network'), _('The allowed characters are: A-Z, a-z, 0-9 and _')); From 284fda5ec7406c5f1dd1e139fdb321b4b284f295 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 27 Nov 2020 18:13:36 +0100 Subject: [PATCH 20/45] Fix firewall from update --- openmptcprouter/files/etc/uci-defaults/1980-omr-firewall | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openmptcprouter/files/etc/uci-defaults/1980-omr-firewall b/openmptcprouter/files/etc/uci-defaults/1980-omr-firewall index 267891fd3..e6f918796 100755 --- a/openmptcprouter/files/etc/uci-defaults/1980-omr-firewall +++ b/openmptcprouter/files/etc/uci-defaults/1980-omr-firewall @@ -157,6 +157,11 @@ uci -q del firewall.@zone[1].network for intf in $allintf; do uci -q add_list firewall.@zone[1].network=$intf done +allintf=$(uci -q get firewall.zone_vpn.network) +uci -q del firewall.zone_vpn.network +for intf in $allintf; do + uci -q add_list firewall.zone_vpn.network=$intf +done uci -q batch <<-EOF >/dev/null set firewall.@zone[0].mtu_fix='1' From eac6cc6ab1b6a46aae06317e38a7887cc968d1a7 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Fri, 27 Nov 2020 19:59:28 +0100 Subject: [PATCH 21/45] Fix omr-rename when not needed --- luci-app-openmptcprouter/root/etc/init.d/openmptcprouter | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter b/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter index c49866fd5..63d4d3a3a 100755 --- a/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter +++ b/luci-app-openmptcprouter/root/etc/init.d/openmptcprouter @@ -45,14 +45,15 @@ omr_intf_set() { if [ "$type" != "macvlan" ] && [ -n "$ifname" ] && [ -f /sys/class/net/${ifname}/device/uevent ]; then devicepath=$(readlink -f /sys/class/net/${ifname}) - if [ -n "$devicepath" ] && [ "$(echo ${devicepath} | grep virtual)" = "" ]; then + if [ -n "$devicepath" ] && [ "$(echo ${devicepath} | grep virtual)" = "" ] && [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PRODUCT)" != "" ] && [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PCI_SLOT_NAME)" = "" ]; then uci -q set network.$1.modalias="$(cat /sys/class/net/${ifname}/device/uevent | grep MODALIAS | cut -d '=' -f2 | tr -d '\n')" uci -q set network.$1.product="$(cat /sys/class/net/${ifname}/device/uevent | grep PRODUCT | cut -d '=' -f2 | tr -d '\n')" - elif [ -n "$devicepath" ] && [ "$(echo ${devicepath} | grep virtual)" != "" ]; then + elif [ -n "$devicepath" ] && ([ "$(echo ${devicepath} | grep virtual)" != "" ] || [ "$(echo ${devicepath} | grep virtual)" = "" ] && [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PRODUCT)" = "" ] || [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PCI_SLOT_NAME)" != "" ] || [ "$(cat /sys/class/net/${ifname}tmp/device/uevent)" != "" ]); then uci -q delete network.$1.device uci -q delete network.$1.modalias + uci -q delete network.$1.product fi - elif [ "$type" != "macvlan" ] && [ -n "$device" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ]; then + elif [ "$type" != "macvlan" ] && [ -n "$device" ] && [ -f /sys/bus/usb-serial/devices/${devicename}/device/uevent ] && [ "$(cat /sys/class/net/${ifname}/device/uevent | grep PRODUCT)" != "" ]; then uci -q set network.$1.modalias="$(cat /sys/bus/usb-serial/devices/${devicename}/device/uevent | grep MODALIAS | cut -d '=' -f2 | tr -d '\n')" uci -q set network.$1.product="$(cat /sys/bus/usb-serial/devices/${devicename}/device/uevent | grep PRODUCT | cut -d '=' -f2 | tr -d '\n')" fi From 30fa24b9160ec9cae644426c2f8573f22134167d Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Sat, 28 Nov 2020 20:30:52 +0100 Subject: [PATCH 22/45] Fix glorytun UDP init script --- glorytun-udp/init | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glorytun-udp/init b/glorytun-udp/init index 638736017..b9a18c526 100755 --- a/glorytun-udp/init +++ b/glorytun-udp/init @@ -62,10 +62,10 @@ start_instance() { procd_open_instance procd_set_param command ${PROG} \ - ${bind:+bind "$bind"} \ - ${bindport:+ "$bindport"} \ - ${host:+to "$host"} \ - ${port:+ "$port"} \ + ${bind:+bind from "$bind"} \ + ${bindport:+port "$bindport"} \ + ${host:+to addr "$host"} \ + ${port:+port "$port"} \ ${dev:+dev "$dev"} \ keyfile /tmp/${PROG_NAME}-${1}.key \ persist From 0bf0bee341ed90fd2efbf8ec98b9f28d4c2aa973 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Sat, 28 Nov 2020 20:58:14 +0100 Subject: [PATCH 23/45] Fix shadowsocks config from router --- .../files/etc/init.d/openmptcprouter-vps | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/openmptcprouter/files/etc/init.d/openmptcprouter-vps b/openmptcprouter/files/etc/init.d/openmptcprouter-vps index 3c94e42e0..8db25ea42 100755 --- a/openmptcprouter/files/etc/init.d/openmptcprouter-vps +++ b/openmptcprouter/files/etc/init.d/openmptcprouter-vps @@ -153,14 +153,15 @@ _get_ss_server() { _set_ss_server_vps() { local disabled port key method - config_get disabled $1 disabled + config_load shadowsocks-libev + config_get disabled sss0 disabled [ "$disabled" = "1" ] && return - config_get port $1 server_port + config_get port sss0 server_port #config_get server $1 server - config_get key $1 key + config_get key sss0 key key="$(echo $key | sed 's/+/-/g; s/\//_/g;')" [ -z "$key" ] && return - config_get method $1 method + config_get method sss0 method local current_port current_key current_method [ -z "$vps_config" ] && vps_config=$(_get_json "config") [ -z "$vps_config" ] && return @@ -1562,8 +1563,9 @@ _config_service() { [ -n "$vps_config" ] && uci -q set openmptcprouter.settings.firstboot=0 fi if [ "$user_permission" != "ro" ]; then - config_load shadowsocks-libev - config_foreach _set_ss_server_vps server + #config_load shadowsocks-libev + #config_foreach _set_ss_server_vps server + _set_ss_server_vps _set_v2ray_server_vps [ -z "$(_set_glorytun_vps)" ] && error=1 [ -z "$(_set_openvpn_vps)" ] && error=1 From 1bc14fdbde06814d3d2f2ddba2043aa127bf1349 Mon Sep 17 00:00:00 2001 From: Giuseppe Dipierro Date: Tue, 1 Dec 2020 10:21:17 +0000 Subject: [PATCH 24/45] Translated using Weblate (Italian) Currently translated at 98.7% (237 of 240 strings) Translation: OpenMPTCProuter/LuCI/applications/openmptcprouter Translate-URL: http://weblate.openmptcprouter.com/projects/omr/luciapplicationsopenmptcprouter/it/ --- luci-app-openmptcprouter/po/it/openmptcprouter.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/luci-app-openmptcprouter/po/it/openmptcprouter.po b/luci-app-openmptcprouter/po/it/openmptcprouter.po index 0a900f075..e11809c0e 100644 --- a/luci-app-openmptcprouter/po/it/openmptcprouter.po +++ b/luci-app-openmptcprouter/po/it/openmptcprouter.po @@ -1,7 +1,7 @@ msgid "" msgstr "" -"PO-Revision-Date: 2020-10-21 12:55+0000\n" -"Last-Translator: Weblate Admin \n" +"PO-Revision-Date: 2020-12-01 10:49+0000\n" +"Last-Translator: Giuseppe Dipierro \n" "Language-Team: Italian \n" "Language: it\n" @@ -981,7 +981,7 @@ msgstr "Traffico VPN:" #: luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm:198 msgid "VPN tunnel DOWN" -msgstr "Tunnel VPN GIÙ" +msgstr "Tunnel VPN non stabilito" #: luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm:41 msgid "VPS settings" From d1e4d0f73948f6483d28b881c322daab364ac1e3 Mon Sep 17 00:00:00 2001 From: Giuseppe Dipierro Date: Tue, 1 Dec 2020 10:12:14 +0000 Subject: [PATCH 25/45] Translated using Weblate (Italian) Currently translated at 100.0% (6 of 6 strings) Translation: OpenMPTCProuter/LuCI/applications/shutdown Translate-URL: http://weblate.openmptcprouter.com/projects/omr/luciapplicationsshutdown/it/ --- luci-app-shutdown/po/it/shutdown.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/luci-app-shutdown/po/it/shutdown.po b/luci-app-shutdown/po/it/shutdown.po index 500e9eba6..03ca58813 100644 --- a/luci-app-shutdown/po/it/shutdown.po +++ b/luci-app-shutdown/po/it/shutdown.po @@ -1,7 +1,7 @@ msgid "" msgstr "" -"PO-Revision-Date: 2020-09-15 11:36+0000\n" -"Last-Translator: Weblate Admin \n" +"PO-Revision-Date: 2020-12-01 10:49+0000\n" +"Last-Translator: Giuseppe Dipierro \n" "Language-Team: Italian \n" "Language: it\n" @@ -21,11 +21,11 @@ msgstr "Eseguire l'arresto" #: luci-app-shutdown/htdocs/luci-static/resources/view/system/shutdown.js:9 #: luci-app-shutdown/root/usr/share/luci/menu.d/luci-app-shutdown.json:3 msgid "Shutdown" -msgstr "Spegnimento" +msgstr "Spegni" #: luci-app-shutdown/htdocs/luci-static/resources/view/system/shutdown.js:10 msgid "Shutdown the operating system of your device" -msgstr "Arresta il sistema operativo del tuo dispositivo" +msgstr "Arresta il dispositivo" #: luci-app-shutdown/htdocs/luci-static/resources/view/system/shutdown.js:31 msgid "The poweroff command failed with code %d" From 07a3b6e4c3790fb0ab0015f518c20ad2002459ef Mon Sep 17 00:00:00 2001 From: Giuseppe Dipierro Date: Tue, 1 Dec 2020 10:13:33 +0000 Subject: [PATCH 26/45] Translated using Weblate (Italian) Currently translated at 100.0% (11 of 11 strings) Translation: OpenMPTCProuter/LuCI/applications/mail Translate-URL: http://weblate.openmptcprouter.com/projects/omr/luciapplicationsmail/it/ --- luci-app-mail/po/it/mail.po | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/luci-app-mail/po/it/mail.po b/luci-app-mail/po/it/mail.po index 524ba6ee2..fd43053e7 100644 --- a/luci-app-mail/po/it/mail.po +++ b/luci-app-mail/po/it/mail.po @@ -1,7 +1,7 @@ msgid "" msgstr "" -"PO-Revision-Date: 2020-09-21 12:51+0000\n" -"Last-Translator: Weblate Admin \n" +"PO-Revision-Date: 2020-12-01 10:49+0000\n" +"Last-Translator: Giuseppe Dipierro \n" "Language-Team: Italian \n" "Language: it\n" @@ -14,7 +14,7 @@ msgid "From" msgstr "Da" msgid "Mail settings" -msgstr "Impostazioni mail" +msgstr "Configurazione mail" msgid "Password" msgstr "Password" @@ -32,9 +32,7 @@ msgid "Server" msgstr "Server" msgid "Set mail settings for services that need to send mails." -msgstr "" -"Configurare le impostazioni di posta per i servizi che devono inviare " -"messaggi di posta elettronica." +msgstr "Configurazione del server mail da utilizzare per inviare alert." msgid "TLS" msgstr "TLS" From 1f3ebf9fd77c373f4166ddeca4b724a1ee89c85f Mon Sep 17 00:00:00 2001 From: Giuseppe Dipierro Date: Tue, 1 Dec 2020 10:19:07 +0000 Subject: [PATCH 27/45] Translated using Weblate (Italian) Currently translated at 96.4% (54 of 56 strings) Translation: OpenMPTCProuter/LuCI/applications/mptcp Translate-URL: http://weblate.openmptcprouter.com/projects/omr/luciapplicationsmptcp/it/ --- luci-app-mptcp/po/it/mptcp.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/luci-app-mptcp/po/it/mptcp.po b/luci-app-mptcp/po/it/mptcp.po index 9302b4a4c..272ac94dc 100644 --- a/luci-app-mptcp/po/it/mptcp.po +++ b/luci-app-mptcp/po/it/mptcp.po @@ -1,7 +1,7 @@ msgid "" msgstr "" -"PO-Revision-Date: 2020-10-02 08:44+0000\n" -"Last-Translator: Weblate Admin \n" +"PO-Revision-Date: 2020-12-01 10:49+0000\n" +"Last-Translator: Giuseppe Dipierro \n" "Language-Team: Italian \n" "Language: it\n" @@ -164,7 +164,7 @@ msgstr "Un'interfaccia deve essere impostata come master" #: luci-app-mptcp/luasrc/view/mptcp/multipath.htm:939 msgid "Outbound:" -msgstr "In uscita:" +msgstr "Upload:" #: luci-app-mptcp/luasrc/view/mptcp/multipath.htm:323 #: luci-app-mptcp/luasrc/view/mptcp/multipath.htm:326 @@ -193,7 +193,7 @@ msgstr "Test" #: luci-app-mptcp/luasrc/view/mptcp/multipath.htm:914 msgid "Upload:" -msgstr "Carica:" +msgstr "Upload:" #: luci-app-mptcp/luasrc/view/mptcp/mptcp_check.htm:21 #: luci-app-mptcp/luasrc/view/mptcp/mptcp_connections.htm:21 From f13bdd001f1b8aa97c5957471a9a2592da99b966 Mon Sep 17 00:00:00 2001 From: Giuseppe Dipierro Date: Tue, 1 Dec 2020 16:35:42 +0000 Subject: [PATCH 28/45] Translated using Weblate (Italian) Currently translated at 98.7% (237 of 240 strings) Translation: OpenMPTCProuter/LuCI/applications/openmptcprouter Translate-URL: http://weblate.openmptcprouter.com/projects/omr/luciapplicationsopenmptcprouter/it/ --- luci-app-openmptcprouter/po/it/openmptcprouter.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/luci-app-openmptcprouter/po/it/openmptcprouter.po b/luci-app-openmptcprouter/po/it/openmptcprouter.po index e11809c0e..9cdcf0e42 100644 --- a/luci-app-openmptcprouter/po/it/openmptcprouter.po +++ b/luci-app-openmptcprouter/po/it/openmptcprouter.po @@ -1,6 +1,6 @@ msgid "" msgstr "" -"PO-Revision-Date: 2020-12-01 10:49+0000\n" +"PO-Revision-Date: 2020-12-01 17:19+0000\n" "Last-Translator: Giuseppe Dipierro \n" "Language-Team: Italian \n" @@ -1006,7 +1006,7 @@ msgstr "" #: luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm:39 msgid "Wizard" -msgstr "Mago" +msgstr "Wizard" #: luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm:75 #: luci-app-openmptcprouter/luasrc/view/openmptcprouter/wanstatus.htm:80 From 2df8bdf0529e68686d0262653d07fade83dc65e7 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:21:43 +0100 Subject: [PATCH 29/45] New interface for dsvpn VPN --- dsvpn/files/init | 14 ++-- luci-app-dsvpn/Makefile | 4 +- .../resources/view/services/dsvpn.js | 66 +++++++++++++++++++ luci-app-dsvpn/luasrc/controller/dsvpn.lua | 7 -- luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua | 44 ------------- luci-app-dsvpn/po/de/dsvpn.po | 50 -------------- luci-app-dsvpn/po/fr/dsvpn.po | 53 --------------- luci-app-dsvpn/po/it/dsvpn.po | 50 -------------- luci-app-dsvpn/po/oc/dsvpn.po | 50 -------------- luci-app-dsvpn/po/templates/dsvpn.pot | 41 ------------ luci-app-dsvpn/po/zh_Hans/dsvpn.po | 50 -------------- luci-app-dsvpn/po/zh_Hant/dsvpn.po | 50 -------------- .../usr/share/luci/menu.d/luci-app-dsvpn.json | 6 +- .../usr/share/rpcd/acl.d/luci-app-dsvpn.json | 2 +- 14 files changed, 81 insertions(+), 406 deletions(-) create mode 100644 luci-app-dsvpn/htdocs/luci-static/resources/view/services/dsvpn.js delete mode 100644 luci-app-dsvpn/luasrc/controller/dsvpn.lua delete mode 100644 luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua delete mode 100644 luci-app-dsvpn/po/de/dsvpn.po delete mode 100644 luci-app-dsvpn/po/fr/dsvpn.po delete mode 100644 luci-app-dsvpn/po/it/dsvpn.po delete mode 100644 luci-app-dsvpn/po/oc/dsvpn.po delete mode 100644 luci-app-dsvpn/po/templates/dsvpn.pot delete mode 100644 luci-app-dsvpn/po/zh_Hans/dsvpn.po delete mode 100644 luci-app-dsvpn/po/zh_Hant/dsvpn.po diff --git a/dsvpn/files/init b/dsvpn/files/init index 73a3457a3..250c409df 100755 --- a/dsvpn/files/init +++ b/dsvpn/files/init @@ -24,7 +24,9 @@ validate_section() { 'port:port' \ 'dev:string' \ 'localip:host' \ - 'remoteip:host' + 'remoteip:host' \ + 'mode:string:client' \ + 'externalip:string:auto' } start_instance() { @@ -39,7 +41,8 @@ start_instance() { [ -n "${key}" ] || return 1 [ "${key}" != "secretkey" ] || return 1 - [ -n "${port}" ] || return 1 + [ -z "${host}" ] && host="auto" + [ -z "${port}" ] && port="auto" [ -n "${dev}" ] || return 1 echo "${key}" > /tmp/${PROG_NAME}-${1}.key @@ -57,14 +60,15 @@ start_instance() { procd_open_instance - procd_set_param command ${PROG} client \ + procd_set_param command ${PROG} ${mode} \ /tmp/${PROG_NAME}-${1}.key \ $host \ $port \ $dev \ ${localip:+$localip} \ - ${remoteip:+$remoteip} \ - $(ip r get $host | awk '{print $3}' | tr -d "\n") + ${remoteip:+$remoteip} + [ "$mode" = "client" ] && procd_append_param command $(ip r get $host | awk '{print $3}' | tr -d "\n") + [ "$mode" = "server" ] && procd_append_param command externalip procd_set_param respawn 0 30 5 diff --git a/luci-app-dsvpn/Makefile b/luci-app-dsvpn/Makefile index d78150d98..cc5052f9d 100644 --- a/luci-app-dsvpn/Makefile +++ b/luci-app-dsvpn/Makefile @@ -1,11 +1,11 @@ # -# Copyright (C) 2018-2019 Ycarus (Yannick Chabanois) for OpenMPTCProuter +# Copyright (C) 2018-2020 Ycarus (Yannick Chabanois) # # include $(TOPDIR)/rules.mk -LUCI_TITLE:=LuCI Support for DSVPN +LUCI_TITLE:=LuCI Interface to DSVPN LUCI_DEPENDS:=+dsvpn PKG_LICENSE:=GPLv3 diff --git a/luci-app-dsvpn/htdocs/luci-static/resources/view/services/dsvpn.js b/luci-app-dsvpn/htdocs/luci-static/resources/view/services/dsvpn.js new file mode 100644 index 000000000..2f737b571 --- /dev/null +++ b/luci-app-dsvpn/htdocs/luci-static/resources/view/services/dsvpn.js @@ -0,0 +1,66 @@ +'use strict'; +'require rpc'; +'require form'; +'require fs'; +'require uci'; +'require tools.widgets as widgets'; + +var callHostHints; + +return L.view.extend({ + callHostHints: rpc.declare({ + object: 'luci-rpc', + method: 'getHostHints', + expect: { '': {} } + }), + + load: function() { + return this.callHostHints(); + }, + + render: function(hosts) { + var m, s, o; + + m = new form.Map('dsvpn', _('DSVPN')); + + s = m.section(form.GridSection, 'dsvpn', _('Instances')); + s.addremove = true; + s.anonymous = true; + s.nodescriptions = true; + + o = s.option(form.Flag, 'enable', _('Enabled')); + o.default = o.enabled; + + o = s.option(form.ListValue, 'mode', _('Mode')); + o.value('client',_('Client')); + o.value('server',_('Server')); + o.modalonly = true; + + o = s.option(form.Value, 'host', _('Host')); + o.rmempty = false; + + o = s.option(form.Value, 'port', _('Port')); + o.rmempty = false; + + o = s.option(form.Value, 'key', _('Key')); + o.rmempty = false; + o.modalonly = true; + + o = s.option(form.Value, 'dev', _('Interface name')); + o.rmempty = false; + o.modalonly = true; + + o = s.option(form.Value, 'localip', _('Local IP')); + o.datatype = 'or(ip4addr,ip6addr)'; + o.rmempty = false; + + o = s.option(form.Value, 'remoteip', _('Remote IP')); + o.datatype = 'or(ip4addr,ip6addr)'; + o.rmempty = false; + + o = s.option(form.Value, 'label', _('Label')); + o.rmempty = true; + + return m.render(); + } +}); diff --git a/luci-app-dsvpn/luasrc/controller/dsvpn.lua b/luci-app-dsvpn/luasrc/controller/dsvpn.lua deleted file mode 100644 index 99793584a..000000000 --- a/luci-app-dsvpn/luasrc/controller/dsvpn.lua +++ /dev/null @@ -1,7 +0,0 @@ -module("luci.controller.dsvpn", package.seeall) - -function index() - --entry({"admin", "openmptcprouter", "mlvpn"}, cbi("mlvpn"), _("DSVPN")) - --entry({"admin", "services", "dsvpn"}, cbi("dsvpn"), _("DSVPN")) - entry({"admin", "vpn", "dsvpn"}, cbi("dsvpn"), _("DSVPN")) -end diff --git a/luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua b/luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua deleted file mode 100644 index d0c6a3141..000000000 --- a/luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua +++ /dev/null @@ -1,44 +0,0 @@ -local net = require "luci.model.network".init() -local sys = require "luci.sys" -local ifaces = sys.net:devices() -local m, s, o - -m = Map("dsvpn", translate("DSVPN")) - -s = m:section(TypedSection, "dsvpn", translate("Settings")) -s.anonymous = true -s.addremove = false - -o = s:option(Flag, "enable", translate("Enable")) -o.rmempty = false - -o = s:option(Value, "host", translate("Remote host")) -o.placeholder = "128.128.128.128" -o.default = "128.128.128.128" -o.datatype = "host" -o.rmempty = false - -o = s:option(Value, "port", translate("Remote port")) -o.placeholder = "65011" -o.default = "65011" -o.datatype = "port" - -o = s:option(Value, "key", translate("Key")) -o.password = true -o.rmempty = false - - -o = s:option(Value, "localip", translate("Tunnel local IP")) -o.default = "10.255.251.2" -o.datatype = "host" - -o = s:option(Value, "remoteip", translate("Tunnel remote IP")) -o.default = "10.255.251.1" -o.datatype = "host" - -o = s:option(Value, "dev", translate("Interface name")) -o.placeholder = "tun0" -o.default = "tun0" -o.rmempty = false - -return m diff --git a/luci-app-dsvpn/po/de/dsvpn.po b/luci-app-dsvpn/po/de/dsvpn.po deleted file mode 100644 index 4bea475af..000000000 --- a/luci-app-dsvpn/po/de/dsvpn.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "" -msgstr "" -"PO-Revision-Date: 2020-10-05 12:39+0000\n" -"Last-Translator: Weblate Admin \n" -"Language-Team: German \n" -"Language: de\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.0.4\n" - -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:4 -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:5 -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:6 -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:6 -msgid "DSVPN" -msgstr "DSVPN" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:12 -msgid "Enable" -msgstr "Aktivieren" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:39 -msgid "Interface name" -msgstr "Name der Verbindung" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:26 -msgid "Key" -msgstr "Schlüssel" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:15 -msgid "Remote host" -msgstr "Gegenstelle (FQDN oder IP-Adresse)" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:21 -msgid "Remote port" -msgstr "Port der Gegenstelle" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:8 -msgid "Settings" -msgstr "Einstellungen" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:31 -msgid "Tunnel local IP" -msgstr "Lokale Tunnel-IP" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:35 -msgid "Tunnel remote IP" -msgstr "Gegenstellen-Tunnel-IP" diff --git a/luci-app-dsvpn/po/fr/dsvpn.po b/luci-app-dsvpn/po/fr/dsvpn.po deleted file mode 100644 index 8f06d0390..000000000 --- a/luci-app-dsvpn/po/fr/dsvpn.po +++ /dev/null @@ -1,53 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: \n" -"POT-Creation-Date: \n" -"PO-Revision-Date: 2020-09-30 08:50+0000\n" -"Last-Translator: Anonymous \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" -"X-Generator: Weblate 4.0.4\n" - -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:4 -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:5 -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:6 -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:6 -msgid "DSVPN" -msgstr "DSVPN" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:12 -msgid "Enable" -msgstr "Activer" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:39 -msgid "Interface name" -msgstr "Nom de l'interface" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:26 -msgid "Key" -msgstr "Clé" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:15 -msgid "Remote host" -msgstr "Nom de l'hôte distant ou adresse IP" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:21 -msgid "Remote port" -msgstr "Port distant" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:8 -msgid "Settings" -msgstr "Paramètres" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:31 -msgid "Tunnel local IP" -msgstr "Adresse IP locale du tunnel" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:35 -msgid "Tunnel remote IP" -msgstr "Adresse IP distance du tunnel" diff --git a/luci-app-dsvpn/po/it/dsvpn.po b/luci-app-dsvpn/po/it/dsvpn.po deleted file mode 100644 index dd2cd86a2..000000000 --- a/luci-app-dsvpn/po/it/dsvpn.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "" -msgstr "" -"PO-Revision-Date: 2020-09-21 12:51+0000\n" -"Last-Translator: Weblate Admin \n" -"Language-Team: Italian \n" -"Language: it\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.0.4\n" - -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:4 -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:5 -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:6 -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:6 -msgid "DSVPN" -msgstr "DSVPN" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:12 -msgid "Enable" -msgstr "Attivare" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:39 -msgid "Interface name" -msgstr "Nome interfaccia" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:26 -msgid "Key" -msgstr "Key" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:15 -msgid "Remote host" -msgstr "Rimuovi server" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:21 -msgid "Remote port" -msgstr "Porta remota" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:8 -msgid "Settings" -msgstr "Impostazioni" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:31 -msgid "Tunnel local IP" -msgstr "IP locale del tunnel" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:35 -msgid "Tunnel remote IP" -msgstr "IP remoto del tunnel" diff --git a/luci-app-dsvpn/po/oc/dsvpn.po b/luci-app-dsvpn/po/oc/dsvpn.po deleted file mode 100644 index 4a806fe56..000000000 --- a/luci-app-dsvpn/po/oc/dsvpn.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "" -msgstr "" -"PO-Revision-Date: 2020-08-18 17:37+0000\n" -"Last-Translator: Quentin PAGÈS \n" -"Language-Team: Occitan \n" -"Language: oc\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.0.4\n" - -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:4 -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:5 -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:6 -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:6 -msgid "DSVPN" -msgstr "DSVPN" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:12 -msgid "Enable" -msgstr "Activat" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:39 -msgid "Interface name" -msgstr "Nom de l’interfàcia" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:26 -msgid "Key" -msgstr "Clau" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:15 -msgid "Remote host" -msgstr "Nom de l’òste distant o adreça IP" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:21 -msgid "Remote port" -msgstr "Pòrt distant" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:8 -msgid "Settings" -msgstr "Paramètres" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:31 -msgid "Tunnel local IP" -msgstr "Adreça IP locala del tunèl" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:35 -msgid "Tunnel remote IP" -msgstr "Adreça IP distanta del tunèl" diff --git a/luci-app-dsvpn/po/templates/dsvpn.pot b/luci-app-dsvpn/po/templates/dsvpn.pot deleted file mode 100644 index bc26ff694..000000000 --- a/luci-app-dsvpn/po/templates/dsvpn.pot +++ /dev/null @@ -1,41 +0,0 @@ -msgid "" -msgstr "Content-Type: text/plain; charset=UTF-8" - -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:4 -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:5 -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:6 -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:6 -msgid "DSVPN" -msgstr "" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:12 -msgid "Enable" -msgstr "" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:39 -msgid "Interface name" -msgstr "" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:26 -msgid "Key" -msgstr "" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:15 -msgid "Remote host" -msgstr "" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:21 -msgid "Remote port" -msgstr "" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:8 -msgid "Settings" -msgstr "" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:31 -msgid "Tunnel local IP" -msgstr "" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:35 -msgid "Tunnel remote IP" -msgstr "" diff --git a/luci-app-dsvpn/po/zh_Hans/dsvpn.po b/luci-app-dsvpn/po/zh_Hans/dsvpn.po deleted file mode 100644 index f847c0504..000000000 --- a/luci-app-dsvpn/po/zh_Hans/dsvpn.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "" -msgstr "" -"PO-Revision-Date: 2020-06-11 16:36+0000\n" -"Last-Translator: antrouter \n" -"Language-Team: Chinese (Simplified) \n" -"Language: zh_Hans\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.0.4\n" - -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:4 -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:5 -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:6 -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:6 -msgid "DSVPN" -msgstr "DS虚拟专网" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:12 -msgid "Enable" -msgstr "开启" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:39 -msgid "Interface name" -msgstr "网卡名称" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:26 -msgid "Key" -msgstr "秘钥" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:15 -msgid "Remote host" -msgstr "远程主机" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:21 -msgid "Remote port" -msgstr "远程端口" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:8 -msgid "Settings" -msgstr "设置" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:31 -msgid "Tunnel local IP" -msgstr "隧道本地IP" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:35 -msgid "Tunnel remote IP" -msgstr "隧道远程IP" diff --git a/luci-app-dsvpn/po/zh_Hant/dsvpn.po b/luci-app-dsvpn/po/zh_Hant/dsvpn.po deleted file mode 100644 index 858741a28..000000000 --- a/luci-app-dsvpn/po/zh_Hant/dsvpn.po +++ /dev/null @@ -1,50 +0,0 @@ -msgid "" -msgstr "" -"PO-Revision-Date: 2020-07-09 07:31+0000\n" -"Last-Translator: antrouter \n" -"Language-Team: Chinese (Traditional) \n" -"Language: zh_Hant\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.0.4\n" - -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:4 -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:5 -#: luci-app-dsvpn/luasrc/controller/dsvpn.lua:6 -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:6 -msgid "DSVPN" -msgstr "DS虛擬專用網" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:12 -msgid "Enable" -msgstr "啟用" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:39 -msgid "Interface name" -msgstr "接口名稱" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:26 -msgid "Key" -msgstr "秘鑰" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:15 -msgid "Remote host" -msgstr "遠程主機" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:21 -msgid "Remote port" -msgstr "遠端埠" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:8 -msgid "Settings" -msgstr "設定" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:31 -msgid "Tunnel local IP" -msgstr "隧道本地IP" - -#: luci-app-dsvpn/luasrc/model/cbi/dsvpn.lua:35 -msgid "Tunnel remote IP" -msgstr "隧道遠程IP" diff --git a/luci-app-dsvpn/root/usr/share/luci/menu.d/luci-app-dsvpn.json b/luci-app-dsvpn/root/usr/share/luci/menu.d/luci-app-dsvpn.json index 257a29fab..49ebec311 100644 --- a/luci-app-dsvpn/root/usr/share/luci/menu.d/luci-app-dsvpn.json +++ b/luci-app-dsvpn/root/usr/share/luci/menu.d/luci-app-dsvpn.json @@ -1,10 +1,10 @@ { "admin/vpn/dsvpn": { "title": "DSVPN", - "order": 10, + "order": 60, "action": { - "type": "cbi", - "path": "dsvpn" + "type": "view", + "path": "services/dsvpn" }, "depends": { "acl": [ "luci-app-dsvpn" ] diff --git a/luci-app-dsvpn/root/usr/share/rpcd/acl.d/luci-app-dsvpn.json b/luci-app-dsvpn/root/usr/share/rpcd/acl.d/luci-app-dsvpn.json index c4c7f00c9..e11c9127c 100644 --- a/luci-app-dsvpn/root/usr/share/rpcd/acl.d/luci-app-dsvpn.json +++ b/luci-app-dsvpn/root/usr/share/rpcd/acl.d/luci-app-dsvpn.json @@ -1,6 +1,6 @@ { "luci-app-dsvpn": { - "description": "Grant UCI access for luci-app-dsvpn", + "description": "Grant access to DSVPN", "read": { "uci": [ "dsvpn" ] }, From 4a825c5650fffe9fddce96c264fefac6152f3cd9 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:22:39 +0100 Subject: [PATCH 30/45] New interface for mlvpn VPN --- luci-app-mlvpn/Makefile | 6 +- .../resources/view/services/mlvpn.js | 83 +++++++++++++++++++ luci-app-mlvpn/luasrc/controller/mlvpn.lua | 7 -- luci-app-mlvpn/luasrc/model/cbi/mlvpn.lua | 77 ----------------- .../luasrc/view/mlvpn/cbi-select-add.htm | 10 --- luci-app-mlvpn/po/de/mlvpn.po | 59 ------------- luci-app-mlvpn/po/fr/mlvpn.po | 62 -------------- luci-app-mlvpn/po/it/mlvpn.po | 59 ------------- luci-app-mlvpn/po/templates/mlvpn.pot | 50 ----------- luci-app-mlvpn/po/zh_Hans/mlvpn.po | 59 ------------- .../usr/share/luci/menu.d/luci-app-mlvpn.json | 4 +- 11 files changed, 88 insertions(+), 388 deletions(-) create mode 100644 luci-app-mlvpn/htdocs/luci-static/resources/view/services/mlvpn.js delete mode 100644 luci-app-mlvpn/luasrc/controller/mlvpn.lua delete mode 100644 luci-app-mlvpn/luasrc/model/cbi/mlvpn.lua delete mode 100644 luci-app-mlvpn/luasrc/view/mlvpn/cbi-select-add.htm delete mode 100644 luci-app-mlvpn/po/de/mlvpn.po delete mode 100644 luci-app-mlvpn/po/fr/mlvpn.po delete mode 100644 luci-app-mlvpn/po/it/mlvpn.po delete mode 100644 luci-app-mlvpn/po/templates/mlvpn.pot delete mode 100644 luci-app-mlvpn/po/zh_Hans/mlvpn.po diff --git a/luci-app-mlvpn/Makefile b/luci-app-mlvpn/Makefile index 33548c8e9..80d97c856 100644 --- a/luci-app-mlvpn/Makefile +++ b/luci-app-mlvpn/Makefile @@ -1,12 +1,12 @@ # -# Copyright (C) 2018-2019 Ycarus (Yannick Chabanois) +# Copyright (C) 2018-2020 Ycarus (Yannick Chabanois) # # include $(TOPDIR)/rules.mk -LUCI_TITLE:=LuCI Support for MLVPN -LUCI_DEPENDS:=+mlvpn +LUCI_TITLE:=LuCI Interface to Glorytun TCP +LUCI_DEPENDS:=+glorytun PKG_LICENSE:=GPLv3 diff --git a/luci-app-mlvpn/htdocs/luci-static/resources/view/services/mlvpn.js b/luci-app-mlvpn/htdocs/luci-static/resources/view/services/mlvpn.js new file mode 100644 index 000000000..8dcfb422b --- /dev/null +++ b/luci-app-mlvpn/htdocs/luci-static/resources/view/services/mlvpn.js @@ -0,0 +1,83 @@ +'use strict'; +'require rpc'; +'require form'; +'require fs'; +'require uci'; +'require tools.widgets as widgets'; + +var callHostHints; + +return L.view.extend({ + callHostHints: rpc.declare({ + object: 'luci-rpc', + method: 'getHostHints', + expect: { '': {} } + }), + + load: function() { + return this.callHostHints(); + }, + + render: function(hosts) { + var m, s, o; + + m = new form.Map('mlvpn', _('MLVPN')); + + s = m.section(form.GridSection, 'mlvpn', _('Instances')); + s.addremove = true; + s.anonymous = true; + s.nodescriptions = true; + + s.tab('general', _('General Settings')); + s.tab('advanced', _('Advanced Settings')); + + o = s.taboption('general', form.Flag, 'enable', _('Enabled')); + o.default = o.enabled; + + o = s.taboption('general', form.ListValue, 'mode', _('Mode')); + o.value('client',_('Client')); + o.value('server',_('Server')); + o.modalonly = true; + + o = s.taboption('general', form.Value, 'host', _('Host')); + o.rmempty = false; + + o = s.taboption('general', form.Value, 'firstport', _('First Port')); + o.default = "65201" + o.datatype = "port" + o.rmempty = false; + + o = s.taboption('general', form.Value, 'password', _('Password')); + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('general', form.Value, 'interface_name', _('Interface name')); + o.default = "mlvpn0" + o.placeholder = "mlvpn0" + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('advanced', form.Value, 'timeout', _('Timeout (s)')); + o.default = '30'; + o.datatype = "uinteger" + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('advanced', form.Value, 'reorder_buffer_size', _('Reorder buffer size')); + o.default = '128'; + o.datatype = "uinteger" + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('advanced', form.Value, 'loss_tolerance', _('Loss tolerance')); + o.default = '50'; + o.datatype = "uinteger" + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('general',form.Value, 'label', _('Label')); + o.rmempty = true; + + return m.render(); + } +}); diff --git a/luci-app-mlvpn/luasrc/controller/mlvpn.lua b/luci-app-mlvpn/luasrc/controller/mlvpn.lua deleted file mode 100644 index 154222265..000000000 --- a/luci-app-mlvpn/luasrc/controller/mlvpn.lua +++ /dev/null @@ -1,7 +0,0 @@ -module("luci.controller.mlvpn", package.seeall) - -function index() - --entry({"admin", "openmptcprouter", "mlvpn"}, cbi("mlvpn"), _("MLVPN")) - --entry({"admin", "services", "mlvpn"}, cbi("mlvpn"), _("MLVPN")) - entry({"admin", "vpn", "mlvpn"}, cbi("mlvpn"), _("MLVPN")) -end diff --git a/luci-app-mlvpn/luasrc/model/cbi/mlvpn.lua b/luci-app-mlvpn/luasrc/model/cbi/mlvpn.lua deleted file mode 100644 index eaef23d7e..000000000 --- a/luci-app-mlvpn/luasrc/model/cbi/mlvpn.lua +++ /dev/null @@ -1,77 +0,0 @@ -local net = require "luci.model.network".init() -local sys = require "luci.sys" -local ifaces = sys.net:devices() -local m, s, o - -m = Map("mlvpn", translate("MLVPN")) - -s = m:section(TypedSection, "mlvpn", translate("Settings")) -s.anonymous = true -s.addremove = false - -o = s:option(Flag, "enable", translate("Enable")) -o.rmempty = false - -o = s:option(Value, "timeout", translate("Timeout (s)")) -o.placeholder = "30" -o.default = "30" -o.datatype = "uinteger" -o.rmempty = false - -o = s:option(Value, "reorder_buffer_size", translate("Reorder buffer size")) -o.placeholder = "64" -o.default = "64" -o.datatype = "uinteger" -o.rmempty = false - -o = s:option(Value, "loss_tolerance", translate("Loss tolerance")) -o.placeholder = "50" -o.default = "50" -o.datatype = "uinteger" -o.rmempty = false - -o = s:option(Value, "host", translate("Remote host")) -o.placeholder = "128.128.128.128" -o.default = "128.128.128.128" -o.datatype = "host" -o.rmempty = false - -o = s:option(Value, "firstport", translate("First remote port"),translate("Interface will increase port used beginning with this")) -o.default = "65201" -o.datatype = "port" -o.rmempty = false - -o = s:option(Value, "password", translate("Password")) -o.password = true -o.rmempty = false - - -o = s:option(Value, "interface_name", translate("Interface name")) -o.placeholder = "mlvpn0" -o.default = "mlvpn0" -o.rmempty = false - ---o = s:option(Value, "mode", translate("Mode")) ---o:value("client") ---o:value("server") ---o.default = "client" ---o.rmempty = false - - ---s = m:section(TypedSection, "interface", translate("Interfaces")) ---s.template_addremove = "mlvpn/cbi-select-add" ---s.addremove = true ---s.add_select_options = { } ---s.add_select_options[''] = '' ---for _, iface in ipairs(ifaces) do --- if not (iface == "lo" or iface:match("^ifb.*")) then --- s.add_select_options[iface] = iface --- end ---end - ---o = s:option(Value, "port", translate("Remote/Bind port")) ---o.placeholder = "65201" ---o.default = "65201" ---o.datatype = "port" - -return m diff --git a/luci-app-mlvpn/luasrc/view/mlvpn/cbi-select-add.htm b/luci-app-mlvpn/luasrc/view/mlvpn/cbi-select-add.htm deleted file mode 100644 index 97ee647d2..000000000 --- a/luci-app-mlvpn/luasrc/view/mlvpn/cbi-select-add.htm +++ /dev/null @@ -1,10 +0,0 @@ -
- <% if self.invalid_cts then -%>
<% end %> - - - <% if self.invalid_cts then %>
<%:Invalid%>
<% end %> -
diff --git a/luci-app-mlvpn/po/de/mlvpn.po b/luci-app-mlvpn/po/de/mlvpn.po deleted file mode 100644 index f60844ce4..000000000 --- a/luci-app-mlvpn/po/de/mlvpn.po +++ /dev/null @@ -1,59 +0,0 @@ -msgid "" -msgstr "" -"PO-Revision-Date: 2020-10-05 12:39+0000\n" -"Last-Translator: Weblate Admin \n" -"Language-Team: German \n" -"Language: de\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.0.4\n" - -msgid "Add" -msgstr "Hinzufügen" - -msgid "Enable" -msgstr "Aktivieren" - -msgid "First remote port" -msgstr "Erster Gegenstellen-Port" - -msgid "Interface name" -msgstr "Name der Verbindung" - -msgid "Interface will increase port used beginning with this" -msgstr "Der Anschluss wird die Pornummern nutzen beginnend mit diesem Wert" - -msgid "Interfaces" -msgstr "Anschlüsse" - -msgid "Invalid" -msgstr "Ungültig" - -msgid "Loss tolerance" -msgstr "Verlust-Toleranz" - -msgid "MLVPN" -msgstr "MLVPN" - -msgid "Mode" -msgstr "Betriebsmodus" - -msgid "Password" -msgstr "Schlüssel" - -msgid "Remote host" -msgstr "Gegenstelle (FQDN oder IP-Adresse)" - -msgid "Remote/Bind port" -msgstr "Portnummer der Gegenstelle" - -msgid "Reorder buffer size" -msgstr "Größe des Sortierpuffers" - -msgid "Settings" -msgstr "Einstellungen" - -msgid "Timeout (s)" -msgstr "Wartezeit (in Sekunden)" diff --git a/luci-app-mlvpn/po/fr/mlvpn.po b/luci-app-mlvpn/po/fr/mlvpn.po deleted file mode 100644 index af2708373..000000000 --- a/luci-app-mlvpn/po/fr/mlvpn.po +++ /dev/null @@ -1,62 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: \n" -"POT-Creation-Date: \n" -"PO-Revision-Date: 2020-10-07 10:57+0000\n" -"Last-Translator: Weblate Admin \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" -"X-Generator: Weblate 4.0.4\n" - -msgid "Add" -msgstr "Ajouter" - -msgid "Enable" -msgstr "Activer" - -msgid "First remote port" -msgstr "Premier port distant" - -msgid "Interface name" -msgstr "Nom de l'interface" - -msgid "Interface will increase port used beginning with this" -msgstr "L'interface augmentera le port utilisé à partir de celui ci" - -msgid "Interfaces" -msgstr "Interfaces" - -msgid "Invalid" -msgstr "Invalide" - -msgid "Loss tolerance" -msgstr "Tolérance aux pertes" - -msgid "MLVPN" -msgstr "MLVPN" - -msgid "Mode" -msgstr "Mode" - -msgid "Password" -msgstr "Mot de passe" - -msgid "Remote host" -msgstr "Nom de l'hôte distant ou adresse IP" - -msgid "Remote/Bind port" -msgstr "Port de connexion distant" - -msgid "Reorder buffer size" -msgstr "Taille du tampon de réordonnancement" - -msgid "Settings" -msgstr "Paramètres" - -msgid "Timeout (s)" -msgstr "Délais d'attente (s)" diff --git a/luci-app-mlvpn/po/it/mlvpn.po b/luci-app-mlvpn/po/it/mlvpn.po deleted file mode 100644 index f7c495c5c..000000000 --- a/luci-app-mlvpn/po/it/mlvpn.po +++ /dev/null @@ -1,59 +0,0 @@ -msgid "" -msgstr "" -"PO-Revision-Date: 2020-09-21 12:51+0000\n" -"Last-Translator: Weblate Admin \n" -"Language-Team: Italian \n" -"Language: it\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.0.4\n" - -msgid "Add" -msgstr "Aggiungi" - -msgid "Enable" -msgstr "Attivare" - -msgid "First remote port" -msgstr "Prima porta remota" - -msgid "Interface name" -msgstr "Nome interfaccia" - -msgid "Interface will increase port used beginning with this" -msgstr "L'interfaccia aumenterà la porta utilizzata a partire da questa" - -msgid "Interfaces" -msgstr "Interfaccia" - -msgid "Invalid" -msgstr "Non valido" - -msgid "Loss tolerance" -msgstr "Tolleranza alla perdita" - -msgid "MLVPN" -msgstr "MLVPN" - -msgid "Mode" -msgstr "Modo" - -msgid "Password" -msgstr "Password" - -msgid "Remote host" -msgstr "Rimuovi server" - -msgid "Remote/Bind port" -msgstr "Porta remota / Bind" - -msgid "Reorder buffer size" -msgstr "" - -msgid "Settings" -msgstr "Impostazioni" - -msgid "Timeout (s)" -msgstr "" diff --git a/luci-app-mlvpn/po/templates/mlvpn.pot b/luci-app-mlvpn/po/templates/mlvpn.pot deleted file mode 100644 index 0eecd2f65..000000000 --- a/luci-app-mlvpn/po/templates/mlvpn.pot +++ /dev/null @@ -1,50 +0,0 @@ -msgid "" -msgstr "Content-Type: text/plain; charset=UTF-8" - -msgid "Add" -msgstr "" - -msgid "Enable" -msgstr "" - -msgid "First remote port" -msgstr "" - -msgid "Interface name" -msgstr "" - -msgid "Interface will increase port used beginning with this" -msgstr "" - -msgid "Interfaces" -msgstr "" - -msgid "Invalid" -msgstr "" - -msgid "Loss tolerance" -msgstr "" - -msgid "MLVPN" -msgstr "" - -msgid "Mode" -msgstr "" - -msgid "Password" -msgstr "" - -msgid "Remote host" -msgstr "" - -msgid "Remote/Bind port" -msgstr "" - -msgid "Reorder buffer size" -msgstr "" - -msgid "Settings" -msgstr "" - -msgid "Timeout (s)" -msgstr "" diff --git a/luci-app-mlvpn/po/zh_Hans/mlvpn.po b/luci-app-mlvpn/po/zh_Hans/mlvpn.po deleted file mode 100644 index eca37c59d..000000000 --- a/luci-app-mlvpn/po/zh_Hans/mlvpn.po +++ /dev/null @@ -1,59 +0,0 @@ -msgid "" -msgstr "" -"PO-Revision-Date: 2020-06-11 16:36+0000\n" -"Last-Translator: antrouter \n" -"Language-Team: Chinese (Simplified) \n" -"Language: zh_Hans\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.0.4\n" - -msgid "Add" -msgstr "添加" - -msgid "Enable" -msgstr "开启" - -msgid "First remote port" -msgstr "第一个远程端口" - -msgid "Interface name" -msgstr "网卡名称" - -msgid "Interface will increase port used beginning with this" -msgstr "接口将从此开始增加使用的端口" - -msgid "Interfaces" -msgstr "网卡" - -msgid "Invalid" -msgstr "无效" - -msgid "Loss tolerance" -msgstr "损失容忍" - -msgid "MLVPN" -msgstr "MLVPN设置" - -msgid "Mode" -msgstr "模式" - -msgid "Password" -msgstr "密码" - -msgid "Remote host" -msgstr "远程主机" - -msgid "Remote/Bind port" -msgstr "远程/绑定端口" - -msgid "Reorder buffer size" -msgstr "重新排序缓冲区大小" - -msgid "Settings" -msgstr "设置" - -msgid "Timeout (s)" -msgstr "超时 (秒)" diff --git a/luci-app-mlvpn/root/usr/share/luci/menu.d/luci-app-mlvpn.json b/luci-app-mlvpn/root/usr/share/luci/menu.d/luci-app-mlvpn.json index 085d95305..90afc4494 100644 --- a/luci-app-mlvpn/root/usr/share/luci/menu.d/luci-app-mlvpn.json +++ b/luci-app-mlvpn/root/usr/share/luci/menu.d/luci-app-mlvpn.json @@ -3,8 +3,8 @@ "title": "MLVPN", "order": 30, "action": { - "type": "cbi", - "path": "mlvpn" + "type": "view", + "path": "services/mlvpn" }, "depends": { "acl": [ "luci-app-mlvpn" ] From 9ceaa526a56020e77c5b8fb34e154d1c9c697419 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:23:34 +0100 Subject: [PATCH 31/45] New interface for Glorytun TCP VPN --- glorytun/glorytun.config | 3 +- glorytun/init | 9 +- luci-app-glorytun-tcp/Makefile | 16 ++ .../resources/view/services/glorytun-tcp.js | 87 +++++++++++ .../root/etc/hotplug.d/iface/30-glorytun | 0 .../root/etc/uci-defaults/1200-luci-glorytun | 0 .../luci/menu.d/luci-app-glorytun-tcp.json | 13 ++ .../rpcd/acl.d/luci-app-glorytun-tcp.json | 4 +- luci-app-glorytun/Makefile | 21 --- .../luasrc/controller/glorytun.lua | 14 -- .../luasrc/model/cbi/glorytun-settings.lua | 83 ---------- .../luasrc/model/cbi/glorytun.lua | 147 ------------------ .../view/glorytun/cbi-select-input-add.htm | 11 -- .../luasrc/view/glorytun/pageswitch.htm | 13 -- luci-app-glorytun/po/de/glorytun.po | 104 ------------- luci-app-glorytun/po/fr/glorytun.po | 104 ------------- luci-app-glorytun/po/it/glorytun.po | 104 ------------- luci-app-glorytun/po/oc/glorytun.po | 103 ------------ luci-app-glorytun/po/templates/glorytun.pot | 93 ----------- luci-app-glorytun/po/zh_Hans/glorytun.po | 102 ------------ luci-app-glorytun/po/zh_Hant/glorytun.po | 102 ------------ .../root/etc/config/glorytun_recipes | 50 ------ .../share/luci/menu.d/luci-app-glorytun.json | 13 -- 23 files changed, 125 insertions(+), 1071 deletions(-) create mode 100644 luci-app-glorytun-tcp/Makefile create mode 100644 luci-app-glorytun-tcp/htdocs/luci-static/resources/view/services/glorytun-tcp.js rename {luci-app-glorytun => luci-app-glorytun-tcp}/root/etc/hotplug.d/iface/30-glorytun (100%) rename {luci-app-glorytun => luci-app-glorytun-tcp}/root/etc/uci-defaults/1200-luci-glorytun (100%) create mode 100644 luci-app-glorytun-tcp/root/usr/share/luci/menu.d/luci-app-glorytun-tcp.json rename luci-app-glorytun/root/usr/share/rpcd/acl.d/luci-app-glorytun.json => luci-app-glorytun-tcp/root/usr/share/rpcd/acl.d/luci-app-glorytun-tcp.json (51%) delete mode 100644 luci-app-glorytun/Makefile delete mode 100644 luci-app-glorytun/luasrc/controller/glorytun.lua delete mode 100644 luci-app-glorytun/luasrc/model/cbi/glorytun-settings.lua delete mode 100644 luci-app-glorytun/luasrc/model/cbi/glorytun.lua delete mode 100644 luci-app-glorytun/luasrc/view/glorytun/cbi-select-input-add.htm delete mode 100644 luci-app-glorytun/luasrc/view/glorytun/pageswitch.htm delete mode 100644 luci-app-glorytun/po/de/glorytun.po delete mode 100644 luci-app-glorytun/po/fr/glorytun.po delete mode 100644 luci-app-glorytun/po/it/glorytun.po delete mode 100644 luci-app-glorytun/po/oc/glorytun.po delete mode 100644 luci-app-glorytun/po/templates/glorytun.pot delete mode 100644 luci-app-glorytun/po/zh_Hans/glorytun.po delete mode 100644 luci-app-glorytun/po/zh_Hant/glorytun.po delete mode 100644 luci-app-glorytun/root/etc/config/glorytun_recipes delete mode 100644 luci-app-glorytun/root/usr/share/luci/menu.d/luci-app-glorytun.json diff --git a/glorytun/glorytun.config b/glorytun/glorytun.config index 9ee6e41e6..33c93f36f 100644 --- a/glorytun/glorytun.config +++ b/glorytun/glorytun.config @@ -10,4 +10,5 @@ config glorytun 'vpn' option mtuauto '1' option localip '10.255.255.2' option remoteip '10.255.255.1' - option multiqueue '1' \ No newline at end of file + option multiqueue '1' + option label 'Default VPN' \ No newline at end of file diff --git a/glorytun/init b/glorytun/init index 5d0233157..f5b868323 100755 --- a/glorytun/init +++ b/glorytun/init @@ -22,17 +22,18 @@ validate_section() { uci_validate_section glorytun glorytun "${1}" \ 'enable:bool:0' \ 'mptcp:bool:0' \ - 'listener:bool:0' \ + 'mode:string' \ 'key:string' \ 'host:host' \ 'port:port' \ 'dev:string' \ + 'timeout:uinteger:10000' \ 'chacha20:bool:0' \ 'proto:string' } start_instance() { - local enable key host port dev listener mptcp proto chacha20 + local enable key host port dev mptcp proto chacha20 mode multiqueue timeout validate_section "${1}" || { _err "validation failed" @@ -71,14 +72,14 @@ start_instance() { ${host:+host "$host"} \ ${dev:+dev "$dev"} - [ "${listener}" = "1" ] && procd_append_param command listener + [ "${mode}" = "listener" ] && procd_append_param command listener [ "${mptcp}" = "1" ] && procd_append_param command mptcp [ "${chacha20}" = "1" ] && procd_append_param command chacha20 [ "${multiqueue}" = "1" ] && procd_append_param command multiqueue procd_append_param command \ retry count -1 const 500000 \ - timeout 10000 \ + timeout ${timeout} \ keepalive count 5 idle 20 interval 2 \ buffer-size 32768 diff --git a/luci-app-glorytun-tcp/Makefile b/luci-app-glorytun-tcp/Makefile new file mode 100644 index 000000000..80d97c856 --- /dev/null +++ b/luci-app-glorytun-tcp/Makefile @@ -0,0 +1,16 @@ +# +# Copyright (C) 2018-2020 Ycarus (Yannick Chabanois) +# +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI Interface to Glorytun TCP +LUCI_DEPENDS:=+glorytun + +PKG_LICENSE:=GPLv3 + +#include ../luci/luci.mk +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-glorytun-tcp/htdocs/luci-static/resources/view/services/glorytun-tcp.js b/luci-app-glorytun-tcp/htdocs/luci-static/resources/view/services/glorytun-tcp.js new file mode 100644 index 000000000..e4045f267 --- /dev/null +++ b/luci-app-glorytun-tcp/htdocs/luci-static/resources/view/services/glorytun-tcp.js @@ -0,0 +1,87 @@ +'use strict'; +'require rpc'; +'require form'; +'require fs'; +'require uci'; +'require tools.widgets as widgets'; + +var callHostHints; + +return L.view.extend({ + callHostHints: rpc.declare({ + object: 'luci-rpc', + method: 'getHostHints', + expect: { '': {} } + }), + + load: function() { + return this.callHostHints(); + }, + + render: function(hosts) { + var m, s, o; + + m = new form.Map('glorytun', _('Glorytun TCP')); + + s = m.section(form.GridSection, 'glorytun', _('Instances')); + s.addremove = true; + s.anonymous = true; + s.nodescriptions = true; + + s.tab('general', _('General Settings')); + s.tab('advanced', _('Advanced Settings')); + + o = s.taboption('general', form.Flag, 'enable', _('Enabled')); + o.default = o.enabled; + + o = s.taboption('general', form.ListValue, 'mode', _('Mode')); + o.value('',_('Client')); + o.value('listener',_('Server')); + o.modalonly = true; + + o = s.taboption('general', form.Value, 'host', _('Host')); + o.rmempty = false; + + o = s.taboption('general', form.Value, 'port', _('Port')); + o.rmempty = false; + + o = s.taboption('general', form.Value, 'key', _('Key')); + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('general', form.Value, 'dev', _('Interface name')); + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('general', form.Value, 'localip', _('Local IP')); + o.datatype = 'or(ip4addr,ip6addr)'; + o.rmempty = false; + + o = s.taboption('general', form.Value, 'remoteip', _('Remote IP')); + o.datatype = 'or(ip4addr,ip6addr)'; + o.rmempty = false; + + o = s.taboption('advanced', form.Flag, 'mptcp', _('MPTCP')); + o.default = o.enabled; + o.modalonly = true; + + o = s.taboption('advanced', form.Flag, 'chacha20', _('chacha'), _('Force fallback cipher')); + o.default = o.enabled; + o.modalonly = true; + + o = s.taboption('advanced', form.Value, 'timeout', _('Timeout')); + o.default = '10000'; + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('advanced', form.Flag, 'multiqueue', _('Multiqueue')); + o.default = o.enabled; + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('general',form.Value, 'label', _('Label')); + o.rmempty = true; + + return m.render(); + } +}); diff --git a/luci-app-glorytun/root/etc/hotplug.d/iface/30-glorytun b/luci-app-glorytun-tcp/root/etc/hotplug.d/iface/30-glorytun similarity index 100% rename from luci-app-glorytun/root/etc/hotplug.d/iface/30-glorytun rename to luci-app-glorytun-tcp/root/etc/hotplug.d/iface/30-glorytun diff --git a/luci-app-glorytun/root/etc/uci-defaults/1200-luci-glorytun b/luci-app-glorytun-tcp/root/etc/uci-defaults/1200-luci-glorytun similarity index 100% rename from luci-app-glorytun/root/etc/uci-defaults/1200-luci-glorytun rename to luci-app-glorytun-tcp/root/etc/uci-defaults/1200-luci-glorytun diff --git a/luci-app-glorytun-tcp/root/usr/share/luci/menu.d/luci-app-glorytun-tcp.json b/luci-app-glorytun-tcp/root/usr/share/luci/menu.d/luci-app-glorytun-tcp.json new file mode 100644 index 000000000..03e7dcf7a --- /dev/null +++ b/luci-app-glorytun-tcp/root/usr/share/luci/menu.d/luci-app-glorytun-tcp.json @@ -0,0 +1,13 @@ +{ + "admin/vpn/glorytun-tcp": { + "title": "Glorytun TCP", + "order": 60, + "action": { + "type": "view", + "path": "services/glorytun-tcp" + }, + "depends": { + "acl": [ "luci-app-glorytun-tcp" ] + } + } +} diff --git a/luci-app-glorytun/root/usr/share/rpcd/acl.d/luci-app-glorytun.json b/luci-app-glorytun-tcp/root/usr/share/rpcd/acl.d/luci-app-glorytun-tcp.json similarity index 51% rename from luci-app-glorytun/root/usr/share/rpcd/acl.d/luci-app-glorytun.json rename to luci-app-glorytun-tcp/root/usr/share/rpcd/acl.d/luci-app-glorytun-tcp.json index 63a49918f..f4f288835 100644 --- a/luci-app-glorytun/root/usr/share/rpcd/acl.d/luci-app-glorytun.json +++ b/luci-app-glorytun-tcp/root/usr/share/rpcd/acl.d/luci-app-glorytun-tcp.json @@ -1,6 +1,6 @@ { - "luci-app-glorytun": { - "description": "Grant UCI access for luci-app-glorytun", + "luci-app-glorytun-tcp": { + "description": "Grant access to glorytun TCP", "read": { "uci": [ "glorytun" ] }, diff --git a/luci-app-glorytun/Makefile b/luci-app-glorytun/Makefile deleted file mode 100644 index b582773b2..000000000 --- a/luci-app-glorytun/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# -# Copyright (C) 2008-2014 The LuCI Team -# Copyright (C) 2017-2019 Ycarus (Yannick Chabanois) -# -# This is based on OpenVPN LuCI Support. -# This is free software, licensed under the Apache License, Version 2.0 . -# - -include $(TOPDIR)/rules.mk - -LUCI_TITLE:=LuCI Support for Glorytun -LUCI_DEPENDS:=+glorytun +glorytun-udp -LUCI_PKGARCH:=all -PKG_LICENSE:=GPLv2 - -PKG_MAINTAINER:=Ycarus (Yannick Chabanois) - -#include ../luci/luci.mk -include $(TOPDIR)/feeds/luci/luci.mk - -# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-glorytun/luasrc/controller/glorytun.lua b/luci-app-glorytun/luasrc/controller/glorytun.lua deleted file mode 100644 index c9917bb74..000000000 --- a/luci-app-glorytun/luasrc/controller/glorytun.lua +++ /dev/null @@ -1,14 +0,0 @@ --- Copyright 2018 - 2019 Ycarus (Yannick Chabanois) --- Licensed to the public under the Apache License 2.0. - -module("luci.controller.glorytun", package.seeall) - -function index() - if not nixio.fs.access("/etc/config/glorytun") then - return - end - --entry({"admin", "services", "glorytun"}, cbi("glorytun"), _("Glorytun") ) - --entry({"admin", "services", "glorytun", "settings"}, cbi("glorytun-settings"), nil ).leaf = true - entry({"admin", "vpn", "glorytun"}, cbi("glorytun"), _("Glorytun") ) - entry({"admin", "vpn", "glorytun", "settings"}, cbi("glorytun-settings"), nil ).leaf = true -end diff --git a/luci-app-glorytun/luasrc/model/cbi/glorytun-settings.lua b/luci-app-glorytun/luasrc/model/cbi/glorytun-settings.lua deleted file mode 100644 index aab2f460c..000000000 --- a/luci-app-glorytun/luasrc/model/cbi/glorytun-settings.lua +++ /dev/null @@ -1,83 +0,0 @@ --- Copyright 2018 Ycarus (Yannick Chabanois) --- Copyright 2008 Steven Barth --- Licensed to the public under the Apache License 2.0. - -require("luci.ip") -require("luci.model.uci") - - -local basicParams = { - -- - -- Widget, Name, Default(s), Description - -- - - { Flag,"enable",0, translate("Enable") }, - { Value,"port",65001, translate("TCP port # for both local and remote") }, - { Value,"dev","tun0", translate("Interface name") }, - { Value,"host","vpnserver.example.org", translate("Remote host name or ip address") }, - { Value,"localip","192.168.99.2", translate("Local tunnel ip address") }, - { Value,"remoteip","192.168.99.1", translate("Remote tunnel ip address") }, - { Value,"key","secretkey", translate("The secret key") }, - { ListValue,"proto",{ "tcp", "udp" }, translate("Protocol") }, - { Flag,"listener",0, translate("Server mode") }, - - { Value,"bind","", translate("Bind address") }, - --{ Value,"bind-backup","", translate("Bind backup") }, - { Value,"bindport",65002, translate("Bind port") }, - { Value,"mtu",1500, translate("MTU") }, - { Flag,"mtuauto",0, translate("MTU auto") }, - - { Flag,"mptcp",0, translate("MPTCP") }, - { Flag,"chacha20",0, translate("Use ChaCha20 stream cipher") } -} - - -local m = Map("glorytun") -local p = m:section( SimpleSection ) - -p.template = "glorytun/pageswitch" -p.mode = "settings" -p.instance = arg[1] - - -local s = m:section( NamedSection, arg[1], "glorytun" ) - -for _, option in ipairs(basicParams) do - local o = s:option( - option[1], option[2], - option[2], option[4] - ) - - o.optional = true - - if option[1] == DummyValue then - o.value = option[3] - else - if option[1] == DynamicList then - function o.cfgvalue(...) - local val = AbstractValue.cfgvalue(...) - return ( val and type(val) ~= "table" ) and { val } or val - end - end - - if type(option[3]) == "table" then - if o.optional then o:value("", "-- remove --") end - for _, v in ipairs(option[3]) do - v = tostring(v) - o:value(v) - end - o.default = tostring(option[3][1]) - else - o.default = tostring(option[3]) - end - end - - for i=5,#option do - if type(option[i]) == "table" then - o:depends(option[i]) - end - end -end - -return m - diff --git a/luci-app-glorytun/luasrc/model/cbi/glorytun.lua b/luci-app-glorytun/luasrc/model/cbi/glorytun.lua deleted file mode 100644 index 1fb1b829e..000000000 --- a/luci-app-glorytun/luasrc/model/cbi/glorytun.lua +++ /dev/null @@ -1,147 +0,0 @@ --- Copyright 2018 Ycarus (Yannick Chabanois) --- Copyright 2008 Steven Barth --- Licensed to the public under the Apache License 2.0. - -local fs = require "nixio.fs" -local sys = require "luci.sys" -local uci = require "luci.model.uci".cursor() -local testfullps = luci.sys.exec("ps --help 2>&1 | grep BusyBox") --check which ps do we have -local psstring = (string.len(testfullps)>0) and "ps w" or "ps axfw" --set command we use to get pid - -local m = Map("glorytun", translate("Glorytun")) -local s = m:section( TypedSection, "glorytun", translate("Glorytun instances"), translate("Below is a list of configured Glorytun instances and their current state") ) -s.template = "cbi/tblsection" -s.template_addremove = "glorytun/cbi-select-input-add" -s.addremove = true -s.add_select_options = { } -s.add_select_options[''] = '' -s.extedit = luci.dispatcher.build_url( - "admin", "vpn", "glorytun", "settings", "%s" -) - -uci:load("glorytun_recipes") -uci:foreach( "glorytun_recipes", "glorytun_recipe", - function(section) - s.add_select_options[section['.name']] = - section['_description'] or section['.name'] - end -) - -function s.getPID(section) -- Universal function which returns valid pid # or nil - local pid = sys.exec("%s | grep -w %s | grep glorytun | grep -v grep | awk '{print $1}'" % { psstring,section} ) - if pid and #pid > 0 and tonumber(pid) ~= nil then - return tonumber(pid) - else - return nil - end -end - -function s.parse(self, section) - local recipe = luci.http.formvalue( - luci.cbi.CREATE_PREFIX .. self.config .. "." .. - self.sectiontype .. ".select" - ) - - if recipe and not s.add_select_options[recipe] then - self.invalid_cts = true - else - TypedSection.parse( self, section ) - end -end - -function s.create(self, name) - local recipe = luci.http.formvalue( - luci.cbi.CREATE_PREFIX .. self.config .. "." .. - self.sectiontype .. ".select" - ) - name = luci.http.formvalue( - luci.cbi.CREATE_PREFIX .. self.config .. "." .. - self.sectiontype .. ".text" - ) - if #name > 3 and not name:match("[^a-zA-Z0-9_]") then - --uci:section( - -- "glorytun", "glorytun", name, - -- uci:get_all( "glorytun_recipes", recipe ) - --) - local recipe_data = uci:get_all( "glorytun_recipes", recipe ) - uci:set("glorytun", name,"glorytun") - local k, v - for k, v in pairs(recipe_data) do - uci:set("glorytun", name, k,v) - end - - uci:delete("glorytun", name, "_role") - uci:delete("glorytun", name, "_description") - uci:commit("glorytun") - uci:save("glorytun") - - luci.http.redirect( self.extedit:format(name) ) - elseif #name > 0 then - self.invalid_cts = true - end - - return 0 -end - - -s:option( Flag, "enable", translate("Enabled") ) - -local active = s:option( DummyValue, "_active", translate("Started") ) -function active.cfgvalue(self, section) - local pid = s.getPID(section) - if pid ~= nil then - return (sys.process.signal(pid, 0)) - and translatef("yes (%i)", pid) - or translate("no") - end - return translate("no") -end - -local updown = s:option( Button, "_updown", translate("Start/Stop") ) -updown._state = false -updown.redirect = luci.dispatcher.build_url( - "admin", "vpn", "glorytun" -) -function updown.cbid(self, section) - local pid = s.getPID(section) - self._state = pid ~= nil and sys.process.signal(pid, 0) - self.option = self._state and "stop" or "start" - return AbstractValue.cbid(self, section) -end -function updown.cfgvalue(self, section) - self.title = self._state and "stop" or "start" - self.inputstyle = self._state and "reset" or "reload" -end - -local port = s:option( DummyValue, "port", translate("Port") ) -function port.cfgvalue(self, section) - local val = AbstractValue.cfgvalue(self, section) - return val or "65001" -end -local dev = s:option( DummyValue, "dev", translate("Interface") ) -function dev.cfgvalue(self, section) - local val = AbstractValue.cfgvalue(self, section) - return val or "tun" -end -local proto = s:option( DummyValue, "proto", translate("Protocol") ) -function proto.cfgvalue(self, section) - local val = AbstractValue.cfgvalue(self, section) - return val or "tcp" -end - -function updown.write(self, section, value) - if self.option == "stop" then - local pid = s.getPID(section) - if pid ~= nil then - sys.process.signal(pid,15) - end - else - local type = proto.cfgvalue(self,section) - luci.sys.call("/etc/init.d/glorytun-udp start %s" % section) - luci.sys.call("/etc/init.d/glorytun start %s" % section) - end - luci.http.redirect( self.redirect ) -end - - -return m diff --git a/luci-app-glorytun/luasrc/view/glorytun/cbi-select-input-add.htm b/luci-app-glorytun/luasrc/view/glorytun/cbi-select-input-add.htm deleted file mode 100644 index 898252325..000000000 --- a/luci-app-glorytun/luasrc/view/glorytun/cbi-select-input-add.htm +++ /dev/null @@ -1,11 +0,0 @@ -
- <% if self.invalid_cts then -%>
<% end %> - - - - <% if self.invalid_cts then %>
<%:Invalid%>
<% end %> -
diff --git a/luci-app-glorytun/luasrc/view/glorytun/pageswitch.htm b/luci-app-glorytun/luasrc/view/glorytun/pageswitch.htm deleted file mode 100644 index 652494e0c..000000000 --- a/luci-app-glorytun/luasrc/view/glorytun/pageswitch.htm +++ /dev/null @@ -1,13 +0,0 @@ -<%# - Copyright 2018 Ycarus (Yannick Chabanois) - Copyright 2008 Steven Barth - Copyright 2008 Jo-Philipp Wich - Licensed to the public under the Apache License 2.0. --%> - -
- - <%:Overview%> » - <%=luci.i18n.translatef("Instance \"%s\"", self.instance)%> - -
diff --git a/luci-app-glorytun/po/de/glorytun.po b/luci-app-glorytun/po/de/glorytun.po deleted file mode 100644 index f3f01f7fd..000000000 --- a/luci-app-glorytun/po/de/glorytun.po +++ /dev/null @@ -1,104 +0,0 @@ -msgid "" -msgstr "" -"PO-Revision-Date: 2020-10-05 12:39+0000\n" -"Last-Translator: Anonymous \n" -"Language-Team: German \n" -"Language: de\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.0.4\n" - -msgid "Add" -msgstr "Hinzufügen" - -msgid "" -"Below is a list of configured Glorytun instances and their current state" -msgstr "" -"Nachfolgend eine Liste der konfigurierten Glorytun-Instanzen und ihre " -"aktuelle Status." - -msgid "Bind address" -msgstr "Bindungsadresse" - -msgid "Bind backup" -msgstr "Alternative Bindungsadresse" - -msgid "Bind port" -msgstr "Verbindungs-Port" - -msgid "Enable" -msgstr "Aktivieren" - -msgid "Enabled" -msgstr "Aktiv" - -msgid "Glorytun" -msgstr "Glorytun" - -msgid "Glorytun instances" -msgstr "Glorytun-Instanzen" - -msgid "Instance \"%s\"" -msgstr "Instanz '%s'" - -msgid "Interface" -msgstr "Schnittstelle" - -msgid "Interface name" -msgstr "Name der Verbindung" - -msgid "Invalid" -msgstr "Ungültig" - -msgid "Local tunnel ip address" -msgstr "IP-Adresse des lokalen Tunnels" - -msgid "MPTCP" -msgstr "MPTCP" - -msgid "MTU" -msgstr "MTU" - -msgid "MTU auto" -msgstr "automatische MTU" - -msgid "Overview" -msgstr "Übersicht" - -msgid "Port" -msgstr "Port" - -msgid "Protocol" -msgstr "Protokoll" - -msgid "Remote host name or ip address" -msgstr "FQDN oder IP-Adresse der Gegenstelle" - -msgid "Remote tunnel ip address" -msgstr "Tunnel-IP-Adresse der Gegenstelle" - -msgid "Server mode" -msgstr "Server-Modus" - -msgid "Start/Stop" -msgstr "Start/Stop" - -msgid "Started" -msgstr "gestartet" - -msgid "TCP port # for both local and remote" -msgstr "TCP-Port Nummer lokal und gegenüber" - -msgid "The secret key" -msgstr "geheimer Schlüssel" - -msgid "Use ChaCha20 stream cipher" -msgstr "Stromverschlüsselung 'ChaCha20' nutzen" - -msgid "no" -msgstr "nein" - -msgid "yes (%i)" -msgstr "ja (%i)" diff --git a/luci-app-glorytun/po/fr/glorytun.po b/luci-app-glorytun/po/fr/glorytun.po deleted file mode 100644 index 7b6b678ee..000000000 --- a/luci-app-glorytun/po/fr/glorytun.po +++ /dev/null @@ -1,104 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: \n" -"POT-Creation-Date: \n" -"PO-Revision-Date: 2020-10-07 10:57+0000\n" -"Last-Translator: Weblate Admin \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" -"X-Generator: Weblate 4.0.4\n" - -msgid "Add" -msgstr "Ajouter" - -msgid "Below is a list of configured Glorytun instances and their current state" -msgstr "Ci-dessous une liste des instances Glorytun configurées et leur état actuel" - -msgid "Bind address" -msgstr "Adresse mappée" - -msgid "Bind backup" -msgstr "Lier la sauvegarde" - -msgid "Bind port" -msgstr "Port de connexion" - -msgid "Enable" -msgstr "Activer" - -msgid "Enabled" -msgstr "Activer" - -msgid "Glorytun" -msgstr "Glorytun" - -msgid "Glorytun instances" -msgstr "Instances de Glorytun" - -msgid "Instance \"%s\"" -msgstr "Instance \"%s\"" - -msgid "Interface" -msgstr "Interface" - -msgid "Interface name" -msgstr "Nom de l'interface" - -msgid "Invalid" -msgstr "Invalide" - -msgid "Local tunnel ip address" -msgstr "Adresse IP locale du tunnel" - -msgid "MPTCP" -msgstr "MPTCP" - -msgid "MTU" -msgstr "MTU" - -msgid "MTU auto" -msgstr "MTU auto" - -msgid "Overview" -msgstr "Aperçu" - -msgid "Port" -msgstr "Port" - -msgid "Protocol" -msgstr "Protocole" - -msgid "Remote host name or ip address" -msgstr "Nom de l'hôte distant ou adresse IP" - -msgid "Remote tunnel ip address" -msgstr "Adresse IP distance du tunnel" - -msgid "Server mode" -msgstr "Mode serveur" - -msgid "Start/Stop" -msgstr "Marche/Arrêt" - -msgid "Started" -msgstr "Démarré" - -msgid "TCP port # for both local and remote" -msgstr "Port TCP local et distant" - -msgid "The secret key" -msgstr "La clef secréte" - -msgid "Use ChaCha20 stream cipher" -msgstr "Utiliser le chiffrement ChaCha20" - -msgid "no" -msgstr "non" - -msgid "yes (%i)" -msgstr "oui (%i)" diff --git a/luci-app-glorytun/po/it/glorytun.po b/luci-app-glorytun/po/it/glorytun.po deleted file mode 100644 index 96ae2b091..000000000 --- a/luci-app-glorytun/po/it/glorytun.po +++ /dev/null @@ -1,104 +0,0 @@ -msgid "" -msgstr "" -"PO-Revision-Date: 2020-09-21 12:51+0000\n" -"Last-Translator: Weblate Admin \n" -"Language-Team: Italian \n" -"Language: it\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.0.4\n" - -msgid "Add" -msgstr "Aggiungi" - -msgid "" -"Below is a list of configured Glorytun instances and their current state" -msgstr "" -"Di seguito è riportato un elenco di istanze Glorytun configurate e il loro " -"stato corrente" - -msgid "Bind address" -msgstr "Associa indirizzo" - -msgid "Bind backup" -msgstr "Bind backup" - -msgid "Bind port" -msgstr "Bind port" - -msgid "Enable" -msgstr "Attivare" - -msgid "Enabled" -msgstr "Abilitato" - -msgid "Glorytun" -msgstr "Glorytun" - -msgid "Glorytun instances" -msgstr "Istanze di Glorytun" - -msgid "Instance \"%s\"" -msgstr "Istanza \"%s\"" - -msgid "Interface" -msgstr "Interfaccia" - -msgid "Interface name" -msgstr "Nome interfaccia" - -msgid "Invalid" -msgstr "Non valido" - -msgid "Local tunnel ip address" -msgstr "Indirizzo IP del tunnel locale" - -msgid "MPTCP" -msgstr "MPTCP" - -msgid "MTU" -msgstr "MTU" - -msgid "MTU auto" -msgstr "MTU auto" - -msgid "Overview" -msgstr "Panoramica" - -msgid "Port" -msgstr "Porta" - -msgid "Protocol" -msgstr "Protocollo" - -msgid "Remote host name or ip address" -msgstr "Nome host remoto o indirizzo IP" - -msgid "Remote tunnel ip address" -msgstr "Indirizzo IP del tunnel remoto" - -msgid "Server mode" -msgstr "Modalità server" - -msgid "Start/Stop" -msgstr "Marcia/arresto" - -msgid "Started" -msgstr "Iniziato" - -msgid "TCP port # for both local and remote" -msgstr "Porta TCP # sia per locale che per remoto" - -msgid "The secret key" -msgstr "Chiave segreta" - -msgid "Use ChaCha20 stream cipher" -msgstr "Usa il cifrario a flusso ChaCha20" - -msgid "no" -msgstr "no" - -msgid "yes (%i)" -msgstr "Sì (%i)" diff --git a/luci-app-glorytun/po/oc/glorytun.po b/luci-app-glorytun/po/oc/glorytun.po deleted file mode 100644 index be34c778d..000000000 --- a/luci-app-glorytun/po/oc/glorytun.po +++ /dev/null @@ -1,103 +0,0 @@ -msgid "" -msgstr "" -"PO-Revision-Date: 2020-10-13 07:30+0000\n" -"Last-Translator: Quentin PAGÈS \n" -"Language-Team: Occitan \n" -"Language: oc\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.0.4\n" - -msgid "Add" -msgstr "Ajustar" - -msgid "" -"Below is a list of configured Glorytun instances and their current state" -msgstr "" -"Çai-jos una lista de las instàncias Glorytun configuradas e lor estat actual" - -msgid "Bind address" -msgstr "Adreça mapada" - -msgid "Bind backup" -msgstr "Associar la salvagarda" - -msgid "Bind port" -msgstr "Pòrt de connexion" - -msgid "Enable" -msgstr "Activat" - -msgid "Enabled" -msgstr "Activat" - -msgid "Glorytun" -msgstr "Glorytun" - -msgid "Glorytun instances" -msgstr "Instàncias Glorytun" - -msgid "Instance \"%s\"" -msgstr "Instància « %s »" - -msgid "Interface" -msgstr "Interfàcia" - -msgid "Interface name" -msgstr "Nom de l’interfàcia" - -msgid "Invalid" -msgstr "Invalid" - -msgid "Local tunnel ip address" -msgstr "Adreça IP locala del tunèl" - -msgid "MPTCP" -msgstr "MPTCP" - -msgid "MTU" -msgstr "MTU" - -msgid "MTU auto" -msgstr "MTU auto" - -msgid "Overview" -msgstr "Apercebut" - -msgid "Port" -msgstr "Pòrt" - -msgid "Protocol" -msgstr "Protocòl" - -msgid "Remote host name or ip address" -msgstr "Nom de l’òste alonhat o adreça IP" - -msgid "Remote tunnel ip address" -msgstr "Adreça IP alonhada del tunèl" - -msgid "Server mode" -msgstr "Mòde servidor" - -msgid "Start/Stop" -msgstr "Aviar/Arrestar" - -msgid "Started" -msgstr "Aviat" - -msgid "TCP port # for both local and remote" -msgstr "Pòrt TCP local e alonhat" - -msgid "The secret key" -msgstr "La clau secrèta" - -msgid "Use ChaCha20 stream cipher" -msgstr "Utilizar lo chiframent ChaCha20" - -msgid "no" -msgstr "non" - -msgid "yes (%i)" -msgstr "òc (%i)" diff --git a/luci-app-glorytun/po/templates/glorytun.pot b/luci-app-glorytun/po/templates/glorytun.pot deleted file mode 100644 index 9c862bb47..000000000 --- a/luci-app-glorytun/po/templates/glorytun.pot +++ /dev/null @@ -1,93 +0,0 @@ -msgid "" -msgstr "Content-Type: text/plain; charset=UTF-8" - -msgid "Add" -msgstr "" - -msgid "" -"Below is a list of configured Glorytun instances and their current state" -msgstr "" - -msgid "Bind address" -msgstr "" - -msgid "Bind backup" -msgstr "" - -msgid "Bind port" -msgstr "" - -msgid "Enable" -msgstr "" - -msgid "Enabled" -msgstr "" - -msgid "Glorytun" -msgstr "" - -msgid "Glorytun instances" -msgstr "" - -msgid "Instance \"%s\"" -msgstr "" - -msgid "Interface" -msgstr "" - -msgid "Interface name" -msgstr "" - -msgid "Invalid" -msgstr "" - -msgid "Local tunnel ip address" -msgstr "" - -msgid "MPTCP" -msgstr "" - -msgid "MTU" -msgstr "" - -msgid "MTU auto" -msgstr "" - -msgid "Overview" -msgstr "" - -msgid "Port" -msgstr "" - -msgid "Protocol" -msgstr "" - -msgid "Remote host name or ip address" -msgstr "" - -msgid "Remote tunnel ip address" -msgstr "" - -msgid "Server mode" -msgstr "" - -msgid "Start/Stop" -msgstr "" - -msgid "Started" -msgstr "" - -msgid "TCP port # for both local and remote" -msgstr "" - -msgid "The secret key" -msgstr "" - -msgid "Use ChaCha20 stream cipher" -msgstr "" - -msgid "no" -msgstr "" - -msgid "yes (%i)" -msgstr "" diff --git a/luci-app-glorytun/po/zh_Hans/glorytun.po b/luci-app-glorytun/po/zh_Hans/glorytun.po deleted file mode 100644 index 051d88490..000000000 --- a/luci-app-glorytun/po/zh_Hans/glorytun.po +++ /dev/null @@ -1,102 +0,0 @@ -msgid "" -msgstr "" -"PO-Revision-Date: 2020-06-27 17:26+0000\n" -"Last-Translator: antrouter \n" -"Language-Team: Chinese (Simplified) \n" -"Language: zh_Hans\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.0.4\n" - -msgid "Add" -msgstr "添加" - -msgid "" -"Below is a list of configured Glorytun instances and their current state" -msgstr "以下是已配置的Glorytun实例及其当前状态的列表" - -msgid "Bind address" -msgstr "绑定地址" - -msgid "Bind backup" -msgstr "绑定备份" - -msgid "Bind port" -msgstr "绑定端口" - -msgid "Enable" -msgstr "开启" - -msgid "Enabled" -msgstr "开启" - -msgid "Glorytun" -msgstr "Glorytun(隧道)" - -msgid "Glorytun instances" -msgstr "Glorytun实例" - -msgid "Instance \"%s\"" -msgstr "实例\"%s\"" - -msgid "Interface" -msgstr "接口" - -msgid "Interface name" -msgstr "网卡名称" - -msgid "Invalid" -msgstr "无效" - -msgid "Local tunnel ip address" -msgstr "本地隧道IP地址" - -msgid "MPTCP" -msgstr "MPTCP" - -msgid "MTU" -msgstr "MTU" - -msgid "MTU auto" -msgstr "自动MTU" - -msgid "Overview" -msgstr "概况" - -msgid "Port" -msgstr "端口" - -msgid "Protocol" -msgstr "协议" - -msgid "Remote host name or ip address" -msgstr "远程主机名或IP地址" - -msgid "Remote tunnel ip address" -msgstr "远程隧道IP地址" - -msgid "Server mode" -msgstr "服务器模式" - -msgid "Start/Stop" -msgstr "开始/停止" - -msgid "Started" -msgstr "开始了" - -msgid "TCP port # for both local and remote" -msgstr "本地和远程的TCP端口号" - -msgid "The secret key" -msgstr "秘钥" - -msgid "Use ChaCha20 stream cipher" -msgstr "使用ChaCha20流密码" - -msgid "no" -msgstr "不" - -msgid "yes (%i)" -msgstr "是(%i)" diff --git a/luci-app-glorytun/po/zh_Hant/glorytun.po b/luci-app-glorytun/po/zh_Hant/glorytun.po deleted file mode 100644 index 4a77f6410..000000000 --- a/luci-app-glorytun/po/zh_Hant/glorytun.po +++ /dev/null @@ -1,102 +0,0 @@ -msgid "" -msgstr "" -"PO-Revision-Date: 2020-07-09 07:31+0000\n" -"Last-Translator: antrouter \n" -"Language-Team: Chinese (Traditional) \n" -"Language: zh_Hant\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.0.4\n" - -msgid "Add" -msgstr "添加" - -msgid "" -"Below is a list of configured Glorytun instances and their current state" -msgstr "以下是已配置的Glorytun實例及其當前狀態的列表" - -msgid "Bind address" -msgstr "綁定地址" - -msgid "Bind backup" -msgstr "綁定地址" - -msgid "Bind port" -msgstr "綁定端口" - -msgid "Enable" -msgstr "啟用" - -msgid "Enabled" -msgstr "啟用" - -msgid "Glorytun" -msgstr "Glorytun隧道" - -msgid "Glorytun instances" -msgstr "Glorytun實例" - -msgid "Instance \"%s\"" -msgstr "實例\"%s\"" - -msgid "Interface" -msgstr "接口" - -msgid "Interface name" -msgstr "接口名稱" - -msgid "Invalid" -msgstr "無效" - -msgid "Local tunnel ip address" -msgstr "本地隧道IP地址" - -msgid "MPTCP" -msgstr "MPTCP協議" - -msgid "MTU" -msgstr "MTU" - -msgid "MTU auto" -msgstr "自動MTU" - -msgid "Overview" -msgstr "總覽" - -msgid "Port" -msgstr "端口" - -msgid "Protocol" -msgstr "協議" - -msgid "Remote host name or ip address" -msgstr "遠程主機名或IP地址" - -msgid "Remote tunnel ip address" -msgstr "遠程隧道IP地址" - -msgid "Server mode" -msgstr "服務器模式" - -msgid "Start/Stop" -msgstr "開始/停止" - -msgid "Started" -msgstr "已開始" - -msgid "TCP port # for both local and remote" -msgstr "本地和遠程的TCP端口號" - -msgid "The secret key" -msgstr "秘鑰" - -msgid "Use ChaCha20 stream cipher" -msgstr "使用ChaCha20流密碼" - -msgid "no" -msgstr "沒有" - -msgid "yes (%i)" -msgstr "是(%i)" diff --git a/luci-app-glorytun/root/etc/config/glorytun_recipes b/luci-app-glorytun/root/etc/config/glorytun_recipes deleted file mode 100644 index 693eb6da6..000000000 --- a/luci-app-glorytun/root/etc/config/glorytun_recipes +++ /dev/null @@ -1,50 +0,0 @@ -config glorytun_recipe servertcp - option _description "Simple TCP server configuration" - option _role "server" - option port "65001" - option dev "tun0" - option key "secretkey" - option listener "1" - option localip "192.168.99.1" - option remoteip "192.168.99.2" - option proto "tcp" - option enable "0" - -config glorytun_recipe clienttcp - option _description "Simple TCP client configuration" - option _role "client" - option port "65001" - option dev "tun0" - option host "vpnserver.example.org" - option key "secretkey" - option localip "192.168.99.2" - option remoteip "192.168.99.1" - option proto "tcp" - option enable "0" - -config glorytun_recipe serverudp - option _description "Simple UDP server configuration" - option _role "server" - option dev "tun0" - option bindport "65003" - option bind "192.168.99.1" - option key "secretkey" - option localip "192.168.99.1" - option remoteip "192.168.99.2" - option proto "udp" - option mtuauto "1" - option enable "0" - -config glorytun_recipe clientudp - option _description "Simple UDP client configuration" - option _role "client" - option port "65003" - option dev "tun0" - option host "vpnserver.example.org" - option key "secretkey" - option localip "192.168.99.2" - option remoteip "192.168.99.1" - option proto "udp" - option mtuauto "1" - option enable "0" - diff --git a/luci-app-glorytun/root/usr/share/luci/menu.d/luci-app-glorytun.json b/luci-app-glorytun/root/usr/share/luci/menu.d/luci-app-glorytun.json deleted file mode 100644 index 414accf0b..000000000 --- a/luci-app-glorytun/root/usr/share/luci/menu.d/luci-app-glorytun.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "admin/vpn/glorytun": { - "title": "Glorytun", - "order": 20, - "action": { - "type": "cbi", - "path": "glorytun" - }, - "depends": { - "acl": [ "luci-app-glorytun" ] - } - } -} From e4103cea0317a699fd40fd988b8a3d1863ddde5e Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:23:57 +0100 Subject: [PATCH 32/45] New interface for Glorytun UDP VPN --- glorytun-udp/init | 24 ++-- luci-app-glorytun-udp/Makefile | 16 +++ .../resources/view/services/glorytun-udp.js | 104 ++++++++++++++++++ .../root/etc/config/glorytun-udp | 10 ++ .../root/etc/hotplug.d/iface/30-glorytun-udp | 28 +++++ .../etc/uci-defaults/1201-luci-glorytun-udp | 47 ++++++++ .../luci/menu.d/luci-app-glorytun-udp.json | 13 +++ .../rpcd/acl.d/luci-app-glorytun-udp.json | 11 ++ 8 files changed, 239 insertions(+), 14 deletions(-) create mode 100644 luci-app-glorytun-udp/Makefile create mode 100644 luci-app-glorytun-udp/htdocs/luci-static/resources/view/services/glorytun-udp.js create mode 100644 luci-app-glorytun-udp/root/etc/config/glorytun-udp create mode 100644 luci-app-glorytun-udp/root/etc/hotplug.d/iface/30-glorytun-udp create mode 100644 luci-app-glorytun-udp/root/etc/uci-defaults/1201-luci-glorytun-udp create mode 100644 luci-app-glorytun-udp/root/usr/share/luci/menu.d/luci-app-glorytun-udp.json create mode 100644 luci-app-glorytun-udp/root/usr/share/rpcd/acl.d/luci-app-glorytun-udp.json diff --git a/glorytun-udp/init b/glorytun-udp/init index b9a18c526..5bb5a9a5d 100755 --- a/glorytun-udp/init +++ b/glorytun-udp/init @@ -1,7 +1,7 @@ #!/bin/sh /etc/rc.common # vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 : # Copyright (C) 2015 ovh.com -# Copyright (C) 2017 Ycarus (Yannick Chabanois) +# Copyright (C) 2017-2020 Ycarus (Yannick Chabanois) START=90 STOP=10 @@ -19,22 +19,20 @@ _err() { } validate_section() { - uci_validate_section glorytun glorytun "${1}" \ + uci_validate_section glorytun-udp glorytun-udp "${1}" \ 'enable:bool:0' \ + 'mode:string' \ 'key:string' \ 'host:host' \ 'port:port' \ 'proto:string' \ - 'bind:string:0.0.0.0' \ - 'bindport:port' \ - 'mtu:uinteger:1450' \ 'mtuauto:bool:0' \ - 'chacha20:bool:0' \ + 'chacha:bool:0' \ 'dev:string' } start_instance() { - local enable key host port listener proto bind bindport mtu mtuauto chacha20 dev + local enable key host port listener proto mtuauto chacha dev mode validate_section "${1}" || { _err "validation failed" @@ -42,12 +40,12 @@ start_instance() { } [ "${enable}" = "1" ] || return 1 - [ "${proto}" = "udp" ] || return 1 [ -n "${key}" ] || return 1 [ "${key}" != "secretkey" ] || return 1 [ -n "${port}" ] || return 1 [ -n "${dev}" ] || return 1 + [ -n "${mode}" ] || return 1 echo "${key}" > /tmp/${PROG_NAME}-${1}.key key="" @@ -62,15 +60,13 @@ start_instance() { procd_open_instance procd_set_param command ${PROG} \ - ${bind:+bind from "$bind"} \ - ${bindport:+port "$bindport"} \ - ${host:+to addr "$host"} \ + ${host:+bind ${mode} addr "$host"} \ ${port:+port "$port"} \ ${dev:+dev "$dev"} \ keyfile /tmp/${PROG_NAME}-${1}.key \ persist - [ "${chacha20}" = "1" ] && procd_append_param command chacha + [ "${chacha}" = "1" ] && procd_append_param command chacha procd_set_param respawn 0 30 0 procd_set_param file /tmp/${PROG_NAME}-${1}.key @@ -104,8 +100,8 @@ add_glorytun_path() { start_service() { local dev - config_load glorytun - config_foreach start_instance glorytun + config_load glorytun-udp + config_foreach start_instance glorytun-udp } reload_service() { diff --git a/luci-app-glorytun-udp/Makefile b/luci-app-glorytun-udp/Makefile new file mode 100644 index 000000000..97608e0e7 --- /dev/null +++ b/luci-app-glorytun-udp/Makefile @@ -0,0 +1,16 @@ +# +# Copyright (C) 2018-2020 Ycarus (Yannick Chabanois) +# +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI Interface to Glorytun UDP +LUCI_DEPENDS:=+glorytun-udp + +PKG_LICENSE:=GPLv3 + +#include ../luci/luci.mk +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-glorytun-udp/htdocs/luci-static/resources/view/services/glorytun-udp.js b/luci-app-glorytun-udp/htdocs/luci-static/resources/view/services/glorytun-udp.js new file mode 100644 index 000000000..2975af525 --- /dev/null +++ b/luci-app-glorytun-udp/htdocs/luci-static/resources/view/services/glorytun-udp.js @@ -0,0 +1,104 @@ +'use strict'; +'require rpc'; +'require poll'; +'require form'; +'require fs'; +'require uci'; +'require tools.widgets as widgets'; + +var callHostHints; + +var callServiceList = rpc.declare({ + object: 'service', + method: 'list', + params: [ 'name' ], + expect: { '': {} } +}); + +return L.view.extend({ + callHostHints: rpc.declare({ + object: 'luci-rpc', + method: 'getHostHints', + expect: { '': {} } + }), + + load: function() { + return this.callHostHints(); + }, + + render: function(hosts) { + var m, s, o; + + m = new form.Map('glorytun-udp', _('Glorytun UDP')); + + s = m.section(form.GridSection, 'glorytun-udp', _('Instances')); + s.addremove = true; + s.anonymous = true; + s.nodescriptions = true; + + s.tab('general', _('General Settings')); + s.tab('advanced', _('Advanced Settings')); + + o = s.taboption('general', form.Flag, 'enable', _('Enabled')); + o.default = o.enabled; + + o = s.taboption('general', form.ListValue, 'mode', _('Mode')); + o.value('to',_('Client')); + o.value('from',_('Server')); + o.modalonly = true; + + o = s.taboption('general', form.Value, 'host', _('Host')); + o.rmempty = false; + + o = s.taboption('general', form.Value, 'port', _('Port')); + o.rmempty = false; + + o = s.taboption('general', form.Value, 'key', _('Key')); + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('general', form.Value, 'dev', _('Interface name')); + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('general', form.Value, 'localip', _('Local IP')); + o.datatype = 'or(ip4addr,ip6addr)'; + o.rmempty = false; + + o = s.taboption('general', form.Value, 'remoteip', _('Remote IP')); + o.datatype = 'or(ip4addr,ip6addr)'; + o.rmempty = false; + + o = s.taboption('advanced', form.Flag, 'persist', _('Persist'), _('Keep the tunnel device after exiting')); + o.default = o.enabled; + o.modalonly = true; + + o = s.taboption('advanced', form.Flag, 'chacha', _('chacha'), _('Force fallback cipher')); + o.default = o.enabled; + o.modalonly = true; + + o = s.taboption('advanced', form.Value, 'kxtimeout', _('Key rotation timeout')); + o.default = '7d'; + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('advanced', form.Value, 'timetolerance', _('Clock sync tolerance')); + o.default = '10m'; + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('advanced', form.Value, 'keepalive', _('Keep alive timeout')); + o.default = '25s'; + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('advanced', form.Flag, 'auto', _('Dynamic rate detection')); + o.rmempty = false; + o.modalonly = true; + + o = s.taboption('general',form.Value, 'label', _('Label')); + o.rmempty = true; + + return m.render(); + } +}); diff --git a/luci-app-glorytun-udp/root/etc/config/glorytun-udp b/luci-app-glorytun-udp/root/etc/config/glorytun-udp new file mode 100644 index 000000000..d5d356dd6 --- /dev/null +++ b/luci-app-glorytun-udp/root/etc/config/glorytun-udp @@ -0,0 +1,10 @@ +config glorytun-udp 'vpn' + option enable '0' + option host '127.0.0.1' + option port '65001' + option dev 'tun0' + option key '' + option chacha '1' + option localip '10.255.254.2' + option remoteip '10.255.254.1' + option mode 'to' diff --git a/luci-app-glorytun-udp/root/etc/hotplug.d/iface/30-glorytun-udp b/luci-app-glorytun-udp/root/etc/hotplug.d/iface/30-glorytun-udp new file mode 100644 index 000000000..b942fd60c --- /dev/null +++ b/luci-app-glorytun-udp/root/etc/hotplug.d/iface/30-glorytun-udp @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Load the glorytun config +# +# Author: Ycarus (Yannick Chabanois) +# Released under GPL 3 or later + +[ "$ACTION" = ifup -o "$ACTION" = ifupdate ] || exit 0 + +. /lib/functions.sh +. /lib/functions/network.sh + +set_default() { + local localip + local remoteip + local config="$1" + local iface + config_get enable "$config" enable + config_get iface "$config" dev + [ "$iface" = "$DEVICE" ] && [ "$enable" = "1" ] && { + config_get localip "$config" localip + config_get remoteip "$config" remoteip + [ "$remoteip" != "" ] && [ "$localip" != "" ] && ifconfig $DEVICE $localip pointopoint $remoteip up + } +} + +config_load glorytun-udp +config_foreach set_default glorytun-udp diff --git a/luci-app-glorytun-udp/root/etc/uci-defaults/1201-luci-glorytun-udp b/luci-app-glorytun-udp/root/etc/uci-defaults/1201-luci-glorytun-udp new file mode 100644 index 000000000..dbecf5b5b --- /dev/null +++ b/luci-app-glorytun-udp/root/etc/uci-defaults/1201-luci-glorytun-udp @@ -0,0 +1,47 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete glorytun-udp[-1] + add ucitrack glorytun-udp + set ucitrack.@glorytun-udp[-1].init=glorytun-udp + commit ucitrack +EOF + +if [ "$(uci -q get network.glorytun-udp)" = "" ] && [ "$(uci -q get network.omrvpn)" = "" ]; then + uci -q batch <<-EOF >/dev/null + delete network.glorytun-udp + set network.glorytun-udp=interface + set network.glorytun-udp.ifname=tun0 + set network.glorytun-udp.proto=dhcp + set network.glorytun-udp.ip4table=vpn + set network.glorytun-udp.multipath=off + set network.glorytun-udp.leasetime=12h + commit network + EOF +fi + +if [ "$(uci -q show firewall | grep glorytun-udp)" = "" ] && [ "$(uci -q get network.omrvpn)" = "" ]; then + uci -q batch <<-EOF >/dev/null + set firewall.zone_vpn=zone + set firewall.zone_vpn.name=vpn + set firewall.zone_vpn.network=glorytun-udp + set firewall.zone_vpn.masq=1 + set firewall.zone_vpn.input=REJECT + set firewall.zone_vpn.forward=ACCEPT + set firewall.zone_vpn.output=ACCEPT + commit firewall + EOF +fi +if [ "$(uci -q show firewall | grep Allow-All-LAN-to-VPN)" = "" ]; then + uci -q batch <<-EOF >/dev/null + add firewall rule + set firewall.@rule[-1].enabled='1' + set firewall.@rule[-1].target='ACCEPT' + set firewall.@rule[-1].name='Allow-All-LAN-to-VPN' + set firewall.@rule[-1].dest='vpn' + set firewall.@rule[-1].src='lan' + commit firewall + EOF +fi +rm -f /tmp/luci-indexcache +exit 0 diff --git a/luci-app-glorytun-udp/root/usr/share/luci/menu.d/luci-app-glorytun-udp.json b/luci-app-glorytun-udp/root/usr/share/luci/menu.d/luci-app-glorytun-udp.json new file mode 100644 index 000000000..b84551484 --- /dev/null +++ b/luci-app-glorytun-udp/root/usr/share/luci/menu.d/luci-app-glorytun-udp.json @@ -0,0 +1,13 @@ +{ + "admin/vpn/glorytun-udp": { + "title": "Glorytun UDP", + "order": 60, + "action": { + "type": "view", + "path": "services/glorytun-udp" + }, + "depends": { + "acl": [ "luci-app-glorytun-udp" ] + } + } +} diff --git a/luci-app-glorytun-udp/root/usr/share/rpcd/acl.d/luci-app-glorytun-udp.json b/luci-app-glorytun-udp/root/usr/share/rpcd/acl.d/luci-app-glorytun-udp.json new file mode 100644 index 000000000..3e24adb8e --- /dev/null +++ b/luci-app-glorytun-udp/root/usr/share/rpcd/acl.d/luci-app-glorytun-udp.json @@ -0,0 +1,11 @@ +{ + "luci-app-glorytun-udp": { + "description": "Grant access to glorytun UDP", + "read": { + "uci": [ "glorytun-udp" ] + }, + "write": { + "uci": [ "glorytun-udp" ] + } + } +} \ No newline at end of file From 07fee0e7f27655710cd32b2595221fdb133ce93b Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:25:16 +0100 Subject: [PATCH 33/45] Add glorytun-udp new separated config and option to enable/disable use of shadowsocks for UDP when VPN down --- .../luasrc/controller/openmptcprouter.lua | 45 +++++++++++++++---- .../luasrc/view/openmptcprouter/settings.htm | 6 +++ 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua index 3a07d144d..b294af40c 100644 --- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua +++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua @@ -71,6 +71,7 @@ function wizard_add() if nbserver == 1 and server_ip ~= "" and server_ip ~= nil then ucic:set("shadowsocks-libev","sss0","server",server_ip) ucic:set("glorytun","vpn","host",server_ip) + ucic:set("glorytun-udp","vpn","host",server_ip) ucic:set("dsvpn","vpn","host",server_ip) ucic:set("mlvpn","general","host",server_ip) ucic:set("ubond","general","host",server_ip) @@ -491,6 +492,7 @@ function wizard_add() ss_ip=server_ip ucic:set("shadowsocks-libev","sss0","server",server_ip) ucic:set("glorytun","vpn","host",server_ip) + ucic:set("glorytun-udp","vpn","host",server_ip) ucic:set("dsvpn","vpn","host",server_ip) ucic:set("mlvpn","general","host",server_ip) ucic:set("ubond","general","host",server_ip) @@ -512,6 +514,7 @@ function wizard_add() ucic:set("nginx-ha","VPN","enable","0") ucic:set("shadowsocks-libev","sss0","server",server_ip) ucic:set("glorytun","vpn","host",server_ip) + ucic:set("glorytun-udp","vpn","host",server_ip) ucic:set("dsvpn","vpn","host",server_ip) ucic:set("mlvpn","general","host",server_ip) ucic:set("ubond","general","host",server_ip) @@ -538,6 +541,7 @@ function wizard_add() ucic:save("dsvpn") --ucic:commit("dsvpn") ucic:save("glorytun") + ucic:save("glorytun-udp") --ucic:commit("glorytun") ucic:save("shadowsocks-libev") --ucic:commit("shadowsocks-libev") @@ -552,24 +556,28 @@ function wizard_add() elseif encryption == "aes-256-gcm" then ucic:set("shadowsocks-libev","sss0","method","aes-256-gcm") ucic:set("glorytun","vpn","chacha20","0") + ucic:set("glorytun-udp","vpn","chacha","0") ucic:set("openvpn","omr","cipher","AES-256-GCM") ucic:set("v2ray","omrout","s_vmess_user_security","aes-128-gcm") ucic:set("v2ray","omrout","s_vless_user_security","aes-128-gcm") elseif encryption == "aes-256-cfb" then ucic:set("shadowsocks-libev","sss0","method","aes-256-cfb") ucic:set("glorytun","vpn","chacha20","0") + ucic:set("glorytun-udp","vpn","chacha","0") ucic:set("openvpn","omr","cipher","AES-256-CFB") ucic:set("v2ray","omrout","s_vmess_user_security","aes-128-gcm") ucic:set("v2ray","omrout","s_vless_user_security","aes-128-gcm") elseif encryption == "chacha20-ietf-poly1305" then ucic:set("shadowsocks-libev","sss0","method","chacha20-ietf-poly1305") ucic:set("glorytun","vpn","chacha20","1") + ucic:set("glorytun-udp","vpn","chacha","1") ucic:set("openvpn","omr","cipher","AES-256-CBC") ucic:set("v2ray","omrout","s_vmess_user_security","chacha20-poly1305") ucic:set("v2ray","omrout","s_vless_user_security","chacha20-poly1305") end ucic:save("openvpn") ucic:save("glorytun") + ucic:save("glorytun-udp") ucic:save("shadowsocks-libev") ucic:save("v2ray") @@ -606,7 +614,7 @@ function wizard_add() -- Set Glorytun settings - if default_vpn:match("^glorytun.*") and disablednb ~= serversnb then + if default_vpn:match("glorytun_tcp") and disablednb ~= serversnb then ucic:set("glorytun","vpn","enable",1) else ucic:set("glorytun","vpn","enable",0) @@ -617,13 +625,7 @@ function wizard_add() ucic:set("glorytun","vpn","port","65001") ucic:set("glorytun","vpn","key",glorytun_key) ucic:set("glorytun","vpn","mptcp",1) - if default_vpn == "glorytun_udp" then - ucic:set("glorytun","vpn","proto","udp") - ucic:set("glorytun","vpn","localip","10.255.254.2") - ucic:set("glorytun","vpn","remoteip","10.255.254.1") - ucic:set("network","omr6in4","ipaddr","10.255.254.2") - ucic:set("network","omr6in4","peeraddr","10.255.254.1") - else + if default_vpn == "glorytun_tcp" then ucic:set("glorytun","vpn","proto","tcp") ucic:set("glorytun","vpn","localip","10.255.255.2") ucic:set("glorytun","vpn","remoteip","10.255.255.1") @@ -639,6 +641,29 @@ function wizard_add() ucic:save("glorytun") ucic:commit("glorytun") + if default_vpn:match("glorytun_udp") and disablednb ~= serversnb then + ucic:set("glorytun-udp","vpn","enable",1) + else + ucic:set("glorytun-udp","vpn","enable",0) + end + + local glorytun_key = luci.http.formvalue("glorytun_key") + if glorytun_key ~= "" then + ucic:set("glorytun-udp","vpn","port","65001") + ucic:set("glorytun-udp","vpn","key",glorytun_key) + if default_vpn == "glorytun_udp" then + ucic:set("glorytun-udp","vpn","localip","10.255.254.2") + ucic:set("glorytun-udp","vpn","remoteip","10.255.254.1") + ucic:set("network","omr6in4","ipaddr","10.255.254.2") + ucic:set("network","omr6in4","peeraddr","10.255.254.1") + end + ucic:set("network","omrvpn","proto","none") + else + ucic:set("glorytun-udp","vpn","key","") + end + ucic:save("glorytun-udp") + ucic:commit("glorytun-udp") + -- Set A Dead Simple VPN settings if default_vpn == "dsvpn" and disablednb ~= serversnb then ucic:set("dsvpn","vpn","enable",1) @@ -845,6 +870,10 @@ function settings_add() local disableserverping = luci.http.formvalue("disableserverping") or "0" ucic:set("openmptcprouter","settings","disableserverping",disableserverping) + -- Enable/disable shadowsocks upd + local shadowsocksudp = luci.http.formvalue("shadowsocksudp") or "0" + ucic:set("openmptcprouter","settings","shadowsocksudp",shadowsocksudp) + -- Enable/disable fast open local disablefastopen = luci.http.formvalue("disablefastopen") or "0" if disablefastopen == "0" then diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm index fbc61a7a9..50c4ccce3 100644 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm @@ -244,6 +244,12 @@
+
+ +
+ checked<% end %>> +
+
From 234a0f85e8ddd6467d66479a4dfc81121b318dd6 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:25:57 +0100 Subject: [PATCH 34/45] Update luci-mod-dashboard from upstream --- luci-mod-dashboard/Makefile | 3 +++ .../view/dashboard/include/20_lan.js | 20 +++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/luci-mod-dashboard/Makefile b/luci-mod-dashboard/Makefile index 4a9aec96f..6a6d84166 100644 --- a/luci-mod-dashboard/Makefile +++ b/luci-mod-dashboard/Makefile @@ -1,8 +1,11 @@ # # Copyright 2019-2020 ZHANG Zhao +# Copyright 2020 Ycarus (Yannick Chabanois) for OpenMPTCProuter # # This is free software, licensed under the Apache License, Version 2.0 . # +# Based on openwrt luci commit 03c77dafe3cfb922b995adfe9c0f8a75c98a18af +# include $(TOPDIR)/rules.mk diff --git a/luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js b/luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js index ab86568e8..c673fa681 100644 --- a/luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js +++ b/luci-mod-dashboard/htdocs/luci-static/resources/view/dashboard/include/20_lan.js @@ -25,15 +25,15 @@ return baseclass.extend({ var container_wapper = E('div', { 'class': 'router-status-lan dashboard-bg box-s1' }); var container_box = E('div', { 'class': 'lan-info devices-list' }); - var container_devices = E('div', { 'class': 'table assoclist devices-info' }, [ - E('div', { 'class': 'tr table-titles dashboard-bg' }, [ - E('div', { 'class': 'th nowrap' }, _('Hostname')), - E('div', { 'class': 'th' }, _('IP Address')), - E('div', { 'class': 'th' }, _('MAC')), + var container_devices = E('table', { 'class': 'table assoclist devices-info' }, [ + E('tr', { 'class': 'tr table-titles dashboard-bg' }, [ + E('th', { 'class': 'th nowrap' }, _('Hostname')), + E('th', { 'class': 'th' }, _('IP Address')), + E('th', { 'class': 'th' }, _('MAC')), ]) ]); - var container_deviceslist = E('div', { 'class': 'table assoclist devices-info' }); + var container_deviceslist = E('table', { 'class': 'table assoclist devices-info' }); container_box.appendChild(E('div', { 'class': 'title'}, [ E('img', { @@ -48,21 +48,21 @@ return baseclass.extend({ for(var idx in this.params.lan.devices) { var deivce = this.params.lan.devices[idx]; - container_deviceslist.appendChild(E('div', { 'class': 'tr cbi-rowstyle-1'}, [ + container_deviceslist.appendChild(E('tr', { 'class': 'tr cbi-rowstyle-1'}, [ - E('div', { 'class': 'td device-info'}, [ + E('td', { 'class': 'td device-info'}, [ E('p', {}, [ E('span', { 'class': 'd-inline-block'}, [ deivce.hostname ]), ]), ]), - E('div', { 'class': 'td device-info'}, [ + E('td', { 'class': 'td device-info'}, [ E('p', {}, [ E('span', { 'class': 'd-inline-block'}, [ deivce.ipv4 ]), ]), ]), - E('div', { 'class': 'td device-info'}, [ + E('td', { 'class': 'td device-info'}, [ E('p', {}, [ E('span', { 'class': 'd-inline-block'}, [ deivce.macaddr ]), ]), From 179fb76abcb473841bd568bb5773ab908fa19464 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:26:41 +0100 Subject: [PATCH 35/45] Update luci-mod-network from upstream --- luci-mod-network/Makefile | 2 +- .../resources/view/network/dhcp.js | 32 +++++++------- .../resources/view/network/diagnostics.js | 10 ++--- .../resources/view/network/wireless.js | 42 +++++++++++-------- 4 files changed, 46 insertions(+), 40 deletions(-) diff --git a/luci-mod-network/Makefile b/luci-mod-network/Makefile index 7a043dc40..71e847f31 100644 --- a/luci-mod-network/Makefile +++ b/luci-mod-network/Makefile @@ -4,7 +4,7 @@ # # This is free software, licensed under the Apache License, Version 2.0 . # -# From https://github.com/openwrt/luci/commit/83c912716e482000e92443cffc3202726314f480 +# From https://github.com/openwrt/luci/commit/f5c04e1a2e173f536597f220db0380cc08869e8e include $(TOPDIR)/rules.mk diff --git a/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js b/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js index 95abeb6d0..d3f564d47 100644 --- a/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js +++ b/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js @@ -31,15 +31,15 @@ CBILeaseStatus = form.DummyValue.extend({ renderWidget: function(section_id, option_id, cfgvalue) { return E([ E('h4', _('Active DHCP Leases')), - E('div', { 'id': 'lease_status_table', 'class': 'table' }, [ - E('div', { 'class': 'tr table-titles' }, [ - E('div', { 'class': 'th' }, _('Hostname')), - E('div', { 'class': 'th' }, _('IPv4-Address')), - E('div', { 'class': 'th' }, _('MAC-Address')), - E('div', { 'class': 'th' }, _('Lease time remaining')) + E('table', { 'id': 'lease_status_table', 'class': 'table' }, [ + E('tr', { 'class': 'tr table-titles' }, [ + E('th', { 'class': 'th' }, _('Hostname')), + E('th', { 'class': 'th' }, _('IPv4-Address')), + E('th', { 'class': 'th' }, _('MAC-Address')), + E('th', { 'class': 'th' }, _('Lease time remaining')) ]), - E('div', { 'class': 'tr placeholder' }, [ - E('div', { 'class': 'td' }, E('em', _('Collecting data...'))) + E('tr', { 'class': 'tr placeholder' }, [ + E('td', { 'class': 'td' }, E('em', _('Collecting data...'))) ]) ]) ]); @@ -50,15 +50,15 @@ CBILease6Status = form.DummyValue.extend({ renderWidget: function(section_id, option_id, cfgvalue) { return E([ E('h4', _('Active DHCPv6 Leases')), - E('div', { 'id': 'lease6_status_table', 'class': 'table' }, [ - E('div', { 'class': 'tr table-titles' }, [ - E('div', { 'class': 'th' }, _('Host')), - E('div', { 'class': 'th' }, _('IPv6-Address')), - E('div', { 'class': 'th' }, _('DUID')), - E('div', { 'class': 'th' }, _('Lease time remaining')) + E('table', { 'id': 'lease6_status_table', 'class': 'table' }, [ + E('tr', { 'class': 'tr table-titles' }, [ + E('th', { 'class': 'th' }, _('Host')), + E('th', { 'class': 'th' }, _('IPv6-Address')), + E('th', { 'class': 'th' }, _('DUID')), + E('th', { 'class': 'th' }, _('Lease time remaining')) ]), - E('div', { 'class': 'tr placeholder' }, [ - E('div', { 'class': 'td' }, E('em', _('Collecting data...'))) + E('tr', { 'class': 'tr placeholder' }, [ + E('td', { 'class': 'td' }, E('em', _('Collecting data...'))) ]) ]) ]); diff --git a/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js b/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js index 1855ee642..5d6bd4765 100644 --- a/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js +++ b/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js @@ -66,9 +66,9 @@ return view.extend({ return E([], [ E('h2', {}, [ _('Network Utilities') ]), - E('div', { 'class': 'table' }, [ - E('div', { 'class': 'tr' }, [ - E('div', { 'class': 'td left' }, [ + E('table', { 'class': 'table' }, [ + E('tr', { 'class': 'tr' }, [ + E('td', { 'class': 'td left' }, [ E('input', { 'style': 'margin:5px 0', 'type': 'text', @@ -91,7 +91,7 @@ return view.extend({ ]) ]), - E('div', { 'class': 'td left' }, [ + E('td', { 'class': 'td left' }, [ E('input', { 'style': 'margin:5px 0', 'type': 'text', @@ -114,7 +114,7 @@ return view.extend({ ]) ]), - E('div', { 'class': 'td left' }, [ + E('td', { 'class': 'td left' }, [ E('input', { 'style': 'margin:5px 0', 'type': 'text', diff --git a/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js b/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js index bb9877217..d19b025e3 100644 --- a/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js +++ b/luci-mod-network/htdocs/luci-static/resources/view/network/wireless.js @@ -649,7 +649,7 @@ return view.extend({ if (bss.network.isClientDisconnectSupported()) { if (table.firstElementChild.childNodes.length < 6) - table.firstElementChild.appendChild(E('div', { 'class': 'th cbi-section-actions'})); + table.firstElementChild.appendChild(E('th', { 'class': 'th cbi-section-actions'})); row.push(E('button', { 'class': 'cbi-button cbi-button-remove', @@ -850,7 +850,7 @@ return view.extend({ ]; } - return E('div', { 'class': 'td middle cbi-section-actions' }, E('div', btns)); + return E('td', { 'class': 'td middle cbi-section-actions' }, E('div', btns)); }; s.addModalOptions = function(s) { @@ -889,6 +889,12 @@ return view.extend({ o = ss.taboption('advanced', CBIWifiCountryValue, 'country', _('Country Code')); o.wifiNetwork = radioNet; + o = ss.taboption('advanced', form.ListValue, 'cell_density', _('Coverage cell density'), _('Configures data rates based on the coverage cell density. Normal configures basic rates to 6, 12, 24 Mbps if legacy 802.11b rates are not used else to 5.5, 11 Mbps. High configures basic rates to 12, 24 Mbps if legacy 802.11b rates are not used else to the 11 Mbps rate. Very High configures 24 Mbps as the basic rate. Supported rates lower than the minimum basic rate are not offered.')); + o.value('0', _('Disabled')); + o.value('1', _('Normal')); + o.value('2', _('High')); + o.value('3', _('Very High')); + o = ss.taboption('advanced', form.Flag, 'legacy_rates', _('Allow legacy 802.11b rates')); o.default = o.enabled; @@ -1656,15 +1662,15 @@ return view.extend({ }; s.handleScan = function(radioDev, ev) { - var table = E('div', { 'class': 'table' }, [ - E('div', { 'class': 'tr table-titles' }, [ - E('div', { 'class': 'th col-2 middle center' }, _('Signal')), - E('div', { 'class': 'th col-4 middle left' }, _('SSID')), - E('div', { 'class': 'th col-2 middle center hide-xs' }, _('Channel')), - E('div', { 'class': 'th col-2 middle left hide-xs' }, _('Mode')), - E('div', { 'class': 'th col-3 middle left hide-xs' }, _('BSSID')), - E('div', { 'class': 'th col-3 middle left' }, _('Encryption')), - E('div', { 'class': 'th cbi-section-actions right' }, ' '), + var table = E('table', { 'class': 'table' }, [ + E('tr', { 'class': 'tr table-titles' }, [ + E('th', { 'class': 'th col-2 middle center' }, _('Signal')), + E('th', { 'class': 'th col-4 middle left' }, _('SSID')), + E('th', { 'class': 'th col-2 middle center hide-xs' }, _('Channel')), + E('th', { 'class': 'th col-2 middle left hide-xs' }, _('Mode')), + E('th', { 'class': 'th col-3 middle left hide-xs' }, _('BSSID')), + E('th', { 'class': 'th col-3 middle left' }, _('Encryption')), + E('th', { 'class': 'th cbi-section-actions right' }, ' '), ]) ]); @@ -2073,13 +2079,13 @@ return view.extend({ .then(L.bind(this.poll_status, this, nodes)); }, this), 5); - var table = E('div', { 'class': 'table assoclist', 'id': 'wifi_assoclist_table' }, [ - E('div', { 'class': 'tr table-titles' }, [ - E('div', { 'class': 'th nowrap' }, _('Network')), - E('div', { 'class': 'th hide-xs' }, _('MAC-Address')), - E('div', { 'class': 'th' }, _('Host')), - E('div', { 'class': 'th' }, _('Signal / Noise')), - E('div', { 'class': 'th' }, _('RX Rate / TX Rate')) + var table = E('table', { 'class': 'table assoclist', 'id': 'wifi_assoclist_table' }, [ + E('tr', { 'class': 'tr table-titles' }, [ + E('th', { 'class': 'th nowrap' }, _('Network')), + E('th', { 'class': 'th hide-xs' }, _('MAC-Address')), + E('th', { 'class': 'th' }, _('Host')), + E('th', { 'class': 'th' }, _('Signal / Noise')), + E('th', { 'class': 'th' }, _('RX Rate / TX Rate')) ]) ]); From 49371cc8e6e9c3ec66b0d0f1f424354bf85988ea Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:27:30 +0100 Subject: [PATCH 36/45] Use metric for IPv6 routes --- mptcp/files/etc/init.d/mptcp | 1 + 1 file changed, 1 insertion(+) diff --git a/mptcp/files/etc/init.d/mptcp b/mptcp/files/etc/init.d/mptcp index 95c9a4fb9..77310f5eb 100755 --- a/mptcp/files/etc/init.d/mptcp +++ b/mptcp/files/etc/init.d/mptcp @@ -322,6 +322,7 @@ interface_multipath_settings() { EOF else ip -6 rule add from $ip6addr table 6$id pref 0 + ip -6 route replace $network6/$netmask6 dev $iface scope link metric 6$id ip -6 route replace $network6/$netmask6 dev $iface scope link table 6$id ip -6 route replace default via $gateway6 dev $iface table 6$id ip -6 route replace default via $gateway6 dev $iface metric $id From f3d4e9df2582b2b59a8d953483bf7b3cafd8db9d Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:28:13 +0100 Subject: [PATCH 37/45] Add glorytun-udp new splitted config in tracker --- .../usr/share/omr/post-tracking.d/post-tracking | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/mptcp/files/usr/share/omr/post-tracking.d/post-tracking b/mptcp/files/usr/share/omr/post-tracking.d/post-tracking index e7cd3f311..bdedd275a 100755 --- a/mptcp/files/usr/share/omr/post-tracking.d/post-tracking +++ b/mptcp/files/usr/share/omr/post-tracking.d/post-tracking @@ -371,7 +371,7 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || [ "$interface_up" != "true" ]; then config_load network config_foreach set_route interface $OMR_TRACKER_INTERFACE fi - if [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && [ "$(uci -q get openmptcprouter.omr.shadowsocks)" = "up" ] && [ "$(uci -q get shadowsocks-libev.ss_rules.redir_udp)" = "" ] && [ "$(uci -q get shadowsocks-libev.hi2.mode)" = "tcp_and_udp" ] && [ "$(uci -q get shadowsocks-libev.sss0.obfs)" != "1" ]; then + if [ "$(uci -q get openmptcprouter.settings.shadowsocksudp)" = "1" ] && [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && [ "$(uci -q get openmptcprouter.omr.shadowsocks)" = "up" ] && [ "$(uci -q get shadowsocks-libev.ss_rules.redir_udp)" = "" ] && [ "$(uci -q get shadowsocks-libev.hi2.mode)" = "tcp_and_udp" ] && [ "$(uci -q get shadowsocks-libev.sss0.obfs)" != "1" ]; then _log "Tunnel down use ShadowSocks for UDP" uci -q set shadowsocks-libev.ss_rules.redir_udp='hi2' if /etc/init.d/shadowsocks-libev rules_exist ; then @@ -390,6 +390,9 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || [ "$interface_up" != "true" ]; then if [ "$(uci -q get glorytun.vpn.enable)" = "1" ]; then _log "Glorytun VPN down, restart it" /etc/init.d/glorytun restart + fi + if [ "$(uci -q get glorytun-udp.vpn.enable)" = "1" ]; then + _log "Glorytun UDP VPN down, restart it" /etc/init.d/glorytun-udp restart fi config_load openmptcprouter @@ -438,7 +441,7 @@ if [ "$OMR_TRACKER_INTERFACE" = "glorytun" ] || [ "$OMR_TRACKER_INTERFACE" = "om fi uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE="interface" uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.latency="$OMR_TRACKER_LATENCY" - if [ "$(uci -q get glorytun.vpn.enable)" != "1" ]; then + if [ "$(uci -q get glorytun.vpn.enable)" != "1" ] || [ "$(uci -q get glorytun-udp.vpn.enable)" != "1" ]; then if [ -n "$(uci -q get network.$OMR_TRACKER_INTERFACE.mtu)" ]; then mtu=$(uci -q get network.$OMR_TRACKER_INTERFACE.mtu) uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mtu=$mtu @@ -576,13 +579,13 @@ if [ "$multipath_config" = "on" ] || [ "$multipath_config" = "backup" ]; then [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.multipathvpn)" != "1" ] && [ "$multipath_config" = "backup" ] && [ "$(pgrep glorytun-udp)" != "" ] && gtudpst="backup" if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.vpn)" != "1" ] && [ "$(pgrep glorytun-udp)" != "" ] && [ "$(glorytun-udp path | grep $OMR_TRACKER_DEVICE_IP)" = "" ]; then if [ "$download" != "0" ] && [ "$download" != "" ] && [ "$upload" != "0" ] && [ "$upload" != "" ]; then - if [ "$(uci -q get glorytun.vpn.rateauto)" = "1" ]; then + if [ "$(uci -q get glorytun-udp.vpn.rateauto)" = "1" ]; then glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set up rate auto tx $((upload*1000/8)) rx $((download*1000/8)) > /dev/null 2>&1 else glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set up rate fixed tx $((upload*1000/8)) rx $((download*1000/8)) > /dev/null 2>&1 fi else - if [ "$(uci -q get glorytun.vpn.rateauto)" = "1" ]; then + if [ "$(uci -q get glorytun-udp.vpn.rateauto)" = "1" ]; then glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set up rate auto tx 12500000 rx 12500000 > /dev/null 2>&1 else glorytun-udp path addr $OMR_TRACKER_DEVICE_IP dev tun0 set up rate fixed tx 12500000 rx 12500000 > /dev/null 2>&1 @@ -666,7 +669,7 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($( [ -n "$asn" ] && { uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.asn="$asn" } - if [ "$OMR_TRACKER_INTERFACE" != "omrvpn" ] && [ "$(uci -q get glorytun.vpn.enable)" != "1" ]; then + if [ "$OMR_TRACKER_INTERFACE" != "omrvpn" ] && [ "$(uci -q get glorytun.vpn.enable)" != "1" ] && [ "$(uci -q get glorytun-udp.vpn.enable)" != "1" ]; then if [ -n "$(uci -q get network.$OMR_TRACKER_INTERFACE.mtu)" ]; then mtu=$(uci -q get network.$OMR_TRACKER_INTERFACE.mtu) [ -n "$mtu" ] && { @@ -776,6 +779,10 @@ fi if [ "$(pgrep glorytun)" = "" ] && [ "$(uci -q get glorytun.vpn.enable)" = "1" ] && [ -f /etc/init.d/glorytun ] && [ "$(uci -q get glorytun.vpn.key)" != "" ]; then _log "Can't find Glorytun, restart it..." /etc/init.d/glorytun restart + sleep 5 +fi +if [ "$(pgrep glorytun-udp)" = "" ] && [ "$(uci -q get glorytun-usp.vpn.enable)" = "1" ] && [ -f /etc/init.d/glorytun-udp ] && [ "$(uci -q get glorytun-udp.vpn.key)" != "" ]; then + _log "Can't find Glorytun UDP, restart it..." /etc/init.d/glorytun-udp restart sleep 5 fi From bef8c56ba067e36302a3ba04b43094a0b6d759ad Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:28:29 +0100 Subject: [PATCH 38/45] Update ndpi --- ndpi-netfilter2/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndpi-netfilter2/Makefile b/ndpi-netfilter2/Makefile index e977efbc5..9f04c4e87 100644 --- a/ndpi-netfilter2/Makefile +++ b/ndpi-netfilter2/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=ndpi-netfilter2 PKG_RELEASE:=2 -PKG_REV:=86eaa857129cdd63152ebcd483366706e28089cc +PKG_REV:=0a03249da911f4033fd2a0d38a97cdba72eee2b6 PKG_VERSION:=3.2-$(PKG_REV) PKG_SOURCE_PROTO:=git From 855cde07f09497214e6762682d61c10ac9b963fd Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:28:55 +0100 Subject: [PATCH 39/45] Add glorytun-udp new splitted config for omr6in4 --- omr-6in4/files/bin/omr-6in4 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/omr-6in4/files/bin/omr-6in4 b/omr-6in4/files/bin/omr-6in4 index cc0fe0e59..c7eba5bfa 100755 --- a/omr-6in4/files/bin/omr-6in4 +++ b/omr-6in4/files/bin/omr-6in4 @@ -6,6 +6,10 @@ while true; do iface=$(uci -q get glorytun.vpn.dev) addr=$(uci -q get glorytun.vpn.localip) peer=$(uci -q get glorytun.vpn.remoteip) + elif [ "$(uci -q get glorytun-udp.vpn.enable)" = "1" ]; then + iface=$(uci -q get glorytun-udp.vpn.dev) + addr=$(uci -q get glorytun-udp.vpn.localip) + peer=$(uci -q get glorytun-udp.vpn.remoteip) elif [ "$(uci -q get dsvpn.vpn.enable)" = "1" ]; then iface=$(uci -q get dsvpn.vpn.dev) addr=$(uci -q get dsvpn.vpn.localip) From 8ef7544e4cdbc06ff920f2fd863f3c1b4278111f Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:29:13 +0100 Subject: [PATCH 40/45] Add glorytun-udp new splitted config for omr tracker --- omr-tracker/files/bin/omr-tracker | 2 ++ 1 file changed, 2 insertions(+) diff --git a/omr-tracker/files/bin/omr-tracker b/omr-tracker/files/bin/omr-tracker index b0a90246d..8b64a3785 100755 --- a/omr-tracker/files/bin/omr-tracker +++ b/omr-tracker/files/bin/omr-tracker @@ -204,6 +204,8 @@ while true; do if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ "$OMR_TRACKER_DEVICE_GATEWAY" = "0.0.0.0" ]; then if [ "$OMR_TRACKER_INTERFACE" = "omrvpn" ] && [ "$(uci -q get glorytun.vpn.enable)" = "1" ]; then OMR_TRACKER_DEVICE_GATEWAY=$(uci -q get glorytun.vpn.remoteip) + elif [ "$OMR_TRACKER_INTERFACE" = "omrvpn" ] && [ "$(uci -q get glorytun-udp.vpn.enable)" = "1" ]; then + OMR_TRACKER_DEVICE_GATEWAY=$(uci -q get glorytun-udp.vpn.remoteip) else OMR_TRACKER_DEVICE_GATEWAY="" fi From c407a885dd26fddbbb79e527d7e56325817d2ada Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:29:44 +0100 Subject: [PATCH 41/45] Use new interfaces for glorytun --- openmptcprouter-full/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmptcprouter-full/Makefile b/openmptcprouter-full/Makefile index 0d060fa9a..0ab4f84fd 100644 --- a/openmptcprouter-full/Makefile +++ b/openmptcprouter-full/Makefile @@ -35,7 +35,7 @@ MY_DEPENDS := \ wireless-tools \ libiwinfo-lua \ ca-bundle ca-certificates \ - luci-mod-admin-full luci-app-firewall luci-app-glorytun luci-app-shadowsocks-libev luci-app-unbound luci-theme-openmptcprouter luci-theme-argon luci-base \ + luci-mod-admin-full luci-app-firewall luci-app-glorytun-tcp luci-app-glorytun-udp luci-app-shadowsocks-libev luci-app-unbound luci-theme-openmptcprouter luci-theme-argon luci-base \ luci-app-omr-tracker luci-app-omr-dscp \ luci-app-sqm sqm-scripts-extra \ luci-app-vnstat2 omr-quota luci-app-omr-quota \ From cc9f3c9fe6f9c489d7e9506f7366e09b8bb9accc Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:31:05 +0100 Subject: [PATCH 42/45] Add glorytun-udp new splitted config in mptcp over vpn and vps api contact --- openmptcprouter/files/etc/init.d/mptcpovervpn | 6 ++ .../files/etc/init.d/openmptcprouter-vps | 68 +++++++++++++++---- 2 files changed, 61 insertions(+), 13 deletions(-) diff --git a/openmptcprouter/files/etc/init.d/mptcpovervpn b/openmptcprouter/files/etc/init.d/mptcpovervpn index 73f804191..870148e5b 100755 --- a/openmptcprouter/files/etc/init.d/mptcpovervpn +++ b/openmptcprouter/files/etc/init.d/mptcpovervpn @@ -132,11 +132,17 @@ start_service() uci -q batch <<-EOF >/dev/null set shadowsocks-libev.sss0.disabled='1' set glorytun.vpn.host='10.255.250.1' + set glorytun-udp.vpn.host='10.255.250.1' + commit glorytun + commit glorytun-udp EOF elif [ "$(uci -q get glorytun.vpn.host)" = "10.255.250.1" ] && [ "$nbintf" != "$nbintfvpn" ]; then uci -q batch <<-EOF >/dev/null delete shadowsocks-libev.sss0.disabled set glorytun.vpn.host="$(uci -q get openmptcprouter.vps.ip)" + set glorytun-udp.vpn.host="$(uci -q get openmptcprouter.vps.ip)" + commit glorytun + commit glorytun-udp EOF fi NBCPU=$(grep -c '^processor' /proc/cpuinfo | tr -d "\n") diff --git a/openmptcprouter/files/etc/init.d/openmptcprouter-vps b/openmptcprouter/files/etc/init.d/openmptcprouter-vps index 8db25ea42..b84667234 100755 --- a/openmptcprouter/files/etc/init.d/openmptcprouter-vps +++ b/openmptcprouter/files/etc/init.d/openmptcprouter-vps @@ -296,20 +296,20 @@ _get_vps_config() { fi if [ "$vpn" = "glorytun_udp" ]; then glorytun_state=1 - uci -q set glorytun.vpn.proto='udp' + #uci -q set glorytun.vpn.proto='udp' client_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.udp.client_ip')" host_ip="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.udp.host_ip')" port="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.port')" - if [ "$(uci -q get glorytun.vpn.port)" != "$port" ] && [ "$port" != "" ]; then + if [ "$(uci -q get glorytun-udp.vpn.port)" != "$port" ] && [ "$port" != "" ]; then uci -q batch <<-EOF >/dev/null - set glorytun.vpn.port=$port + set glorytun-udp.vpn.port=$port EOF fi if [ "$client_ip" != "dhcp" ] && [ -n "$client_ip" ]; then - if [ "$host_ip" != "$(uci -q get glorytun.vpn.remoteip)" ] || [ "$client_ip" != "$(uci -q get glorytun.vpn.localip)" ]; then + if [ "$host_ip" != "$(uci -q get glorytun-udp.vpn.remoteip)" ] || [ "$client_ip" != "$(uci -q get glorytun-udp.vpn.localip)" ]; then uci -q batch <<-EOF >/dev/null - set glorytun.vpn.localip=$client_ip - set glorytun.vpn.remoteip=$host_ip + set glorytun-udp.vpn.localip=$client_ip + set glorytun-udp.vpn.remoteip=$host_ip EOF glorytun_change=1 fi @@ -321,10 +321,10 @@ _get_vps_config() { glorytun_change=1 fi else - if [ "$(uci -q get glorytun.vpn.remoteip)" != "" ] || [ "$(uci -q get glorytun.vpn.localip)" != "" ]; then + if [ "$(uci -q get glorytun-udp.vpn.remoteip)" != "" ] || [ "$(uci -q get glorytun-udp.vpn.localip)" != "" ]; then uci -q batch <<-EOF >/dev/null - delete glorytun.vpn.localip - delete glorytun.vpn.remoteip + delete glorytun-udp.vpn.localip + delete glorytun-udp.vpn.remoteip EOF glorytun_change=1 fi @@ -403,14 +403,24 @@ _get_vps_config() { EOF glorytun_change=1 fi + if [ "$(uci -q get glorytun-udp.vpn.host)" != "127.0.0.1" ] && [ "$(uci -q get glorytun-udp.vpn.host)" != "$vpsip" ] && [ "$(uci -q get openmptcprouter.settings.ha)" != "1" ]; then + uci -q batch <<-EOF >/dev/null + set glorytun-udp.vpn.host="$vpsip" + EOF + glorytun_change=1 + fi if [ "$glorytun_change" != "0" ]; then uci -q batch <<-EOF >/dev/null commit glorytun + commit glorytun-udp EOF if [ "$(uci -q get glorytun.vpn.enable)" = "1" ]; then logger -t "OMR-VPS" "Restart glorytun..." /etc/init.d/glorytun restart >/dev/null 2>&1 + fi + if [ "$(uci -q get glorytun-udp.vpn.enable)" = "1" ]; then + logger -t "OMR-VPS" "Restart glorytun-udp..." /etc/init.d/glorytun-udp restart >/dev/null 2>&1 fi fi @@ -1148,9 +1158,6 @@ _set_config_from_vps() { if [ "$vpn" = "glorytun_tcp" ]; then glorytun_state=1 fi - if [ "$vpn" = "glorytun_udp" ]; then - glorytun_state=1 - fi [ -z "$glorytun_port" ] && glorytun_port="65001" glorytun_chacha="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.chacha')" [ -z "$glorytun_chacha" ] || [ "$glorytun_chacha" = "true" ] && glorytun_chacha=1 @@ -1167,6 +1174,28 @@ _set_config_from_vps() { uci -q commit glorytun logger -t "OMR-VPS" "Glorytun restart..." /etc/init.d/glorytun restart >/dev/null 2>&1 + fi + if ([ -n "$glorytun_key" ] && [ "$glorytun_key" != "$(uci -q get glorytun-udp.vpn.key)" ]) || ([ -n "$glorytun_port" ] || [ "$glorytun_port" != "$(uci -q get glorytun-udp.vpn.port)" ]); then + vpn="$(uci -q get openmptcprouter.settings.vpn)" + glorytun_state=0 + if [ "$vpn" = "glorytun_udp" ]; then + glorytun_state=1 + fi + [ -z "$glorytun_port" ] && glorytun_port="65001" + glorytun_chacha="$(echo "$vps_config" | jsonfilter -q -e '@.glorytun.chacha')" + [ -z "$glorytun_chacha" ] || [ "$glorytun_chacha" = "true" ] && glorytun_chacha=1 + [ "$glorytun_chacha" = "false" ] && glorytun_chacha=0 + uci -q batch <<-EOF >/dev/null + set glorytun-udp.vpn.port=$glorytun_port + set glorytun-udp.vpn.key=$glorytun_key + set glorytun-udp.vpn.enable=$glorytun_state + set glorytun-udp.vpn.chacha=$glorytun_chacha + EOF + if [ "$(uci -q get glorytun-udp.vpn.host)" != "127.0.0.1" ]; then + uci -q set glorytun-udp.vpn.host="$vpsip" + fi + uci -q commit glorytun-udp + logger -t "OMR-VPS" "Glorytun UDP restart..." /etc/init.d/glorytun-udp restart >/dev/null 2>&1 fi @@ -1535,6 +1564,14 @@ _config_service() { return } error=0 + if [ -n "$serial" ]; then + [ -z "$vps_config" ] && vps_config=$(_get_json "config?serial=${serial}") + if [ -n "$vps_config" ] && [ "$( echo "$vps_config" | jsonfilter -q -e '@.error')" = "False serial number" ]; then + logger -t "OMR-VPS" "Invalid serial number" + sed -i "s:${server}::g" /etc/config/* + return + fi + fi [ "$(uci -q get openmptcprouter.${servername}.get_config)" = "1" ] && [ "$(uci -q get openmptcprouter.${servername}.master)" = "1" ] && { _set_config_from_vps _get_gre_tunnel @@ -1555,6 +1592,8 @@ _config_service() { uci -q batch <<-EOF >/dev/null set glorytun.vpn.chacha20="0" commit glorytun + set glorytun-udp.vpn.chacha="0" + commit glorytun-udp EOF config_foreach _set_ss_server server "method" "aes-256-gcm" uci -q commit shadowsocks-libev @@ -1631,6 +1670,9 @@ set_pihole() { start_service() { serversnb=0 wanips="" + serial=$(cat /proc/cpuinfo | grep Serial | awk '{print $3}') + [ -z "$serial" ] && [ -f "/usr/sbin/dmidecode" ] && serial=$(/usr/sbin/dmidecode -t 1 | egrep 'Serial' | awk '{print $3}') + uci -q set openmptcprouter.settings.serial=${serial} config_load openmptcprouter config_foreach _count_server server config_foreach _get_local_wan_ip interface @@ -1642,6 +1684,6 @@ start_service() { } service_triggers() { - procd_add_reload_trigger openmptcprouter shadowsocks-libev glorytun mlvpn openvpn network upnpd dsvpn v2ray firewall + procd_add_reload_trigger openmptcprouter shadowsocks-libev glorytun glorytun-udp mlvpn openvpn network upnpd dsvpn v2ray firewall #procd_add_reload_trigger openmptcprouter shadowsocks-libev network upnpd } \ No newline at end of file From a5cec1b0fd525e9f13a548ac4110073be3db85de Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:32:03 +0100 Subject: [PATCH 43/45] Default dsvpn config --- .../files/etc/uci-defaults/2020-omr-vpn | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/openmptcprouter/files/etc/uci-defaults/2020-omr-vpn b/openmptcprouter/files/etc/uci-defaults/2020-omr-vpn index 201c4c226..bb4dbf559 100755 --- a/openmptcprouter/files/etc/uci-defaults/2020-omr-vpn +++ b/openmptcprouter/files/etc/uci-defaults/2020-omr-vpn @@ -74,11 +74,18 @@ if [ "$(uci -q get dsvpn.vpn)" = "" ]; then set dsvpn.vpn.port=65011 set dsvpn.vpn.localip=10.255.251.2 set dsvpn.vpn.remoteip=10.255.251.1 + set dsvpn.vpn.mode=client set dsvpn.vpn.enable=0 commit dsvpn EOF fi +if [ "$(uci -q get dsvpn.vpn.mode)" = "" ]; then + uci -q batch <<-EOF >/dev/null + set dsvpn.vpn.mode=client + commit dsvpn + EOF +fi if [ "$(uci -q show firewall | grep omrvpn)" = "" ]; then uci -q batch <<-EOF >/dev/null @@ -100,6 +107,12 @@ if [ "$(uci -q get ucitrack.@network[-1].affects | grep glorytun)" = "" ]; then commit ucitrack EOF fi +if [ "$(uci -q get ucitrack.@network[-1].affects | grep glorytun-udp)" = "" ]; then + uci -q batch <<-EOF >/dev/null + add_list ucitrack.@network[-1].affects="glorytun-udp" + commit ucitrack + EOF +fi if [ "$(uci -q get ucitrack.@network[-1].affects | grep dsvpn)" = "" ]; then uci -q batch <<-EOF >/dev/null add_list ucitrack.@network[-1].affects="dsvpn" @@ -112,6 +125,28 @@ if [ "$(uci -q get ucitrack.@glorytun[-1].affects | grep openmptcprouter-vps)" = commit ucitrack EOF fi +if [ "$(uci -q get ucitrack.@glorytun-udp[-1].affects | grep openmptcprouter-vps)" = "" ]; then + uci -q batch <<-EOF >/dev/null + add_list ucitrack.@glorytun-udp[-1].affects="openmptcprouter-vps" + commit ucitrack + EOF +fi + +if [ "$(uci -q get glorytun-udp.vpn.key)" = "" ] && [ "$(uci -q get glorytun.vpn.key)" != "" ]; then + uci -q batch <<-EOF >/dev/null + set glorytun-udp.vpn.key=$(uci -q get glorytun.vpn.key) + set glorytun-udp.vpn.host=$(uci -q get glorytun.vpn.host) + EOF + if [ "$(uci -q get glorytun-udp.vpn.proto)" = "udp" ]; then + uci -q batch <<-EOF >/dev/null + set glorytun-udp.vpn.enable=1 + set glorytun.vpn.enable=0 + commit glorytun + EOF + fi + uci -q commit glorytun-udp +fi + rm -f /tmp/luci-indexcache From b854815d66a4439a4107899daf1acc33d6072070 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:33:12 +0100 Subject: [PATCH 44/45] Flush v2ray config before setting new rules --- v2ray-core/files/etc/init.d/v2ray | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/v2ray-core/files/etc/init.d/v2ray b/v2ray-core/files/etc/init.d/v2ray index 98aacf26e..34acc668b 100755 --- a/v2ray-core/files/etc/init.d/v2ray +++ b/v2ray-core/files/etc/init.d/v2ray @@ -413,8 +413,12 @@ add_v2ray_redirect_rules() { test -n "$port" || return # This part need a rewrite + v2ray-rules -f v2ray-rules -l ${port} -L ${port} -s $OUTBOUND_SERVERS_V4 --rule-name def --src-default forward --dst-default forward --local-default forward - [ "$(uci -q get v2ray.main.inbounds | grep omr6)" != "" ] && v2ray-rules6 -l $((port+1)) -L $((port+1)) --rule-name def --src-default forward --dst-default forward --local-default forward + [ "$(uci -q get v2ray.main.inbounds | grep omr6)" != "" ] && { + v2ray-rules6 -f + v2ray-rules6 -l $((port+1)) -L $((port+1)) --rule-name def --src-default forward --dst-default forward --local-default forward + } [ -f /etc/init.d/omr-bypass ] && { logger -t "v2ray" "Reload omr-bypass rules" /etc/init.d/omr-bypass reload_rules From 44ea3913e9519a486a5d260625cdeef2912fc3f5 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Thu, 3 Dec 2020 11:33:33 +0100 Subject: [PATCH 45/45] Disable v2ray log --- v2ray-core/files/etc/uci-defaults/3010-omr-v2ray | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/v2ray-core/files/etc/uci-defaults/3010-omr-v2ray b/v2ray-core/files/etc/uci-defaults/3010-omr-v2ray index 18a3cc65d..f0a22aff0 100644 --- a/v2ray-core/files/etc/uci-defaults/3010-omr-v2ray +++ b/v2ray-core/files/etc/uci-defaults/3010-omr-v2ray @@ -6,9 +6,9 @@ if [ -z "$(uci -q get v2ray.main)" ]; then set v2ray.main=v2ray set v2ray.main.v2ray_file='/usr/bin/v2ray' set v2ray.main.mem_percentage='0' - set v2ray.main.loglevel='warning' + set v2ray.main.loglevel='debug' set v2ray.main.access_log='/dev/null' - set v2ray.main.error_log='/var/log/v2ray-error.log' + set v2ray.main.error_log='/dev/null' set v2ray.main.enabled='0' set v2ray.main.outbounds='omrout' set v2ray.main.inbounds='omr' @@ -136,5 +136,11 @@ if [ "$(uci -q get v2ray.omrrouting)" = "" ]; then EOF fi +if [ "$(uci -q get v2ray.main.error_log)" != "/dev/null" ]; then + uci -q batch <<-EOF >/dev/null + set v2ray.main.error_log='/dev/null' + commit v2ray + EOF +fi exit 0 \ No newline at end of file