update 2024-01-01 23:35:43

This commit is contained in:
github-actions[bot] 2024-01-01 23:35:43 +08:00
parent c900a97282
commit 293b2bc7d3
18 changed files with 818 additions and 0 deletions

15
luci-app-natter2/Makefile Executable file
View File

@ -0,0 +1,15 @@
# Copyright (C) 2020-2024 Hyy2001X <https://github.com/Hyy2001X>
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-natter2
PKG_VERSION:=1.0
PKG_RELEASE:=1
LUCI_TITLE:=LuCI Support for Natter v2.0.0-rc1
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+natter2
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

3
luci-app-natter2/README.md Executable file
View File

@ -0,0 +1,3 @@
# luci-app-natter2
项目地址: https://github.com/MikeWang000000/Natter

View File

@ -0,0 +1,21 @@
module("luci.controller.natter2",package.seeall)
function index()
if not nixio.fs.access("/etc/config/natter2")then
return
end
entry({"admin","network","natter2"},alias("admin","network","natter2","base"),_("Natter v2"),99).dependent=true
entry({"admin","network","natter2","base"},cbi("natter2/base"),_("Base Settings"),10).leaf=true
entry({"admin","network","natter2","instances"},cbi("natter2/instances")).leaf=true
entry({"admin","network","natter2","log"},form("natter2/log"),_("Log"),20).leaf=true
entry({"admin","network","natter2","print_log"},call("print_log")).leaf=true
entry({"admin","network","natter2","del_log"},call("del_log")).leaf=true
end
function print_log()
luci.http.write(luci.sys.exec("sh /usr/share/luci-app-natter2/log.sh print"))
end
function del_log()
luci.http.write(luci.sys.exec("sh /usr/share/luci-app-natter2/log.sh del"))
end

View File

@ -0,0 +1,73 @@
m = Map("natter2", translate("Natter v2"),
translate("Expose your port behind full-cone NAT to the Internet")
.. [[<br /><br /><a href="https://github.com/MikeWang000000/Natter">]]
.. translate("Project")
.. [[</a>]]
)
s = m:section(TypedSection, "base")
s.addremove = false
s.anonymous = true
local function check_file(e)
return luci.sys.exec('ls "%s" 2> /dev/null' % e) ~= "" and true or false
end
enable = s:option(Flag, "enable", translate("Enable"))
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") .. "<br><br>" .. natter_nat_type_tcp .. "<br><br>" .. natter_nat_type_udp)
else
nat_check = s:option (Button, "nat_check", translate("Check NAT Status"))
end
nat_check.inputtitle = translate("Exec")
nat_check.write = function()
luci.sys.call ("sh /usr/share/luci-app-natter2/nat-check.sh")
luci.http.redirect(luci.dispatcher.build_url("admin", "network", "natter2", "base"))
end
tmp_path = s:option(Value, "tmp_path", translate("Tmp Path"))
tmp_path.default = "/tmp/natter2"
tmp_path.placeholder = "/tmp/natter2"
tmp_path.rmempty = false
s = m:section(TypedSection, "instances", translate("Instances"), translate("Setting up multiple instances"))
s.anonymous = true
s.addremove = true
s.template = "cbi/tblsection"
s.extedit = luci.dispatcher.build_url("admin", "network", "natter2", "instances", "%s")
function s.create(...)
local e=TypedSection.create(...)
if e then
luci.http.redirect(s.extedit%e)
return
end
end
enable_instance = s:option(Flag, "enable_instance", translate("Enable"))
enable_instance.default = 1
enable_instance.width = "5%"
remark = s:option(DummyValue,"remark",translate("Remark"))
remark.width = "5%"
protocol = s:option(DummyValue,"protocol",translate("Protocol"))
remark.width = "5%"
tmp_public_port = s:option(DummyValue, "tmp_public_port", translate("Public Port"))
remark.width = "5%"
target_address = s:option(DummyValue, "target_address", translate("Target Address"))
remark.width = "5%"
target_port = s:option(DummyValue, "target_port", translate("Target Port"))
remark.width = "5%"
notify_path = s:option(DummyValue, "notify_path", translate("Notify Script Path"))
remark.width = "5%"
return m

