mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
fix
This commit is contained in:
parent
d4ed20af96
commit
daa43369e1
151 changed files with 3144 additions and 12804 deletions
|
@ -415,6 +415,7 @@ function wizard_add()
|
|||
|
||||
local downloadspeed = luci.http.formvalue("cbid.sqm.%s.download" % intf) or "0"
|
||||
local uploadspeed = luci.http.formvalue("cbid.sqm.%s.upload" % intf) or "0"
|
||||
local testspeed = luci.http.formvalue("cbid.sqm.%s.testspeed" % intf) or "0"
|
||||
|
||||
if not ucic:get("qos",intf) ~= "" then
|
||||
ucic:set("qos",intf,"interface")
|
||||
|
@ -438,7 +439,7 @@ function wizard_add()
|
|||
ucic:set("sqm",intf,"script","piece_of_cake.qos")
|
||||
ucic:set("sqm",intf,"qdisc_advanced","0")
|
||||
ucic:set("sqm",intf,"linklayer","atm")
|
||||
ucic:set("sqm",intf,"overhead","40")
|
||||
ucic:set("sqm",intf,"overhead","44")
|
||||
ucic:set("sqm",intf,"enabled","0")
|
||||
ucic:set("sqm",intf,"debug_logging","0")
|
||||
ucic:set("sqm",intf,"verbosity","5")
|
||||
|
@ -454,6 +455,10 @@ function wizard_add()
|
|||
ucic:set("sqm",intf,"qdisc","cake")
|
||||
ucic:set("sqm",intf,"script","piece_of_cake.qos")
|
||||
end
|
||||
ucic:set("openmptcprouter",intf,"testspeed",testspeed)
|
||||
if testspeed == "1" then
|
||||
ucic:delete("openmptcprouter",intf,"testspeed_lc")
|
||||
end
|
||||
if downloadspeed ~= "0" and downloadspeed ~= "" then
|
||||
if sqmautorate == "1" and (ucic:get("network",intf,"downloadspeed") ~= downloadspeed or ucic:get("sqm",intf,"max_download") == "" or ucic:get("sqm",intf,"download") == "0") then
|
||||
ucic:set("sqm",intf,"download",math.ceil(downloadspeed*65/100))
|
||||
|
@ -551,17 +556,22 @@ function wizard_add()
|
|||
vpn_intf = "bonding-omrvpn"
|
||||
ucic:set("network","omrvpn","proto","bonding")
|
||||
end
|
||||
if downloadmax ~= 0 and uploadmax ~= 0 then
|
||||
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))
|
||||
ucic:set("sqm","omrvpn","min_download",math.ceil(downloadmax*8/100))
|
||||
ucic:set("sqm","omrvpn","upload",math.ceil(uploadmax*50/100))
|
||||
ucic:set("sqm","omrvpn","min_upload",math.ceil(uploadmax*8/100))
|
||||
else
|
||||
ucic:set("sqm","omrvpn","enabled","0")
|
||||
end
|
||||
--if downloadmax ~= 0 and uploadmax ~= 0 then
|
||||
-- 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))
|
||||
-- ucic:set("sqm","omrvpn","min_download",math.ceil(downloadmax*8/100))
|
||||
-- ucic:set("sqm","omrvpn","upload",math.ceil(uploadmax*50/100))
|
||||
-- ucic:set("sqm","omrvpn","min_upload",math.ceil(uploadmax*8/100))
|
||||
--else
|
||||
-- ucic:set("sqm","omrvpn","enabled","0")
|
||||
--end
|
||||
|
||||
ucic:set("sqm","omrvpn","enabled","1")
|
||||
ucic:set("sqm","omrvpn","download","0")
|
||||
ucic:set("sqm","omrvpn","upload","0")
|
||||
|
||||
if vpn_intf ~= "" then
|
||||
ucic:set("network","omrvpn","device",vpn_intf)
|
||||
ucic:set("sqm","omrvpn","interface",vpn_intf)
|
||||
|
@ -619,7 +629,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 +815,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 +823,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 +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 == "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 +843,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 +852,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")
|
||||
|
|
|
@ -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"
|
||||
elseif method == nil then
|
||||
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">
|
||||
|
@ -988,12 +993,22 @@
|
|||
end
|
||||
%>
|
||||
<div class="cbi-value" data-index="19">
|
||||
<label class="cbi-value-title"><%:Calculate speed%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input class="cbi-input-checkbox" type="checkbox" name="cbid.sqm.<%=ifname%>.testspeed" value="1" <% if uci:get("openmptcprouter",ifname,"testspeed") == "1" or uci:get("openmptcprouter",ifname,"testspeed") == nil then %>checked<% end %> />
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Run an automatic speedtest to calculate max download & upload speed.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" data-index="20">
|
||||
<label class="cbi-value-title"><%:Download speed (Kb/s)%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="cbid.sqm.<%=ifname%>.download" class="cbi-input-text" value="<%=download%>" data-type="uinteger">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Used by Glorytun UDP and SQM/QoS if enabled. 0 to use default value.%>
|
||||
<%:Used by Glorytun UDP and SQM/QoS if enabled.%>
|
||||
</div>
|
||||
<!--
|
||||
<br />
|
||||
|
@ -1003,13 +1018,13 @@
|
|||
-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value" data-index="20">
|
||||
<div class="cbi-value" data-index="21">
|
||||
<label class="cbi-value-title"><%:Upload speed (Kb/s)%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="cbid.sqm.<%=ifname%>.upload" class="cbi-input-text" value="<%=upload%>" data-type="uinteger">
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Used by Glorytun UDP and SQM/QoS if enabled. 0 to use default value.%>
|
||||
<%:Used by Glorytun UDP and SQM/QoS if enabled.%>
|
||||
</div>
|
||||
<!--
|
||||
<br />
|
||||
|
|
|
@ -744,6 +744,7 @@ function interfaces_status()
|
|||
|
||||
mArray.openmptcprouter["latest_version_omr"] = uci:get("openmptcprouter", "latest_versions", "omr") or ""
|
||||
mArray.openmptcprouter["latest_version_vps"] = uci:get("openmptcprouter", "latest_versions", "vps") or ""
|
||||
mArray.openmptcprouter["proxy"] = uci:get("openmptcprouter", "settings", "proxy") or ""
|
||||
|
||||
mArray.openmptcprouter["service_addr"] = uci:get("shadowsocks-libev", "sss0", "server") or ""
|
||||
if mArray.openmptcprouter["service_addr"] == "" or mArray.openmptcprouter["service_addr"] == "192.168.1.3" then
|
||||
|
@ -761,7 +762,7 @@ function interfaces_status()
|
|||
mArray.openmptcprouter["local_addr"] = ipaddr
|
||||
--mArray.openmptcprouter["local_addr"] = uci:get("network", "lan", "ipaddr")
|
||||
mArray.openmptcprouter["hostname"] = "OpenMPTCProuter"
|
||||
mArray.openmptcprouter["kernel"] = sys.exec("uname -r")
|
||||
mArray.openmptcprouter["kernel"] = sys.exec("uname -r | tr -d '\n'")
|
||||
ucic:foreach("system", "system", function(s)
|
||||
mArray.openmptcprouter["hostname"] = uci:get("system",s[".name"],"hostname") or "OpenMPTCProuter"
|
||||
end)
|
||||
|
@ -1034,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue