1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Merge branch 'pr/55' into test

This commit is contained in:
suyuan 2021-01-06 22:15:15 +08:00
commit 95fde1eeef
10 changed files with 439 additions and 420 deletions

View file

@ -43,12 +43,14 @@ jobs:
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
GITHUB_WORKSPACE: ${{ steps.branch_name.outputs.WORKSPACE }}
run: |
git clone --depth 1 $REPO_URL omr
cd omr
if [ "$SOURCE_NAME" != "Test-Github-Actions" ] && [ "$SOURCE_NAME" != "develop" ]; then
git clone $REPO_URL omr
if [ "$SOURCE_NAME" != "develop" ]; then
cd omr
pwd
git fetch
git checkout master
else
cd omr
git checkout develop
fi
git pull

View file

@ -32,7 +32,6 @@ return L.view.extend({
s.tab('advanced', _('Advanced Settings'));
o = s.taboption('general', form.Flag, 'enable', _('Enabled'));
o.default = o.enabled;
o = s.taboption('general',form.Value, 'label', _('Label'));
o.rmempty = true;
@ -65,11 +64,9 @@ return L.view.extend({
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'));
@ -78,7 +75,6 @@ return L.view.extend({
o.modalonly = true;
o = s.taboption('advanced', form.Flag, 'multiqueue', _('Multiqueue'));
o.default = o.enabled;
o.rmempty = false;
o.modalonly = true;

View file

@ -40,7 +40,6 @@ return L.view.extend({
s.tab('advanced', _('Advanced Settings'));
o = s.taboption('general', form.Flag, 'enable', _('Enabled'));
o.default = o.enabled;
o = s.taboption('general',form.Value, 'label', _('Label'));
o.rmempty = true;
@ -74,11 +73,9 @@ return L.view.extend({
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'));

View file

@ -38,7 +38,7 @@ local mtcpsyn = s:option(Value, "mptcp_syn_retries", translate("Multipath TCP SY
mtcpsyn.datatype = "uinteger"
mtcpsyn.rmempty = false
local congestion = s:option(ListValue, "congestion", translate("Congestion Control"),translate("Default is bbr"))
local availablecong = sys.exec("sysctl net.ipv4.tcp_available_congestion_control | awk -F'= ' '{print $NF}'")
local availablecong = sys.exec("sysctl -n net.ipv4.tcp_available_congestion_control | xargs -n1 | sort | xargs")
for cong in string.gmatch(availablecong, "[^%s]+") do
congestion:value(cong, translate(cong))
end

View file

@ -17,9 +17,9 @@
%>
<form class="inline" method="post" action="<%=url('admin/system/' .. menuentry:lower() .. '/update_vps')%>">
<div class="cbi-map">
<h2 name="content"><%:Update VPS%></h2>
<h2 name="content"><%:Update server%></h2>
<fieldset class="cbi-section" id="update">
<div class="cbi-section-descr"><%:Update remotly the server to latest version when needed.%> <b><%:Beta%></b></div>
<div class="cbi-section-descr"><%:Update remotly servers to latest version and reboot them.%> <b><%:Beta%></b></div>
<div class="cbi-value">
<label class="cbi-value-title"><%:Update server%></label>
<div class="cbi-value-field">
@ -40,7 +40,7 @@
<div class="cbi-map">
<h2 name="content"><%:Advanced Settings%></h2>
<fieldset class="cbi-section" id="networks">
<legend><%:VPS settings%></legend>
<legend><%:Server settings%></legend>
<%
uci:foreach("openmptcprouter","server", function(s)
servername = s[".name"]

File diff suppressed because it is too large Load diff

View file

@ -27,14 +27,14 @@ _set_intf_name() {
if [ "$modalias" = "$chk_modalias" ] && [ "$INTERFACE" != "$ifname" ]; then
logger -t "OMR-Rename" "Rename ${INTERFACE} to ${ifname}"
existif=0
ip link set ${INTERFACE} down
ip link set ${INTERFACE} down 2>&1 >/dev/null
[ "$(ip link show ${ifname} 2>/dev/null)" != "" ] && {
ip link set ${ifname} name ${ifname}tmp
ip link set ${ifname} name ${ifname}tmp 2>&1 >/dev/null
existif=1
}
ip link set ${INTERFACE} name ${ifname}
ip link set ${ifname} up
[ "$existif" = "1" ] && ip link set ${ifname}tmp ${$INTERFACE}
ip link set ${INTERFACE} name ${ifname} 2>&1 >/dev/null
ip link set ${ifname} up 2>&1 >/dev/null
[ "$existif" = "1" ] && ip link set ${ifname}tmp ${$INTERFACE} 2>&1 >/dev/null
fi
fi
elif [ -f /dev/${DEVICE_NAME} ] && [ -n "$MODALIAS" ] && [ "$modalias" = "$MODALIAS" ]; then
@ -46,15 +46,15 @@ _set_intf_name() {
}
[ -z "$modalias" ] && [ -n "$device" ] && [ -n "$ifname" ] && [ "/sys${DEVPATH}" = "$device" ] && [ "$INTERFACE" != "$ifname" ] && {
logger -t "OMR-Rename" "Rename ${INTERFACE} to ${ifname}"
ip link set ${INTERFACE} down
ip link set ${INTERFACE} down 2>&1 >/dev/null
existif=0
[ "$(ip link show ${ifname} 2>/dev/null)" != "" ] && {
ip link set ${ifname} name ${ifname}tmp
ip link set ${ifname} name ${ifname}tmp 2>&1 >/dev/null
existif=1
}
ip link set ${INTERFACE} name ${ifname}
ip link set ${ifname} up
[ "$existif" = "1" ] && ip link set ${ifname}tmp ${$INTERFACE}
ip link set ${INTERFACE} name ${ifname} 2>&1 >/dev/null
ip link set ${ifname} up 2>&1 >/dev/null
[ "$existif" = "1" ] && ip link set ${ifname}tmp ${$INTERFACE} 2>&1 >/dev/null
}
}

View file

@ -116,14 +116,14 @@ function add_interface(add_interface_ifname)
ucic:save("sqm")
ucic:commit("sqm")
luci.sys.call("uci -q add_list vnstat.@vnstat[-1].interface=" .. wanif)
luci.sys.call("uci -q commit vnstat")
sys.exec("uci -q add_list vnstat.@vnstat[-1].interface=" .. wanif)
sys.exec("uci -q commit vnstat")
-- Dirty way to add new interface to firewall...
luci.sys.call("uci -q add_list firewall.@zone[1].network=wan" .. i)
luci.sys.call("uci -q commit firewall")
sys.exec("uci -q add_list firewall.@zone[1].network=wan" .. i)
sys.exec("uci -q commit firewall")
luci.sys.call("/etc/init.d/macvlan restart >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/macvlan restart >/dev/null 2>/dev/null")
end
function remove_interface(intf)
@ -140,11 +140,11 @@ function remove_interface(intf)
ucic:save("qos")
ucic:commit("qos")
if defif ~= nil and defif ~= "" then
luci.sys.call("uci -q del_list vnstat.@vnstat[-1].interface=" .. defif)
sys.exec("uci -q del_list vnstat.@vnstat[-1].interface=" .. defif)
end
luci.sys.call("uci -q commit vnstat")
luci.sys.call("uci -q del_list firewall.@zone[1].network=" .. intf)
luci.sys.call("uci -q commit firewall")
sys.exec("uci -q commit vnstat")
sys.exec("uci -q del_list firewall.@zone[1].network=" .. intf)
sys.exec("uci -q commit firewall")
end
function set_interface(intf,proto,ipaddr,netmask,gateway,sqmenabled,downloadspeed,uploadspeed)
@ -321,24 +321,30 @@ function server_settings(server,server_ip,openmptcprouter_vps_key)
ucic:set("openmptcprouter",server,"ip",server_ip)
ucic:set("openmptcprouter",server,"port","65500")
ucic:save("openmptcprouter")
ucic:set("shadowsocks-libev","sss0","server",server_ip)
ucic:set("glorytun","vpn","host",server_ip)
ucic:set("dsvpn","vpn","host",server_ip)
ucic:set("mlvpn","general","host",server_ip)
luci.sys.call("uci -q del openvpn.omr.remote")
luci.sys.call("uci -q add_list openvpn.omr.remote=" .. server_ip)
ucic:set("qos","serverin","srchost",server_ip)
ucic:set("qos","serverout","dsthost",server_ip)
ucic:save("qos")
ucic:commit("qos")
ucic:save("mlvpn")
ucic:commit("mlvpn")
ucic:save("dsvpn")
ucic:commit("dsvpn")
ucic:save("glorytun")
ucic:commit("glorytun")
ucic:save("shadowsocks-libev")
ucic:commit("shadowsocks-libev")
if ucic:get("openmptcprouter",server,"master") == "1" then
ucic:set("shadowsocks-libev","sss0","server",server_ip)
ucic:set("glorytun","vpn","host",server_ip)
ucic:set("dsvpn","vpn","host",server_ip)
ucic:set("mlvpn","general","host",server_ip)
sys.exec("uci -q del openvpn.omr.remote")
sys.exec("uci -q add_list openvpn.omr.remote=" .. server_ip)
ucic:set("qos","serverin","srchost",server_ip)
ucic:set("qos","serverout","dsthost",server_ip)
ucic:set("v2ray","omrout","s_vmess_address",server_ip)
ucic:set("v2ray","omrout","s_vless_address",server_ip)
ucic:save("qos")
ucic:commit("qos")
ucic:save("mlvpn")
ucic:commit("mlvpn")
ucic:save("dsvpn")
ucic:commit("dsvpn")
ucic:save("v2ray")
ucic:commit("v2ray")
ucic:save("glorytun")
ucic:commit("glorytun")
ucic:save("shadowsocks-libev")
ucic:commit("shadowsocks-libev")
end
end
function set_shadowsocks(shadowsocks_key)
@ -404,18 +410,22 @@ end
function restart_all()
-- Restart all
luci.sys.call("(env -i /bin/ubus call network reload) >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/mptcp restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/openmptcprouter-vps restart >/dev/null 2>/dev/null")
os.execute("sleep 2")
luci.sys.call("/etc/init.d/v2ray restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/shadowsocks-libev restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/glorytun restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/glorytun-udp restart >/dev/null 2>/dev/null")
--luci.sys.call("/etc/init.d/mlvpn restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/openvpn restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/omr-tracker restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/omr-6in4 restart >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/macvlan restart >/dev/null 2>/dev/null")
sys.exec("(env -i /bin/ubus call network reload) >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/omr-tracker stop >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/mptcp restart >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/shadowsocks-libev restart >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/glorytun restart >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/glorytun-udp restart >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/mlvpn restart >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/openvpn restart >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/openvpnbonding restart >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/dsvpn restart >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/omr-tracker start >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/omr-6in4 restart >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/mptcpovervpn restart >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/vnstat restart >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/v2ray restart >/dev/null 2>/dev/null")
end
function redirectports(server,redirect_ports)
@ -425,26 +435,26 @@ end
function tcpkeepalivetime(tcp_keepalive_time)
-- Set tcp_keepalive_time
luci.sys.exec("sysctl -w net.ipv4.tcp_keepalive_time=%s" % tcp_keepalive_time)
luci.sys.exec("sed -i 's:^net.ipv4.tcp_keepalive_time=[0-9]*:net.ipv4.tcp_keepalive_time=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % tcp_keepalive_time)
sys.exec("sysctl -w net.ipv4.tcp_keepalive_time=%s" % tcp_keepalive_time)
sys.exec("sed -i 's:^net.ipv4.tcp_keepalive_time=[0-9]*:net.ipv4.tcp_keepalive_time=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % tcp_keepalive_time)
end
function tcpfintimeout(tcp_fin_timeout)
-- Set tcp_fin_timeout
luci.sys.exec("sysctl -w net.ipv4.tcp_fin_timeout=%s" % tcp_fin_timeout)
luci.sys.exec("sed -i 's:^net.ipv4.tcp_fin_timeout=[0-9]*:net.ipv4.tcp_fin_timeout=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % tcp_fin_timeout)
sys.exec("sysctl -w net.ipv4.tcp_fin_timeout=%s" % tcp_fin_timeout)
sys.exec("sed -i 's:^net.ipv4.tcp_fin_timeout=[0-9]*:net.ipv4.tcp_fin_timeout=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % tcp_fin_timeout)
end
function tcpsynretries(tcp_syn_retries)
-- Set tcp_syn_retries
luci.sys.exec("sysctl -w net.ipv4.tcp_syn_retries=%s" % tcp_syn_retries)
luci.sys.exec("sed -i 's:^net.ipv4.tcp_syn_retries=[0-9]*:net.ipv4.tcp_syn_retries=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % tcp_syn_retries)
sys.exec("sysctl -w net.ipv4.tcp_syn_retries=%s" % tcp_syn_retries)
sys.exec("sed -i 's:^net.ipv4.tcp_syn_retries=[0-9]*:net.ipv4.tcp_syn_retries=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % tcp_syn_retries)
end
function tcpfastopen(tcp_fastopen)
-- Set tcp_fastopen
luci.sys.exec("sysctl -w net.ipv4.tcp_fastopen=%s" % tcp_fastopen)
luci.sys.exec("sed -i 's:^net.ipv4.tcp_fastopen=[0-3]*:net.ipv4.tcp_fastopen=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % tcp_fastopen)
sys.exec("sysctl -w net.ipv4.tcp_fastopen=%s" % tcp_fastopen)
sys.exec("sed -i 's:^net.ipv4.tcp_fastopen=[0-3]*:net.ipv4.tcp_fastopen=%s:' /etc/sysctl.d/zzz_openmptcprouter.conf" % tcp_fastopen)
end
function disableipv6(disable_ipv6)
@ -452,7 +462,7 @@ function disableipv6(disable_ipv6)
ucic:set("openmptcprouter","settings","disable_ipv6",disable_ipv6)
ucic:save("openmptcprouter")
ucic:commit("openmptcprouter")
luci.sys.call("/etc/init.d/omr-6in4 restart >/dev/null 2>/dev/null")
sys.exec("/etc/init.d/omr-6in4 restart >/dev/null 2>/dev/null")
end
function externalcheck(externalcheck)
@ -463,7 +473,7 @@ end
function savevnstat(savevnstat)
-- Enable/disable save vnstat
luci.sys.exec("uci -q set vnstat.@vnstat[0].backup=%s" % savevnstat)
sys.exec("uci -q set vnstat.@vnstat[0].backup=%s" % savevnstat)
ucic:commit("vnstat")
end
@ -522,17 +532,17 @@ end
function update_vps()
-- Update VPS
ucic:foreach("openmptcprouter", "server", function(s)
local serverip = ucic:get("openmptcprouter",s[".name"],"ip")
local adminport = ucic:get("openmptcprouter",s[".name"],"port") or "65500"
local token = ucic:get("openmptcprouter",s[".name"],"token") or ""
local vpsgettoken = sys.exec("/etc/init.d/openmptcprouter-vps restart >/dev/null 2>/dev/null")
ucic:foreach("openmptcprouter", "server", function(section)
local servername = section[".name"]
local serverip = section["ip"] or ""
local adminport = section["port"] or "65500"
local token = section["token"] or ""
if token ~= "" then
sys.exec('curl -4 --max-time 20 -s -k -H "Authorization: Bearer ' .. token .. '" https://' .. serverip .. ":" .. adminport .. "/update")
luci.sys.call("/etc/init.d/openmptcprouter-vps restart >/dev/null 2>/dev/null")
luci.http.redirect(luci.dispatcher.build_url("admin/system/openmptcprouter/status"))
return
local updatevps = sys.exec('curl -4 --max-time 20 -s -k -H "Authorization: Bearer ' .. token .. '" https://' .. serverip .. ":" .. adminport .. "/update")
end
end)
local vpsgettoken = sys.exec("/etc/init.d/openmptcprouter-vps restart >/dev/null 2>/dev/null")
end
function get_ip(interface)

View file

@ -659,7 +659,6 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(
}
fi
local serverip=$(uci -q get shadowsocks-libev.sss0.server)
[ -n "$serverip" ] && serverip="$(resolveip -4 -t 5 $serverip | head -n 1 | tr -d '\n')"
[ -n "$serverip" ] && [ "$serverip" != "127.0.0.1" ] && [ "$(pgrep tracebox)" = "" ] && [ "$(uci -q get openmptcprouter.settings.tracebox)" != "0" ] && {
omrtracebox="$(omr-tracebox-mptcp $serverip $OMR_TRACKER_DEVICE)"
[ -n "$omrtracebox" ] && uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.mptcp_status="$omrtracebox"

View file

@ -2,7 +2,7 @@
# Copyright (C) 2018 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
# Released under GPL 3. See LICENSE for the full terms.
START=1
START=11
STOP=98
boot() {