View File

@ -0,0 +1,119 @@
m = Map("natter2",translate("Instances Settings"),
translate("")
.. [[<a href="https://github.com/MikeWang000000/Natter/blob/master/docs/usage.md">]]
.. translate("Instructions")
.. [[</a>]])
m.redirect=luci.dispatcher.build_url("admin","network","natter2")
s = m:section(NamedSection,arg[1],"instances","")
s.addremove = false
s.dynamic = false
local function check_binary(e)
return luci.sys.exec('which "%s" 2> /dev/null' % e) ~= "" and true or false
end
enable_instance = s:option(Flag,"enable_instance",translate("Enable"))
local e = luci.sys.exec("cut -d '-' -f1 /proc/sys/kernel/random/uuid 2> /dev/null")
id = s:option(Value,"id",translate("ID"))
id.default = e
remark = s:option(Value,"remark",translate("Remark"))
remark.rmempty=false
protocol = s:option(ListValue,"protocol",translate("Protocol"))
protocol:value('tcp',translate("TCP"))
protocol:value('udp',translate("UDP"))
protocol.default = 'tcp'
enable_stun_server = s:option(Flag, "enable_stun_server", translate("Enable Stun Server"), translate("Using customized STUN server"))
stun_server = s:option(DynamicList, "stun_server", translate("STUN Server"))
stun_server.rmempty = true
stun_server:depends({enable_stun_server = "1"})
enable_keepalive_server = s:option(Flag, "enable_keepalive_server", translate("Enable Keepalive Server"), translate("Using customized Keepalive server"))
keepalive_server = s:option(Value, "keepalive_server", translate("Keepalive Server"))
keepalive_server.rmempty = true
keepalive_server:depends({enable_keepalive_server = "1"})
interval = s:option(Value,"interval",translate("Interval (Seconds)"),translate("The number of seconds between keepalive"))
interval.default = 15
interval.datatype = "uinteger"
enable_bonding = s:option(Flag,"enable_bonding",translate("Enable Bonding Options"))
enable_bonding.rmempty = true
bonding_interface = s:option(Value, "bonding_interface", translate("Bonding Interface"))
bonding_interface.rmempty = true
bonding_interface.default = '0.0.0.0'
bonding_interface:depends({enable_bonding = "1"})
bonding_port = s:option(Value, "bonding_port", translate("Bonding Port"))
bonding_port.rmempty = true
bonding_port.default = '0'
bonding_port:depends({enable_bonding = "1"})
enable_forwarding = s:option(Flag,"enable_forwarding",translate("Enable Forwarding Options"),translate("Forwarding to internal devices"))
forwarding_method = s:option(ListValue,"forwarding_method",translate("Forwarding Method"),
translate("")
.. [[<a href="https://github.com/MikeWang000000/Natter/blob/master/docs/forward.md">]]
.. translate("Instructions for forwarding method")
.. [[</a>]])
forwarding_method:value('socket',translate("socket (Integrated)"))
if check_binary("iptables") then
forwarding_method:value('iptables',translate("iptables (Kernel)"))
end
if check_binary("nftables") then
forwarding_method:value('nftables',translate("nftables (Kernel)"))
end
if check_binary("socat") then
forwarding_method:value('socat',translate("socat"))
end
if check_binary("gost") then
forwarding_method:value('gost',translate("gost"))
end
forwarding_method.default = 'socket'
forwarding_method:depends({enable_forwarding = "1"})
target_address = s:option(Value, "target_address", translate("Target Address"))
target_address.datatype = "ipmask4"
luci.sys.net.ipv4_hints(
function(ip, name)
target_address:value(ip, "%s (%s)" %{ ip, name })
end)
target_address:depends({enable_forwarding = "1"})
target_port = s:option(Value, "target_port", translate("Target Port"))
target_port.datatype = "port"
target_port:depends({enable_forwarding = "1"})
enable_forwarding_retry = s:option(Flag,"enable_forwarding_retry",translate("Enable Forwarding Retry"),translate("Retry until the target port is open"))
enable_forwarding_retry:depends({enable_forwarding = "1"})
enable_forwarding_retry.default = 1
enable_forwarding_retry.rmempty = false
enable_quit = s:option(Flag,"enable_quit",translate("Enable Quit"),translate("Exit immediately when the mapping address changes"))
enable_quit.default = "0"
delay = s:option(Value,"delay",translate("Start delay (Seconds)"),translate("Time to wait before starting this instance"))
delay.default = 0
delay.datatype = "uinteger"
delay.rmempty = false
log_level = s:option(ListValue,"log_level",translate("Log Level"))
log_level:value('normal',translate("Normal"))
log_level:value('verbose',translate("Verbose"))
enable_notify = s:option(Flag,"enable_notify",translate("Enable Notify Script"))
enable_notify.rmempty = false
notify_path = s:option(Value, "notify_path", translate("Notify Script Path"),
translate("")
.. [[<a href="https://github.com/MikeWang000000/Natter/blob/master/docs/script.md">]]
.. translate("Instructions for using the notification script")
.. [[</a>]])
notify_path.rmempty = true
notify_path.default = "/usr/share/luci-app-natter2/notify-example.sh"
notify_path:depends({enable_notify = "1"})
return m

