diff --git a/luci-app-natter2/Makefile b/luci-app-natter2/Makefile
index 947c37ddf..0a63966df 100755
--- a/luci-app-natter2/Makefile
+++ b/luci-app-natter2/Makefile
@@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-natter2
PKG_VERSION:=1.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
LUCI_TITLE:=LuCI Support for Natter v2.0.0-rc1
LUCI_PKGARCH:=all
diff --git a/luci-app-natter2/luasrc/model/cbi/natter2/base.lua b/luci-app-natter2/luasrc/model/cbi/natter2/base.lua
index e72ef51bf..938509e55 100755
--- a/luci-app-natter2/luasrc/model/cbi/natter2/base.lua
+++ b/luci-app-natter2/luasrc/model/cbi/natter2/base.lua
@@ -19,9 +19,12 @@ enable.default = 0
if check_file("/tmp/natter2_nat_type") then
natter_nat_type_tcp = luci.sys.exec ("grep TCP /tmp/natter2_nat_type")
natter_nat_type_udp = luci.sys.exec ("grep UDP /tmp/natter2_nat_type")
- nat_check = s:option (Button, "nat_check", translate("Check NAT Status"), translate("Proxy programs may affect NAT types") .. "
" .. natter_nat_type_tcp .. "
" .. natter_nat_type_udp)
+ nat_check = s:option (Button, "nat_check", translate("Check NAT Status"), translate("") .. "
" .. natter_nat_type_tcp .. "
" .. natter_nat_type_udp)
else
- nat_check = s:option (Button, "nat_check", translate("Check NAT Status"))
+ nat_check = s:option (Button, "nat_check", translate("Check NAT Status"), translate("Tips")
+ .. [[
]] .. translate("Recommended to accept high UDP ports in system firewall")
+ .. [[
]] .. translate("Turn off transparent proxies to ensure detection accuracy")
+ .. [[
]] .. translate("After clicking Exec button, please wait for the luci to refresh"))
end
nat_check.inputtitle = translate("Exec")
diff --git a/luci-app-natter2/po/zh-cn/natter2.po b/luci-app-natter2/po/zh-cn/natter2.po
index 56fb0a7eb..b18f9e57a 100755
--- a/luci-app-natter2/po/zh-cn/natter2.po
+++ b/luci-app-natter2/po/zh-cn/natter2.po
@@ -1,5 +1,5 @@
msgid "Natter v2"
-msgstr "Natter v2"
+msgstr "Natter v2 测试版"
msgid "Base Settings"
msgstr "基础设置"
@@ -141,3 +141,15 @@ msgstr "使用自定义的 STUN 服务器"
msgid "Using customized Keepalive server"
msgstr "使用自定义的保活服务器"
+
+msgid "Tips"
+msgstr "提示"
+
+msgid "Recommended to accept high UDP ports in system firewall"
+msgstr "建议在防火墙中放行高位 UDP 端口"
+
+msgid "Turn off transparent proxies to ensure detection accuracy"
+msgstr "关闭透明代理以确保检测准确性"
+
+msgid "After clicking Exec button, please wait for the luci to refresh"
+msgstr "点击执行后,请耐心等待页面自动刷新"
diff --git a/luci-app-natter2/po/zh_Hans/natter2.po b/luci-app-natter2/po/zh_Hans/natter2.po
index 56fb0a7eb..b18f9e57a 100755
--- a/luci-app-natter2/po/zh_Hans/natter2.po
+++ b/luci-app-natter2/po/zh_Hans/natter2.po
@@ -1,5 +1,5 @@
msgid "Natter v2"
-msgstr "Natter v2"
+msgstr "Natter v2 测试版"
msgid "Base Settings"
msgstr "基础设置"
@@ -141,3 +141,15 @@ msgstr "使用自定义的 STUN 服务器"
msgid "Using customized Keepalive server"
msgstr "使用自定义的保活服务器"
+
+msgid "Tips"
+msgstr "提示"
+
+msgid "Recommended to accept high UDP ports in system firewall"
+msgstr "建议在防火墙中放行高位 UDP 端口"
+
+msgid "Turn off transparent proxies to ensure detection accuracy"
+msgstr "关闭透明代理以确保检测准确性"
+
+msgid "After clicking Exec button, please wait for the luci to refresh"
+msgstr "点击执行后,请耐心等待页面自动刷新"
diff --git a/luci-app-natter2/root/etc/init.d/natter2 b/luci-app-natter2/root/etc/init.d/natter2
index 0ca9a5aa0..5911efc7c 100755
--- a/luci-app-natter2/root/etc/init.d/natter2
+++ b/luci-app-natter2/root/etc/init.d/natter2
@@ -24,7 +24,7 @@ start_service() {
for i in $instance_list
do
local eval $i="$(uci_get_by_type instances $u $i)"
- echo "$i : $(uci_get_by_type instances $u $i)"
+ # echo "$i : $(uci_get_by_type instances $u $i)"
done ; unset i
[ "$enable_instance" != 1 ] && continue
@@ -74,8 +74,8 @@ start_service() {
cp -a /usr/share/luci-app-natter2/notify-base.sh $var_file
chmod +x $var_file
- echo "log_file: $log_file"
- echo "var_file: $var_file"
+ # echo "log_file: $log_file"
+ # echo "var_file: $var_file"
sleep $delay
for i in $(ps -efww | grep "$script_path" | grep -v grep | grep -v $$ | grep "$id" | awk '{print $1}')
@@ -108,6 +108,7 @@ stop_service() {
uci set natter2.@instances[$u].tmp_public_port=""
uci commit natter2
done
+ rm -f /tmp/natter2_nat_type
}
restart() {
diff --git a/luci-app-natter2/root/usr/share/luci-app-natter2/nat-check.sh b/luci-app-natter2/root/usr/share/luci-app-natter2/nat-check.sh
index c3d8ee71e..d82e10cb6 100755
--- a/luci-app-natter2/root/usr/share/luci-app-natter2/nat-check.sh
+++ b/luci-app-natter2/root/usr/share/luci-app-natter2/nat-check.sh
@@ -1,18 +1,39 @@
#!/bin/sh
script_file='/usr/share/natter2/natter-check/natter-check.py'
-tmp_path=$(uci get natter2.@base[0].tmp_path)
-[ ! "$tmp_path" ] && tmp_path="/tmp/natter2"
+natter2_nat_type_file="/tmp/natter2_nat_type"
+tmp_natter2_nat_type_file="/tmp/tmp_natter2_nat_type"
+
+rm -f $natter2_nat_type_file
+rm -f $tmp_natter2_nat_type_file
+
+$(which python) $script_file | egrep 'Checking TCP|Checking UDP' > $tmp_natter2_nat_type_file
+TCP=$(awk -F '[:]+' '/TCP/{print $2}' $tmp_natter2_nat_type_file | sed 's/\[//g;s/\]//g')
+UDP=$(awk -F '[:]+' '/UDP/{print $2}' $tmp_natter2_nat_type_file | sed 's/\[//g;s/\]//g')
-mkdir -p $tmp_path
-rm -f /tmp/natter2_nat_type
-rm -f $tmp_path/natter2_nat_type.tmp
-python3 $script_file | egrep 'Checking TCP|Checking UDP' > $tmp_path/natter2_nat_type.tmp
-TCP=$(awk -F '[:]+' '/TCP/{print $2}' $tmp_path/natter2_nat_type.tmp | sed 's/\[//g;s/\]//g')
-UDP=$(awk -F '[:]+' '/UDP/{print $2}' $tmp_path/natter2_nat_type.tmp | sed 's/\[//g;s/\]//g')
-rm -f $tmp_path/natter2_nat_type.tmp
[ ! "$TCP" ] && TCP="未知"
[ ! "$UDP" ] && UDP="未知"
-echo "TCP: NAT $TCP" > /tmp/natter2_nat_type
-echo "UDP: NAT $UDP" >> /tmp/natter2_nat_type
+function NAT_Type() {
+ case $1 in
+ 0)
+ echo "Public Network"
+ ;;
+ 1)
+ echo "Full Cone"
+ ;;
+ 2)
+ echo "Restricted Cone"
+ ;;
+ 3)
+ echo "Port Restricted Cone"
+ ;;
+ 4)
+ echo "Symmetric"
+ ;;
+ esac
+}
+echo "TCP: NAT $TCP | $(NAT_Type $TCP)" > $natter2_nat_type_file
+echo "UDP: NAT $UDP | $(NAT_Type $UDP)" >> $natter2_nat_type_file
+
+rm -f $tmp_natter2_nat_type_file
\ No newline at end of file