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

Merge pull request #339 from Ysurac/develop

sync
This commit is contained in:
suyuan 2023-08-05 10:50:03 +08:00 committed by GitHub
commit 6b4b1d703d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 22 deletions

View file

@ -15,8 +15,10 @@ function index()
entry({"admin", "network", "mptcp", "mptcp_check_trace"}, post("mptcp_check_trace")).leaf = true
entry({"admin", "network", "mptcp", "mptcp_fullmesh"}, template("mptcp/mptcp_fullmesh"), _("MPTCP Fullmesh"), 5).leaf = true
entry({"admin", "network", "mptcp", "mptcp_fullmesh_data"}, post("mptcp_fullmesh_data")).leaf = true
entry({"admin", "network", "mptcp", "mptcp_connections"}, template("mptcp/mptcp_connections"), _("Established connections"), 6).leaf = true
entry({"admin", "network", "mptcp", "mptcp_connections_data"}, post("mptcp_connections_data")).leaf = true
if nixio.uname().release:sub(1,4) ~= "5.15" and nixio.uname().release:sub(1,1) ~= "6" then
entry({"admin", "network", "mptcp", "mptcp_connections"}, template("mptcp/mptcp_connections"), _("Established connections"), 6).leaf = true
entry({"admin", "network", "mptcp", "mptcp_connections_data"}, post("mptcp_connections_data")).leaf = true
end
entry({"admin", "network", "mptcp", "mptcp_monitor"}, template("mptcp/mptcp_monitor"), _("MPTCP monitoring"), 6).leaf = true
entry({"admin", "network", "mptcp", "mptcp_monitor_data"}, post("mptcp_monitor_data")).leaf = true
end

View file

@ -61,22 +61,22 @@ end
-- if tonumber(uname.release:sub(1,4)) >= 5.15 then
if uname.release:sub(1,4) == "5.15" or uname.release:sub(1,1) == "6" then
o = s:option(Value, "mptcp_subflows", translate("specifies the maximum number of additional subflows allowed for each MPTCP connection"))
o = s:option(Value, "mptcp_subflows", translate("Max subflows"),translate("specifies the maximum number of additional subflows allowed for each MPTCP connection"))
o.datatype = "uinteger"
o.rmempty = false
o.default = 3
o = s:option(Value, "mptcp_add_addr_accepted", translate("specifies the maximum number of ADD_ADDR suboptions accepted for each MPTCP connection"))
o.datatype = "uinteger"
o.rmempty = false
o.default = 1
o = s:option(Value, "mptcp_stale_loss_cnt", translate("The number of MPTCP-level retransmission intervals with no traffic and pending outstanding data on a given subflow required to declare it stale"))
o = s:option(Value, "mptcp_stale_loss_cnt", translate("Retranmission intervals"),translate("The number of MPTCP-level retransmission intervals with no traffic and pending outstanding data on a given subflow required to declare it stale"))
o.datatype = "uinteger"
o.rmempty = false
o.default = 4
o = s:option(Value, "mptcp_add_addr_timeout", translate("Set the timeout after which an ADD_ADDR control message will be resent to an MPTCP peer that has not acknowledged a previous ADD_ADDR message."))
o = s:option(Value, "mptcp_add_addr_accepted", translate("Max add address"),translate("specifies the maximum number of ADD_ADDR (add address) suboptions accepted for each MPTCP connection"))
o.datatype = "uinteger"
o.rmempty = false
o.default = 1
o = s:option(Value, "mptcp_add_addr_timeout", translate("Control message timeout"),translate("Set the timeout after which an ADD_ADDR (add address) control message will be resent to an MPTCP peer that has not acknowledged a previous ADD_ADDR message."))
o.datatype = "uinteger"
o.rmempty = false
o.default = 120

View file

@ -552,7 +552,7 @@ function wizard_add()
ucic:set("network","omrvpn","proto","bonding")
end
if downloadmax ~= 0 and uploadmax ~= 0 then
ucic:set("sqm","omrvpn","enabled","1")
--ucic:set("sqm","omrvpn","enabled","1")
ucic:set("sqm","omrvpn","max_download",downloadmax)
ucic:set("sqm","omrvpn","max_upload",uploadmax)
ucic:set("sqm","omrvpn","download",math.ceil(downloadmax*50/100))
@ -619,7 +619,7 @@ function wizard_add()
ucic:set("openmptcprouter",server,"username",openmptcprouter_vps_username:gsub("%s+", ""))
ucic:set("openmptcprouter",server,"password",openmptcprouter_vps_key:gsub("%s+", ""))
ucic:set("openmptcprouter",server,"disabled",openmptcprouter_vps_disabled)
if ucic:get("openmptcprouter",server,"ip") ~= aserverips then
if ucic:get_list("openmptcprouter",server,"ip") ~= aserverips then
ucic:set_list("openmptcprouter",server,"ip",aserverips)
if ucic:get("openmptcprouter",server,"master") == "1" then
ucic:set("openmptcprouter",server,"get_config","1")
@ -805,6 +805,7 @@ function wizard_add()
local encryption = luci.http.formvalue("encryption")
if encryption == "none" then
ucic:set("openmptcprouter","settings","encryption","none")
ucic:set("shadowsocks-libev","sss0","method","none")
ucic:set("shadowsocks-libev","sss1","method","none")
ucic:set("openvpn","omr","cipher","none")
@ -812,6 +813,7 @@ function wizard_add()
ucic:set("v2ray","omrout","s_vmess_user_security","none")
ucic:set("v2ray","omrout","s_vless_user_security","none")
elseif encryption == "aes-256-gcm" then
ucic:set("openmptcprouter","settings","encryption","aes-256-gcm")
ucic:set("shadowsocks-libev","sss0","method","aes-256-gcm")
ucic:set("shadowsocks-libev","sss1","method","aes-256-gcm")
ucic:set("glorytun","vpn","chacha20","0")
@ -821,6 +823,7 @@ function wizard_add()
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("openmptcprouter","settings","encryption","aes-256-cfb")
ucic:set("shadowsocks-libev","sss0","method","aes-256-cfb")
ucic:set("shadowsocks-libev","sss1","method","aes-256-cfb")
ucic:set("glorytun","vpn","chacha20","0")
@ -830,6 +833,7 @@ function wizard_add()
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("openmptcprouter","settings","encryption","chacha20")
ucic:set("shadowsocks-libev","sss0","method","chacha20-ietf-poly1305")
ucic:set("shadowsocks-libev","sss1","method","chacha20-ietf-poly1305")
ucic:set("glorytun","vpn","chacha20","1")
@ -838,6 +842,8 @@ function wizard_add()
ucic:set("mlvpn","general","cleartext_data","0")
ucic:set("v2ray","omrout","s_vmess_user_security","chacha20-poly1305")
ucic:set("v2ray","omrout","s_vless_user_security","chacha20-poly1305")
else
ucic:set("openmptcprouter","settings","encryption","other")
end
ucic:save("openvpn")
ucic:save("glorytun")