View File

@ -0,0 +1,5 @@
log=SimpleForm("natter2")
log.reset=false
log.submit=false
log:append(Template("natter2/natter_log"))
return log

View File

@ -0,0 +1,29 @@
<script type="text/javascript">
//<![CDATA[
function del_log(btn) {
XHR.get('<%=luci.dispatcher.build_url("admin/network/natter2/del_log")%>', null,
function(x, data) {
if(x && x.status == 200) {
var log_textarea = document.getElementById('log_textarea');
log_textarea.innerHTML = "";
log_textarea.scrollTop = log_textarea.scrollHeight;
}
}
);
}
XHR.poll(5, '<%=luci.dispatcher.build_url("admin/network/natter2/print_log")%>', null,
function(x, data) {
if(x && x.status == 200) {
var log_textarea = document.getElementById('log_textarea');
log_textarea.innerHTML = x.responseText;
log_textarea.scrollTop = log_textarea.scrollHeight;
}
}
);
//]]>
</script>
<fieldset class="cbi-section" id="_log_fieldset" >
<input class="cbi-button cbi-input-remove" type="button" onclick="del_log()" value="<%:Delete Logs%>" />
<textarea id="log_textarea" class="cbi-input-textarea" style="width: 100%;margin-top: 10px;" data-update="change" rows="30" wrap="off" readonly="readonly"></textarea>
</fieldset>

View File

@ -0,0 +1,143 @@
msgid "Natter v2"
msgstr "Natter v2"
msgid "Base Settings"
msgstr "基础设置"
msgid "Log"
msgstr "日志"
msgid "Expose your port behind full-cone NAT to the Internet"
msgstr "将 FullCone NAT (NAT 1) 后的端口,打洞暴露至互联网"
msgid "Project"
msgstr "项目地址"
msgid "Enable"
msgstr "启用"
msgid "Check NAT Status"
msgstr "NAT 类型检测"
msgid "Proxy programs may affect NAT types"
msgstr "代理程序可能会影响 NAT 类型"
msgid "Tmp Path"
msgstr "临时路径"
msgid "Instances"
msgstr "实例"
msgid "Setting up multiple instances"
msgstr "设置多个实例"
msgid "Remark"
msgstr "备注"
msgid "Public Port"
msgstr "公开端口"
msgid "Target Address"
msgstr "目标地址"
msgid "Target Port"
msgstr "目标端口"
msgid "Notify Script Path"
msgstr "通知脚本路径"
msgid "Enable Stun Server"
msgstr "自定义 STUN 服务器"
msgid "STUN Server"
msgstr "STUN 服务器"
msgid "Enable Keepalive Server"
msgstr "自定义保活服务器"
msgid "Keepalive Server"
msgstr "保活服务器"
msgid "Interval (Seconds)"
msgstr "保活间隔(秒)"
msgid "The number of seconds between keepalive"
msgstr "每次保活的间隔秒数"
msgid "Enable Bonding Options"
msgstr "启用绑定"
msgid "Bonding Interface"
msgstr "绑定接口"
msgid "Bonding Port"
msgstr "绑定端口"
msgid "Enable Forwarding Options"
msgstr "启用转发"
msgid "Forwarding to internal devices"
msgstr "转发至内部设备"
msgid "Forwarding Method"
msgstr "转发方式"
msgid "Instructions for forwarding method"
msgstr "转发方式说明"
msgid "socket (Integrated)"
msgstr "Socket内置"
msgid "iptables (Kernel)"
msgstr "iptables内核级"
msgid "nftables (Kernel)"
msgstr "nftables内核级 新版)"
msgid "Target Address"
msgstr "目标地址"
msgid "Target Port"
msgstr "目标端口"
msgid "Enable Forwarding Retry"
msgstr "自动重试"
msgid "Retry until the target port is open"
msgstr "重试直至目标端口开放"
msgid "Enable Quit"
msgstr "自动退出"
msgid "Exit immediately when the mapping address changes"
msgstr "映射地址改变时立即退出"
msgid "Time to wait before starting this instance"
msgstr "启动该实例前等待的时间"
msgid "Enable Notify Script"
msgstr "启用通知脚本"
msgid "Instructions for using the notification script"
msgstr "通知脚本说明"
msgid "Start delay (Seconds)"
msgstr "启动延时(秒)"
msgid "Log Level"
msgstr "日志级别"
msgid "Normal"
msgstr "正常"
msgid "Verbose"
msgstr "详细"
msgid "Instructions"
msgstr "使用说明"
msgid "Using customized STUN server"
msgstr "使用自定义的 STUN 服务器"
msgid "Using customized Keepalive server"
msgstr "使用自定义的保活服务器"

