mirror of
https://github.com/kenzok8/small-package
synced 2025-01-07 07:06:58 +08:00
update 2023-10-01 23:35:13
This commit is contained in:
parent
c031f17bd0
commit
7d5f6b5380
@ -1,12 +1,12 @@
|
|||||||
# Copyright (C) 2020-2021 Hyy2001X <https://github.com/Hyy2001X>
|
# Copyright (C) 2020-2023 Hyy2001X <https://github.com/Hyy2001X>
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
LUCI_TITLE:=LuCI support for iPerf3
|
LUCI_TITLE:=LuCI support for iPerf3 server
|
||||||
LUCI_DEPENDS:=+iperf3
|
LUCI_DEPENDS:=+iperf3
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
PKG_VERSION:=2.0
|
PKG_VERSION:=2.0
|
||||||
PKG_RELEASE:=3
|
PKG_RELEASE:=4
|
||||||
|
|
||||||
include $(TOPDIR)/feeds/luci/luci.mk
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
|
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
START=99
|
START=99
|
||||||
USE_PROCD=1
|
|
||||||
LOGGER="logger -t [iPerf3-Server]"
|
LOGGER="logger -t [iPerf3-Server]"
|
||||||
|
|
||||||
start_service() {
|
start() {
|
||||||
stop_service
|
|
||||||
local basic_list="main_enable"
|
local basic_list="main_enable"
|
||||||
local server_list="port delay extra_options enable_server"
|
local server_list="port delay extra_options enable_server"
|
||||||
for i in $(echo $basic_list)
|
for i in $(echo $basic_list)
|
||||||
@ -18,7 +16,6 @@ start_service() {
|
|||||||
# server_number=$(uci show iperf3-server 2> /dev/null | egrep -o '@servers\[[0-9]\]+=servers' | awk 'END {print}' | egrep -o "[0-9]")
|
# server_number=$(uci show iperf3-server 2> /dev/null | egrep -o '@servers\[[0-9]\]+=servers' | awk 'END {print}' | egrep -o "[0-9]")
|
||||||
for u in $(seq 0 $((${server_number} - 1)))
|
for u in $(seq 0 $((${server_number} - 1)))
|
||||||
do
|
do
|
||||||
{
|
|
||||||
for i in $server_list
|
for i in $server_list
|
||||||
do
|
do
|
||||||
eval ${i}=$(uci_get_by_type servers $u $i)
|
eval ${i}=$(uci_get_by_type servers $u $i)
|
||||||
@ -27,14 +24,15 @@ start_service() {
|
|||||||
then
|
then
|
||||||
sleep $delay
|
sleep $delay
|
||||||
$LOGGER "Starting iPerf3 Server [$u] with Port [$port] ..."
|
$LOGGER "Starting iPerf3 Server [$u] with Port [$port] ..."
|
||||||
# $(command -v iperf3) -s -D -p $port $extra_options
|
old_process="$(ps -efww | grep 'iperf3 -s -D -p $port' | grep -v 'grep' | awk '{print $1}')"
|
||||||
procd_open_instance
|
[ "$old_process" ] && kill -9 "$old_process" 2> /dev/null
|
||||||
procd_set_param command sleep $delay ; $(command -v iperf3) -s -D -p $port $extra_options
|
$(command -v iperf3) -s -D -p $port $extra_options
|
||||||
procd_set_param respawn 3000 3 10
|
#procd_open_instance
|
||||||
procd_close_instance
|
#procd_set_param command sleep $delay ; $(command -v iperf3) -s -D -p $port $extra_options
|
||||||
|
#procd_set_param respawn 3000 3 10
|
||||||
|
#procd_close_instance
|
||||||
fi
|
fi
|
||||||
unset enable_server delay
|
unset enable_server delay
|
||||||
} &
|
|
||||||
done ; unset u
|
done ; unset u
|
||||||
else
|
else
|
||||||
$LOGGER "iPerf3 Server is disabled ..."
|
$LOGGER "iPerf3 Server is disabled ..."
|
||||||
@ -42,7 +40,7 @@ start_service() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_service() {
|
stop() {
|
||||||
$LOGGER "Stopping iPerf3 Server ..."
|
$LOGGER "Stopping iPerf3 Server ..."
|
||||||
ps -efww | grep 'iperf3 -s -D' | grep -v 'grep' | awk '{print $1}' | xargs kill -9
|
ps -efww | grep 'iperf3 -s -D' | grep -v 'grep' | awk '{print $1}' | xargs kill -9
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,6 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//]]></script>
|
//]]></script>
|
||||||
<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Flush Cache%>" onclick="return flush_cache(this,'<%=self.option%>')" />
|
<input type="button" class="btn cbi-button-action" value="<%:Flush Cache%>" onclick="return flush_cache(this,'<%=self.option%>')" />
|
||||||
<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
|
<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
|
||||||
<%+cbi/valuefooter%>
|
<%+cbi/valuefooter%>
|
||||||
|
@ -29,6 +29,6 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//]]></script>
|
//]]></script>
|
||||||
<input type="button" class="btn cbi-button cbi-button-reload" value="<%:Check And Update%>" onclick="return update_data(this,'<%=self.option%>')" />
|
<input type="button" class="btn cbi-button-action" value="<%:Check And Update%>" onclick="return update_data(this,'<%=self.option%>')" />
|
||||||
<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
|
<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
|
||||||
<%+cbi/valuefooter%>
|
<%+cbi/valuefooter%>
|
||||||
|
@ -28,6 +28,6 @@
|
|||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<fieldset class="cbi-section" id="_log_fieldset">
|
<fieldset class="cbi-section" id="_log_fieldset">
|
||||||
<input class="cbi-button cbi-input-remove" type="button" onclick="clear_log()" value="<%:Clear logs%>" style="margin-left: 10px; margin-top: 10px;">
|
<input class="btn cbi-button-action" type="button" onclick="clear_log()" value="<%:Clear logs%>" style="margin-left: 10px; margin-top: 10px;">
|
||||||
<textarea id="log_textarea" class="cbi-input-textarea" style="width: calc(100% - 20px); height: 645px; margin: 10px;" data-update="change" rows="5" wrap="off" readonly="readonly"></textarea>
|
<textarea id="log_textarea" class="cbi-input-textarea" style="width: calc(100% - 20px); height: 645px; margin: 10px;" data-update="change" rows="5" wrap="off" readonly="readonly"></textarea>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
@ -47,34 +47,42 @@ return view.extend({
|
|||||||
let tproxy_port_tcp_f4 = s.taboption('fake_dns', form.Value, 'tproxy_port_tcp_f4', _('Transparent proxy port (TCP4)'));
|
let tproxy_port_tcp_f4 = s.taboption('fake_dns', form.Value, 'tproxy_port_tcp_f4', _('Transparent proxy port (TCP4)'));
|
||||||
tproxy_port_tcp_f4.datatype = 'port';
|
tproxy_port_tcp_f4.datatype = 'port';
|
||||||
tproxy_port_tcp_f4.placeholder = 1086;
|
tproxy_port_tcp_f4.placeholder = 1086;
|
||||||
|
tproxy_port_tcp_f4.rmempty = true;
|
||||||
let tproxy_port_udp_f4 = s.taboption('fake_dns', form.Value, 'tproxy_port_udp_f4', _('Transparent proxy port (UDP4)'));
|
|
||||||
tproxy_port_udp_f4.datatype = 'port';
|
|
||||||
tproxy_port_udp_f4.placeholder = 1087;
|
|
||||||
|
|
||||||
let tproxy_port_tcp_f6 = s.taboption('fake_dns', form.Value, 'tproxy_port_tcp_f6', _('Transparent proxy port (TCP6)'));
|
let tproxy_port_tcp_f6 = s.taboption('fake_dns', form.Value, 'tproxy_port_tcp_f6', _('Transparent proxy port (TCP6)'));
|
||||||
tproxy_port_tcp_f6.datatype = 'port';
|
tproxy_port_tcp_f6.datatype = 'port';
|
||||||
tproxy_port_tcp_f6.placeholder = 1088;
|
tproxy_port_tcp_f6.placeholder = 1087;
|
||||||
|
tproxy_port_tcp_f6.rmempty = true;
|
||||||
|
|
||||||
|
let tproxy_port_udp_f4 = s.taboption('fake_dns', form.Value, 'tproxy_port_udp_f4', _('Transparent proxy port (UDP4)'));
|
||||||
|
tproxy_port_udp_f4.datatype = 'port';
|
||||||
|
tproxy_port_udp_f4.placeholder = 1088;
|
||||||
|
tproxy_port_udp_f4.rmempty = true;
|
||||||
|
|
||||||
let tproxy_port_udp_f6 = s.taboption('fake_dns', form.Value, 'tproxy_port_udp_f6', _('Transparent proxy port (UDP6)'));
|
let tproxy_port_udp_f6 = s.taboption('fake_dns', form.Value, 'tproxy_port_udp_f6', _('Transparent proxy port (UDP6)'));
|
||||||
tproxy_port_udp_f6.datatype = 'port';
|
tproxy_port_udp_f6.datatype = 'port';
|
||||||
tproxy_port_udp_f6.placeholder = 1089;
|
tproxy_port_udp_f6.placeholder = 1089;
|
||||||
|
tproxy_port_udp_f6.rmempty = true;
|
||||||
|
|
||||||
let pool_v4 = s.taboption('fake_dns', form.Value, 'pool_v4', _('Address Pool (IPv4)'));
|
let pool_v4 = s.taboption('fake_dns', form.Value, 'pool_v4', _('Address Pool (IPv4)'));
|
||||||
pool_v4.datatype = 'ip4addr';
|
pool_v4.datatype = 'ip4addr';
|
||||||
pool_v4.placeholder = "198.18.0.0/15";
|
pool_v4.placeholder = "198.18.0.0/15";
|
||||||
|
pool_v4.rmempty = true;
|
||||||
|
|
||||||
let pool_v4_size = s.taboption('fake_dns', form.Value, 'pool_v4_size', _('Address Pool Size (IPv4)'));
|
let pool_v4_size = s.taboption('fake_dns', form.Value, 'pool_v4_size', _('Address Pool Size (IPv4)'));
|
||||||
pool_v4_size.datatype = 'integer';
|
pool_v4_size.datatype = 'integer';
|
||||||
pool_v4_size.placeholder = 65535;
|
pool_v4_size.placeholder = 65535;
|
||||||
|
pool_v4_size.rmempty = true;
|
||||||
|
|
||||||
let pool_v6 = s.taboption('fake_dns', form.Value, 'pool_v6', _('Address Pool (IPv6)'));
|
let pool_v6 = s.taboption('fake_dns', form.Value, 'pool_v6', _('Address Pool (IPv6)'));
|
||||||
pool_v6.datatype = 'ip6addr';
|
pool_v6.datatype = 'ip6addr';
|
||||||
pool_v6.placeholder = "fc00::/18";
|
pool_v6.placeholder = "fc00::/18";
|
||||||
|
pool_v6.rmempty = true;
|
||||||
|
|
||||||
let pool_v6_size = s.taboption('fake_dns', form.Value, 'pool_v6_size', _('Address Pool Size (IPv6)'));
|
let pool_v6_size = s.taboption('fake_dns', form.Value, 'pool_v6_size', _('Address Pool Size (IPv6)'));
|
||||||
pool_v6_size.datatype = 'integer';
|
pool_v6_size.datatype = 'integer';
|
||||||
pool_v6_size.placeholder = 65535;
|
pool_v6_size.placeholder = 65535;
|
||||||
|
pool_v6_size.rmempty = true;
|
||||||
|
|
||||||
let fake_dns_timeout = s.taboption('fake_dns', form.Value, 'fake_dns_timeout', _('Connection Idle Timeout'), _('Policy: Close connection if no data is transferred within given timeout. See <a href="https://xtls.github.io/config/policy.html#levelpolicyobject">here</a> for help.'));
|
let fake_dns_timeout = s.taboption('fake_dns', form.Value, 'fake_dns_timeout', _('Connection Idle Timeout'), _('Policy: Close connection if no data is transferred within given timeout. See <a href="https://xtls.github.io/config/policy.html#levelpolicyobject">here</a> for help.'));
|
||||||
fake_dns_timeout.datatype = 'uinteger';
|
fake_dns_timeout.datatype = 'uinteger';
|
||||||
@ -127,6 +135,7 @@ return view.extend({
|
|||||||
destination.depends("specify_outbound", "1");
|
destination.depends("specify_outbound", "1");
|
||||||
destination.datatype = "uciname";
|
destination.datatype = "uciname";
|
||||||
destination.textvalue = destination_format("destination");
|
destination.textvalue = destination_format("destination");
|
||||||
|
destination.rmempty = false;
|
||||||
|
|
||||||
const servers = uci.sections(config_data, "servers");
|
const servers = uci.sections(config_data, "servers");
|
||||||
if (servers.length == 0) {
|
if (servers.length == 0) {
|
||||||
@ -250,10 +259,10 @@ return view.extend({
|
|||||||
|
|
||||||
s.tab('dynamic_direct', _('Dynamic Direct'));
|
s.tab('dynamic_direct', _('Dynamic Direct'));
|
||||||
|
|
||||||
s.taboption('dynamic_direct', form.Flag, 'dynamic_direct_tcp4', _('Enable for IPv4 TCP'), _("Recommended."));
|
s.taboption('dynamic_direct', form.Flag, 'dynamic_direct_tcp4', _('Enable for IPv4 TCP'), _("This should improve performance with large number of connections."));
|
||||||
s.taboption('dynamic_direct', form.Flag, 'dynamic_direct_tcp6', _('Enable for IPv4 UDP'), _("Recommended."));
|
s.taboption('dynamic_direct', form.Flag, 'dynamic_direct_tcp6', _('Enable for IPv4 UDP'), _("This may cause problems but worth a try."));
|
||||||
s.taboption('dynamic_direct', form.Flag, 'dynamic_direct_udp4', _('Enable for IPv6 TCP'), _("Not recommended."));
|
s.taboption('dynamic_direct', form.Flag, 'dynamic_direct_udp4', _('Enable for IPv6 TCP'), _("This may not be very useful but it should be good enouth for a try."));
|
||||||
s.taboption('dynamic_direct', form.Flag, 'dynamic_direct_udp6', _('Enable for IPv6 UDP'), _("Not recommended."));
|
s.taboption('dynamic_direct', form.Flag, 'dynamic_direct_udp6', _('Enable for IPv6 UDP'), _("This may cause problems and is not very useful at the same time. Not recommended."));
|
||||||
|
|
||||||
let dynamic_direct_timeout = s.taboption('dynamic_direct', form.Value, 'dynamic_direct_timeout', _('Dynamic Direct Timeout'), _("Larger value consumes more memory and performs generally better. Unit in seconds."));
|
let dynamic_direct_timeout = s.taboption('dynamic_direct', form.Value, 'dynamic_direct_timeout', _('Dynamic Direct Timeout'), _("Larger value consumes more memory and performs generally better. Unit in seconds."));
|
||||||
dynamic_direct_timeout.datatype = 'uinteger';
|
dynamic_direct_timeout.datatype = 'uinteger';
|
||||||
|
Loading…
Reference in New Issue
Block a user