View file

@ -269,13 +269,18 @@
<div class="cbi-value-field">
<select class="cbi-input-select" name="encryption" size="1">
<%
local method=uci:get("shadowsocks-libev","sss0","method")
local method=uci:get("openmptcprouter","settings","encryption")
if method == nil and ut.trim(sys.exec("cat /proc/cpuinfo | grep aes")) ~= "" then
method="aes-256-gcm"
else
method="chacha20"
end
%>
<option value="none" <% if method == "none" then %>selected="selected"<% end %>><%:None%></option>
<option value="aes-256-gcm" <% if method == "aes-256-gcm" then %>selected="selected"<% end %>>AES-256-GCM</option>
<option value="aes-256-cfb" <% if method == "aes-256-cfb" then %>selected="selected"<% end %>>AES-256-CFB</option>
<option value="chacha20-ietf-poly1305" <% if method == "chacha20" or method == "chacha20-ietf-poly1305" then %>selected="selected"<% end %>>chacha20</option>
<option value="other" <% if method ~= "chacha20" and method ~= "aes-256-gcm" and method ~= "aes-256-cfb" and method ~= "chacha20-ietf-poly1305" and method ~= "none" then %>selected="selected"<% end %>><%:other%></option>
<option value="other" <% if method == "other" or (method ~= "chacha20" and method ~= "aes-256-gcm" and method ~= "aes-256-cfb" and method ~= "chacha20-ietf-poly1305" and method ~= "none") then %>selected="selected"<% end %>><%:other%></option>
</select>
<br />
<div class="cbi-value-description">

View file

@ -1035,7 +1035,9 @@ function interfaces_status()
mArray.openmptcprouter["multi_vpn"] = true
end
end
if uci:get("openmptcprouter","settings","vpn") ~= "none" then
mArray.openmptcprouter["vpn"]= uci:get("openmptcprouter","settings","vpn")
end
-- check Shadowsocks is running
mArray.openmptcprouter["shadowsocks_service"] = false
if string.find(sys.exec("/usr/bin/pgrep ss-redir"), "%d+") then

View file

@ -107,6 +107,7 @@ _set_json() {
_set_glorytun_vps() {
local enabled port key
enabled="$(uci -q get glorytun.vpn.enable)"
[ "$enabled" != "1" ] && enabled="$(uci -q get glorytun-udp.vpn.enable)"
[ "$enabled" != "1" ] && echo "Glorytun disabled" && return
port="$(uci -q get glorytun.vpn.port)"
key="$(uci -q get glorytun.vpn.key)"
@ -1909,17 +1910,16 @@ _config_service() {
[ "$(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')"
if [ "$(uci -q get openmptcprouter.settings.firstboot)" != "0" ]; then
[ -n "$vps_config" ] && [ -n "$(cat /proc/cpuinfo | grep aes)" ] && {
[ -n "$(cat /proc/cpuinfo | grep aes)" ] && {
vps_aes="$(echo "$vps_config" | jsonfilter -q -e '@.vps.aes')"
if [ "$vps_aes" != "false" ] && [ "$user_permission" != "ro" ]; then
logger -t "OMR-VPS" "CPU support AES, set it by default"
method="$(uci -q get shadowsocks-libev.sss0.method)"
uci -q batch <<-EOF >/dev/null
set openmptcprouter.settings.encryption="aes-256-gcm"
commit openmptcprouter
set glorytun.vpn.chacha20="0"
commit glorytun
set glorytun-udp.vpn.chacha="0"
@ -1934,6 +1934,11 @@ _config_service() {
fi
}
fi
[ -z "$vps_config" ] && vps_config=$(_get_json "config")
[ -z "$vps_config" ] && return
user_permission="$(echo "$vps_config" | jsonfilter -q -e '@.user.permission')"
if [ "$user_permission" != "ro" ]; then
#config_load shadowsocks-libev
#config_foreach _set_ss_server_vps server

View file

@ -2,9 +2,9 @@
uci -q batch <<-EOF >/dev/null
set luci.diag=internal
set luci.diag.ping="openmptcprouter.com"
set luci.diag.dns="openmptcprouter.com"
set luci.diag.route="openmptcprouter.com"
set luci.diag.ping="www.openmptcprouter.com"
set luci.diag.dns="www.openmptcprouter.com"
set luci.diag.route="www.openmptcprouter.com"
set luci.diag.iperf3="ping-ams1.online.net"
set luci.diag.getip="ip.openmptcprouter.com"
commit luci