View File

@ -0,0 +1,143 @@
msgid "Natter v2"
msgstr "Natter v2"
msgid "Base Settings"
msgstr "基础设置"
msgid "Log"
msgstr "日志"
msgid "Expose your port behind full-cone NAT to the Internet"
msgstr "将 FullCone NAT (NAT 1) 后的端口,打洞暴露至互联网"
msgid "Project"
msgstr "项目地址"
msgid "Enable"
msgstr "启用"
msgid "Check NAT Status"
msgstr "NAT 类型检测"
msgid "Proxy programs may affect NAT types"
msgstr "代理程序可能会影响 NAT 类型"
msgid "Tmp Path"
msgstr "临时路径"
msgid "Instances"
msgstr "实例"
msgid "Setting up multiple instances"
msgstr "设置多个实例"
msgid "Remark"
msgstr "备注"
msgid "Public Port"
msgstr "公开端口"
msgid "Target Address"
msgstr "目标地址"
msgid "Target Port"
msgstr "目标端口"
msgid "Notify Script Path"
msgstr "通知脚本路径"
msgid "Enable Stun Server"
msgstr "自定义 STUN 服务器"
msgid "STUN Server"
msgstr "STUN 服务器"
msgid "Enable Keepalive Server"
msgstr "自定义保活服务器"
msgid "Keepalive Server"
msgstr "保活服务器"
msgid "Interval (Seconds)"
msgstr "保活间隔(秒)"
msgid "The number of seconds between keepalive"
msgstr "每次保活的间隔秒数"
msgid "Enable Bonding Options"
msgstr "启用绑定"
msgid "Bonding Interface"
msgstr "绑定接口"
msgid "Bonding Port"
msgstr "绑定端口"
msgid "Enable Forwarding Options"
msgstr "启用转发"
msgid "Forwarding to internal devices"
msgstr "转发至内部设备"
msgid "Forwarding Method"
msgstr "转发方式"
msgid "Instructions for forwarding method"
msgstr "转发方式说明"
msgid "socket (Integrated)"
msgstr "Socket内置"
msgid "iptables (Kernel)"
msgstr "iptables内核级"
msgid "nftables (Kernel)"
msgstr "nftables内核级 新版)"
msgid "Target Address"
msgstr "目标地址"
msgid "Target Port"
msgstr "目标端口"
msgid "Enable Forwarding Retry"
msgstr "自动重试"
msgid "Retry until the target port is open"
msgstr "重试直至目标端口开放"
msgid "Enable Quit"
msgstr "自动退出"
msgid "Exit immediately when the mapping address changes"
msgstr "映射地址改变时立即退出"
msgid "Time to wait before starting this instance"
msgstr "启动该实例前等待的时间"
msgid "Enable Notify Script"
msgstr "启用通知脚本"
msgid "Instructions for using the notification script"
msgstr "通知脚本说明"
msgid "Start delay (Seconds)"
msgstr "启动延时(秒)"
msgid "Log Level"
msgstr "日志级别"
msgid "Normal"
msgstr "正常"
msgid "Verbose"
msgstr "详细"
msgid "Instructions"
msgstr "使用说明"
msgid "Using customized STUN server"
msgstr "使用自定义的 STUN 服务器"
msgid "Using customized Keepalive server"
msgstr "使用自定义的保活服务器"

View File

@ -0,0 +1,4 @@
config base
option tmp_path '/tmp/natter2'
option enable '0'

View File

@ -0,0 +1,125 @@
#!/bin/sh /etc/rc.common
START=98
script_path="/usr/share/natter2/natter.py"
start_service() {
local basic_list="enable tmp_path"
local instance_list="enable_instance id remark protocol enable_stun_server \
stun_server enable_keepalive_server keepalive_server \
interval enable_bonding bonding_interface bonding_port \
enable_forwarding forwarding_method target_address target_port \
enable_forwarding_retry enable_quit delay log_level enable_notify \
notify_path"
for i in $basic_list
do
local eval $i="$(uci_get_by_type base 0 $i)"
done ; unset i
if [ "$enable" == 1 ]
then
mkdir -p ${tmp_path}
mkdir -p /var/etc/natter2
for u in $(seq 0 $(($(uci show natter2 2> /dev/null | egrep '@instances\[[0-9]\]+=instances' | wc -l) - 1)))
do
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)"
done ; unset i
[ "$enable_instance" != 1 ] && continue
script_command=""
[ "$protocol" == udp ] && script_command="$script_command -u"
if [ "$enable_stun_server" == 1 ]
then
for i in $stun_server
do
script_command="$script_command -s $i"
done ; unset i
fi
[ "$enable_keepalive_server" == 1 ] && script_command="$script_command -h $keepalive_server"
[ "$interval" ] && script_command="$script_command -k $interval"
if [ "$enable_bonding" == 1 ]
then
[ "$bonding_interface" ] && script_command="$script_command -i $bonding_interface"
[ "$bonding_port" ] && script_command="$script_command -b $bonding_port"
fi
if [ "$enable_forwarding" == 1 ]
then
[ "$forwarding_method" ] && script_command="$script_command -m $forwarding_method"
[ "$target_address" ] && script_command="$script_command -t $target_address"
[ "$target_port" ] && script_command="$script_command -p $target_port"
[ "$enable_forwarding_retry" == 1 ] && script_command="$script_command -r"
fi
[ "$enable_quit" == 1 ] && script_command="$script_command -q"
[ "$log_level" == "verbose" ] && script_command="$script_command -v"
if [ "$enable_notify" == 1 ]
then
echo "$notify_path" > /var/etc/natter2/${id}-notify
var_file=/var/etc/natter2/${id}-${u}-1
else
var_file=/var/etc/natter2/${id}-${u}-0
fi
log_file=${tmp_path}/natter2-${id}.log
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"
sleep $delay
for i in $(ps -efww | grep "$script_path" | grep -v grep | grep -v $$ | grep "$id" | awk '{print $1}')
do
kill -9 "$i" 2> /dev/null
done
nohup $(command -v python) "$script_path" $script_command -e $var_file > "$log_file" 2>&1 &
for i in $instance_list
do
unset $(echo $i)
done ; unset i
unset script_command
done ; unset u
else
stop_service
fi
}
stop_service() {
echo "Stopping Natter2 ..."
for i in $(ps -efww | grep "$script_path" | grep -v grep | grep -v $$ | awk '{print $1}')
do
kill -9 "$i" 2> /dev/null
done
rm -r "$tmp_path" 2> /dev/null
for u in $(seq 0 $(($(uci show natter2 2> /dev/null | egrep '@instances\[[0-9]\]+=instances' | wc -l) - 1)))
do
uci set natter2.@instances[$u].tmp_public_port=""
uci commit natter2
done
}
restart() {
stop_service
start_service
}
service_triggers() {
procd_add_reload_trigger "natter2"
}
uci_get_by_type() {
local ret=$(uci get natter2.@$1[$2].$3 2>/dev/null)
echo ${ret:=$4}
}

View File

@ -0,0 +1,10 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@natter2[-1]
add ucitrack natter2
set ucitrack.@natter2[-1].init=natter2
commit ucitrack
EOF
exit 0

View File

@ -0,0 +1,19 @@
#!/bin/sh
log_path=$(uci get natter2.@base[0].tmp_path 2> /dev/null)
for i in $(ls -1 ${log_path} | grep natter2 | grep .log)
do
case $1 in
print)
echo -e "\n======> $i <======"
tail -n 30 ${log_path}/$i 2> /dev/null
echo -e "======> END of $i <======"
;;
del)
echo > ${log_path}/$i
;;
esac
done
exit 0

View File

@ -0,0 +1,18 @@
#!/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"
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

View File

@ -0,0 +1,28 @@
#!/bin/sh
protocol="$1"; private_ip="$2"; private_port="$3"; public_ip="$4"; public_port="$5"
script_name=$(basename $0)
script_path=$(dirname $0)
instance_id=$(echo $script_name | cut -d '-' -f1)
instance_num=$(echo $script_name | cut -d '-' -f2)
instance_isnotify=$(echo $script_name | cut -d '-' -f3)
# echo script_path:$script_path
# echo script_name:$script_name
# echo instance_id:$instance_id
# echo instance_num:$instance_num
# echo instance_isnotify:$instance_isnotify
uci set natter2.@instances[$instance_num].tmp_public_port="$public_port"
uci commit natter2
if [ "$instance_isnotify" == 1 ]
then
notify_path=$(cat $script_path/${instance_id}-notify)
if [ -f "${notify_path}" ]
then
chmod +x ${notify_path}
${notify_path} $1 $2 $3 $4 $5
fi
fi

View File

@ -0,0 +1,12 @@
#!/bin/sh
# 参数序号 参数说明 参数格式
# 1 传输层协议 tcp, udp 二者之一
# 2 内部 IP 点分十进制 IPv4 地址
# 3 内部端口 1 - 65535 的整数
# 4 外部 IP 点分十进制 IPv4 地址
# 5 外部端口 1 - 65535 的整数
protocol="$1"; private_ip="$2"; private_port="$3"; public_ip="$4"; public_port="$5"
echo $1 $2 $3 $4 $5

View File

@ -0,0 +1,11 @@
{
"luci-app-natter2": {
"description": "Grant UCI access for luci-app-natter2",
"read": {
"uci": [ "natter2" ]
},
"write": {
"uci": [ "natter2" ]
}
}
}

40
natter2/Makefile Executable file
View File

@ -0,0 +1,40 @@
# Copyright (C) 2020-2024 Hyy2001X <https://github.com/Hyy2001X>
include $(TOPDIR)/rules.mk
PKG_NAME:=natter2
PKG_VERSION=2.0.0-rc1
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_VERSION:=ba7385de8edf869486f01b724780497939eccd24
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/MikeWang000000/Natter/tar.gz/$(PKG_SOURCE_VERSION)?
PKG_HASH:=skip
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=net
CATEGORY:=Network
TITLE:=Open Port under FullCone NAT (NAT 1)
URL:=https://github.com/MikeWang000000/Natter
DEPENDS:=+python3-light
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
tar -zxvf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR)
endef
define Build/Compile
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)
$(INSTALL_BIN) $(PKG_BUILD_DIR)/Natter-$(PKG_SOURCE_VERSION)/natter.py $(1)/usr/share/$(PKG_NAME)/natter.py
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/natter-check
$(INSTALL_BIN) $(PKG_BUILD_DIR)/Natter-$(PKG_SOURCE_VERSION)/natter-check/natter-check.py $(1)/usr/share/$(PKG_NAME)/natter-check/natter-check.py
endef
$(eval $(call BuildPackage,$(PKG_NAME)))