mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-12 18:41:51 +00:00
Add V2Ray and Shadowsocks Rust support in Wizard adn status page
This commit is contained in:
parent
804aec1589
commit
339198a19e
5 changed files with 251 additions and 16 deletions
|
@ -613,6 +613,7 @@ function wizard_add()
|
|||
ucic:set("openmptcprouter",server,"master","1")
|
||||
ucic:set("openmptcprouter",server,"current","1")
|
||||
ucic:set("openmptcprouter",server,"backup","0")
|
||||
ucic:set("xray","omrout","s_shadowsocks_email",openmptcprouter_vps_username:gsub("%s+", ""))
|
||||
else
|
||||
ucic:set("openmptcprouter",server,"get_config","0")
|
||||
ucic:set("openmptcprouter",server,"master","0")
|
||||
|
@ -669,14 +670,34 @@ function wizard_add()
|
|||
if default_proxy == "shadowsocks" and serversnb > 0 and serversnb > disablednb then
|
||||
--ucic:set("shadowsocks-libev","sss0","disabled","0")
|
||||
ucic:set("v2ray","main","enabled","0")
|
||||
ucic:set("xray","main","enabled","0")
|
||||
ucic:foreach("shadowsocks-libev", "server", function(s)
|
||||
local sectionname = s[".name"]
|
||||
if sectionname:match("^sss.*") and ucic:get("shadowsocks-libev",sectionname,"server") ~= "" then
|
||||
ucic:set("shadowsocks-libev",sectionname,"disabled","0")
|
||||
end
|
||||
end)
|
||||
ucic:foreach("shadowsocks-rust", "server", function(s)
|
||||
local sectionname = s[".name"]
|
||||
ucic:set("shadowsocks-rust",sectionname,"disabled","1")
|
||||
end)
|
||||
elseif default_proxy == "shadowsocks-rust" and serversnb > 0 and serversnb > disablednb then
|
||||
--ucic:set("shadowsocks-libev","sss0","disabled","0")
|
||||
ucic:set("v2ray","main","enabled","0")
|
||||
ucic:set("xray","main","enabled","0")
|
||||
ucic:foreach("shadowsocks-rust", "server", function(s)
|
||||
local sectionname = s[".name"]
|
||||
if sectionname:match("^sss.*") and ucic:get("shadowsocks-rust",sectionname,"server") ~= "" then
|
||||
ucic:set("shadowsocks-rust",sectionname,"disabled","0")
|
||||
end
|
||||
end)
|
||||
ucic:foreach("shadowsocks-libev", "server", function(s)
|
||||
local sectionname = s[".name"]
|
||||
ucic:set("shadowsocks-libev",sectionname,"disabled","1")
|
||||
end)
|
||||
elseif (default_proxy == "v2ray" or default_proxy == "v2ray-vmess" or default_proxy == "v2ray-trojan" or default_proxy == "v2ray-socks") and serversnb > 0 and serversnb > disablednb then
|
||||
--ucic:set("shadowsocks-libev","sss0","disabled","1")
|
||||
ucic:set("xray","main","enabled","0")
|
||||
ucic:set("v2ray","main","enabled","1")
|
||||
if default_proxy == "v2ray" then
|
||||
ucic:set("v2ray","omrout","protocol","vless")
|
||||
|
@ -691,18 +712,51 @@ function wizard_add()
|
|||
local sectionname = s[".name"]
|
||||
ucic:set("shadowsocks-libev",sectionname,"disabled","1")
|
||||
end)
|
||||
else
|
||||
ucic:foreach("shadowsocks-rust", "server", function(s)
|
||||
local sectionname = s[".name"]
|
||||
ucic:set("shadowsocks-rust",sectionname,"disabled","1")
|
||||
end)
|
||||
elseif (default_proxy == "xray" or default_proxy == "xray-vmess" or default_proxy == "xray-trojan" or default_proxy == "xray-shadowsocks" or default_proxy == "xray-socks") and serversnb > 0 and serversnb > disablednb then
|
||||
--ucic:set("shadowsocks-libev","sss0","disabled","1")
|
||||
ucic:set("v2ray","main","enabled","0")
|
||||
ucic:set("xray","main","enabled","1")
|
||||
if default_proxy == "xray" then
|
||||
ucic:set("xray","omrout","protocol","vless")
|
||||
elseif default_proxy == "xray-vmess" then
|
||||
ucic:set("xray","omrout","protocol","vmess")
|
||||
elseif default_proxy == "xray-trojan" then
|
||||
ucic:set("xray","omrout","protocol","trojan")
|
||||
elseif default_proxy == "xray-socks" then
|
||||
ucic:set("xray","omrout","protocol","socks")
|
||||
elseif default_proxy == "xray-shadowsocks" then
|
||||
ucic:set("xray","omrout","protocol","shadowsocks")
|
||||
end
|
||||
ucic:foreach("shadowsocks-libev", "server", function(s)
|
||||
local sectionname = s[".name"]
|
||||
ucic:set("shadowsocks-libev",sectionname,"disabled","1")
|
||||
end)
|
||||
ucic:foreach("shadowsocks-rust", "server", function(s)
|
||||
local sectionname = s[".name"]
|
||||
ucic:set("shadowsocks-rust",sectionname,"disabled","1")
|
||||
end)
|
||||
else
|
||||
--ucic:set("shadowsocks-libev","sss0","disabled","1")
|
||||
ucic:set("v2ray","main","enabled","0")
|
||||
ucic:set("xray","main","enabled","0")
|
||||
ucic:foreach("shadowsocks-libev", "server", function(s)
|
||||
local sectionname = s[".name"]
|
||||
ucic:set("shadowsocks-libev",sectionname,"disabled","1")
|
||||
end)
|
||||
ucic:foreach("shadowsocks-rust", "server", function(s)
|
||||
local sectionname = s[".name"]
|
||||
ucic:set("shadowsocks-rust",sectionname,"disabled","1")
|
||||
end)
|
||||
end
|
||||
ucic:set("openmptcprouter","settings","proxy",default_proxy)
|
||||
ucic:save("openmptcprouter")
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:save("v2ray")
|
||||
ucic:save("xray")
|
||||
|
||||
ucic:foreach("shadowsocks-libev","server", function(s)
|
||||
local sectionname = s[".name"]
|
||||
|
@ -744,6 +798,11 @@ function wizard_add()
|
|||
ucic:set("v2ray","omrout","s_vless_address",server_ip)
|
||||
ucic:set("v2ray","omrout","s_trojan_address",server_ip)
|
||||
ucic:set("v2ray","omrout","s_socks_address",server_ip)
|
||||
ucic:set("xray","omrout","s_vmess_address",server_ip)
|
||||
ucic:set("xray","omrout","s_vless_address",server_ip)
|
||||
ucic:set("xray","omrout","s_trojan_address",server_ip)
|
||||
ucic:set("xray","omrout","s_socks_address",server_ip)
|
||||
ucic:set("xray","omrout","s_shadowsocks_address",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)
|
||||
|
@ -784,6 +843,11 @@ function wizard_add()
|
|||
ucic:set("v2ray","omrout","s_vless_address",server_ip)
|
||||
ucic:set("v2ray","omrout","s_trojan_address",server_ip)
|
||||
ucic:set("v2ray","omrout","s_socks_address",server_ip)
|
||||
ucic:set("xray","omrout","s_vmess_address",server_ip)
|
||||
ucic:set("xray","omrout","s_vless_address",server_ip)
|
||||
ucic:set("xray","omrout","s_trojan_address",server_ip)
|
||||
ucic:set("xray","omrout","s_socks_address",server_ip)
|
||||
ucic:set("xray","omrout","s_shadowsocks_address",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)
|
||||
|
@ -816,6 +880,7 @@ function wizard_add()
|
|||
ucic:save("mlvpn")
|
||||
ucic:save("ubond")
|
||||
ucic:save("v2ray")
|
||||
ucic:save("xray")
|
||||
--ucic:commit("mlvpn")
|
||||
ucic:save("dsvpn")
|
||||
--ucic:commit("dsvpn")
|
||||
|
@ -831,12 +896,19 @@ function wizard_add()
|
|||
ucic:set("openmptcprouter","settings","encryption","none")
|
||||
ucic:set("shadowsocks-libev","sss0","method","none")
|
||||
ucic:set("shadowsocks-libev","sss1","method","none")
|
||||
ucic:set("shadowsocks-rust","sss0","method","none")
|
||||
ucic:set("shadowsocks-rust","sss1","method","none")
|
||||
ucic:set("openvpn","omr","cipher","none")
|
||||
ucic:set("mlvpn","general","cleartext_data","1")
|
||||
ucic:set("v2ray","omrout","s_vmess_user_security","none")
|
||||
ucic:set("v2ray","omrout","s_vless_user_security","none")
|
||||
ucic:set("v2ray","omrout","s_trojan_user_security","none")
|
||||
ucic:set("v2ray","omrout","s_socks_user_security","none")
|
||||
ucic:set("xray","omrout","s_vmess_user_security","none")
|
||||
ucic:set("xray","omrout","s_vless_user_security","none")
|
||||
ucic:set("xray","omrout","s_trojan_user_security","none")
|
||||
ucic:set("xray","omrout","s_socks_user_security","none")
|
||||
ucic:set("xray","omrout","s_shadowsocks_method","none")
|
||||
elseif encryption == "aes-256-gcm" then
|
||||
ucic:set("openmptcprouter","settings","encryption","aes-256-gcm")
|
||||
ucic:set("shadowsocks-libev","sss0","method","aes-256-gcm")
|
||||
|
@ -849,6 +921,13 @@ function wizard_add()
|
|||
ucic:set("v2ray","omrout","s_vless_user_security","aes-128-gcm")
|
||||
ucic:set("v2ray","omrout","s_trojan_user_security","aes-128-gcm")
|
||||
ucic:set("v2ray","omrout","s_socks_user_security","aes-128-gcm")
|
||||
ucic:set("xray","omrout","s_vmess_user_security","aes-128-gcm")
|
||||
ucic:set("xray","omrout","s_vless_user_security","aes-128-gcm")
|
||||
ucic:set("xray","omrout","s_trojan_user_security","aes-128-gcm")
|
||||
ucic:set("xray","omrout","s_socks_user_security","aes-128-gcm")
|
||||
ucic:set("xray","omrout","s_shadowsocks_method","2022-blake3-aes-256-gcm")
|
||||
ucic:set("shadowsocks-rust","sss0","s_shadowsocks_method","2022-blake3-aes-256-gcm")
|
||||
ucic:set("shadowsocks-rust","sss1","s_shadowsocks_method","2022-blake3-aes-256-gcm")
|
||||
elseif encryption == "aes-256-cfb" then
|
||||
ucic:set("openmptcprouter","settings","encryption","aes-256-cfb")
|
||||
ucic:set("shadowsocks-libev","sss0","method","aes-256-cfb")
|
||||
|
@ -861,6 +940,13 @@ function wizard_add()
|
|||
ucic:set("v2ray","omrout","s_vless_user_security","aes-128-gcm")
|
||||
ucic:set("v2ray","omrout","s_trojan_user_security","aes-128-gcm")
|
||||
ucic:set("v2ray","omrout","s_socks_user_security","aes-128-gcm")
|
||||
ucic:set("xray","omrout","s_vmess_user_security","aes-128-gcm")
|
||||
ucic:set("xray","omrout","s_vless_user_security","aes-128-gcm")
|
||||
ucic:set("xray","omrout","s_trojan_user_security","aes-128-gcm")
|
||||
ucic:set("xray","omrout","s_socks_user_security","aes-128-gcm")
|
||||
ucic:set("xray","omrout","s_shadowsocks_method","2022-blake3-aes-256-gcm")
|
||||
ucic:set("shadowsocks-rust","sss0","s_shadowsocks_method","2022-blake3-aes-256-gcm")
|
||||
ucic:set("shadowsocks-rust","sss1","s_shadowsocks_method","2022-blake3-aes-256-gcm")
|
||||
elseif encryption == "chacha20-ietf-poly1305" then
|
||||
ucic:set("openmptcprouter","settings","encryption","chacha20")
|
||||
ucic:set("shadowsocks-libev","sss0","method","chacha20-ietf-poly1305")
|
||||
|
@ -873,6 +959,13 @@ function wizard_add()
|
|||
ucic:set("v2ray","omrout","s_vless_user_security","chacha20-poly1305")
|
||||
ucic:set("v2ray","omrout","s_trojan_user_security","chacha20-poly1305")
|
||||
ucic:set("v2ray","omrout","s_socks_user_security","chacha20-poly1305")
|
||||
ucic:set("xray","omrout","s_vmess_user_security","chacha20-poly1305")
|
||||
ucic:set("xray","omrout","s_vless_user_security","chacha20-poly1305")
|
||||
ucic:set("xray","omrout","s_trojan_user_security","chacha20-poly1305")
|
||||
ucic:set("xray","omrout","s_socks_user_security","chacha20-poly1305")
|
||||
ucic:set("xray","omrout","s_shadowsocks_method","2022-blake3-chacha20-poly1305")
|
||||
ucic:set("shadowsocks-rust","sss0","s_shadowsocks_method","2022-blake3-chacha20-poly1305")
|
||||
ucic:set("shadowsocks-rust","sss1","s_shadowsocks_method","2022-blake3-chacha20-poly1305")
|
||||
else
|
||||
ucic:set("openmptcprouter","settings","encryption","other")
|
||||
end
|
||||
|
@ -881,6 +974,7 @@ function wizard_add()
|
|||
ucic:save("glorytun-udp")
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:save("v2ray")
|
||||
ucic:save("xray")
|
||||
|
||||
-- Set ShadowSocks settings
|
||||
local shadowsocks_key = luci.http.formvalue("shadowsocks_key")
|
||||
|
@ -897,7 +991,7 @@ function wizard_add()
|
|||
ucic:save("shadowsocks-libev")
|
||||
ucic:commit("shadowsocks-libev")
|
||||
if shadowsocks_disable == "1" then
|
||||
luci.sys.call("/etc/init.d/shadowsocks rules_down >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/shadowsocks-libev rules_down >/dev/null 2>/dev/null")
|
||||
end
|
||||
else
|
||||
if serversnb == 0 then
|
||||
|
@ -908,8 +1002,33 @@ function wizard_add()
|
|||
ucic:set("shadowsocks-libev","sss1","key","")
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:commit("shadowsocks-libev")
|
||||
luci.sys.call("/etc/init.d/shadowsocks rules_down >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/shadowsocks-libev rules_down >/dev/null 2>/dev/null")
|
||||
end
|
||||
-- Set ShadowSocks 2022 settings
|
||||
local shadowsocks2022_key = luci.http.formvalue("shadowsocks2022_key")
|
||||
if shadowsocks2022_key ~= "" then
|
||||
ucic:set("shadowsocks-rust","sss0","password",shadowsocks2022_key)
|
||||
ucic:set("shadowsocks-rust","sss1","password",shadowsocks2022_key)
|
||||
ucic:set("xray","omrout","s_shadowsocks_password",shadowsocks2022_key)
|
||||
ucic:save("shadowsocks-rust")
|
||||
ucic:commit("shadowsocks-rust")
|
||||
if shadowsocks_disable == "1" then
|
||||
luci.sys.call("/etc/init.d/shadowsocks-rust rules_down >/dev/null 2>/dev/null")
|
||||
end
|
||||
else
|
||||
if serversnb == 0 then
|
||||
ucic:set("shadowsocks-rust","sss0","disabled","1")
|
||||
ucic:set("shadowsocks-rust","sss1","disabled","1")
|
||||
end
|
||||
ucic:set("shadowsocks-rust","sss0","key","")
|
||||
ucic:set("shadowsocks-rust","sss1","key","")
|
||||
ucic:set("xray","omrout","s_shadowsocks_password","")
|
||||
ucic:save("shadowsocks-rust")
|
||||
ucic:commit("shadowsocks-rust")
|
||||
luci.sys.call("/etc/init.d/shadowsocks-rust rules_down >/dev/null 2>/dev/null")
|
||||
end
|
||||
|
||||
|
||||
local v2ray_user = luci.http.formvalue("v2ray_user")
|
||||
ucic:set("v2ray","omrout","s_vmess_user_id",v2ray_user)
|
||||
ucic:set("v2ray","omrout","s_vless_user_id",v2ray_user)
|
||||
|
@ -917,6 +1036,14 @@ function wizard_add()
|
|||
ucic:set("v2ray","omrout","s_socks_user_id",v2ray_user)
|
||||
ucic:save("v2ray")
|
||||
ucic:commit("v2ray")
|
||||
ucic:set("xray","omrout","s_vmess_user_id",v2ray_user)
|
||||
ucic:set("xray","omrout","s_vless_user_id",v2ray_user)
|
||||
ucic:set("xray","omrout","s_trojan_user_id",v2ray_user)
|
||||
ucic:set("xray","omrout","s_socks_user_id",v2ray_user)
|
||||
ucic:save("xray")
|
||||
ucic:commit("xray")
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:commit("shadowsocks-libev")
|
||||
|
||||
|
||||
-- Set Glorytun settings
|
||||
|
@ -1046,6 +1173,8 @@ function wizard_add()
|
|||
|
||||
ucic:save("v2ray")
|
||||
ucic:commit("v2ray")
|
||||
ucic:save("xray")
|
||||
ucic:commit("xray")
|
||||
|
||||
ucic:save("network")
|
||||
ucic:commit("network")
|
||||
|
@ -1086,6 +1215,7 @@ function wizard_add()
|
|||
luci.sys.call("/etc/init.d/omr-6in4 restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/vnstat restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/v2ray restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/xray restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/sqm restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/sqm-autorate restart >/dev/null 2>/dev/null")
|
||||
luci.sys.call("/etc/init.d/sysntpd restart >/dev/null 2>/dev/null")
|
||||
|
@ -1214,11 +1344,14 @@ function settings_add()
|
|||
local shadowsocksudp = luci.http.formvalue("shadowsocksudp") or "0"
|
||||
ucic:set("openmptcprouter","settings","shadowsocksudp",shadowsocksudp)
|
||||
|
||||
-- Enable/disable v2ray udp
|
||||
-- Enable/disable v2ray/xray udp
|
||||
local v2rayudp = luci.http.formvalue("v2rayudp") or "0"
|
||||
ucic:set("v2ray","main_transparent_proxy","redirect_udp",v2rayudp)
|
||||
ucic:save("v2ray")
|
||||
ucic:commit("v2ray")
|
||||
ucic:set("xray","main_transparent_proxy","redirect_udp",v2rayudp)
|
||||
ucic:save("xray")
|
||||
ucic:commit("xray")
|
||||
|
||||
-- Enable/disable nDPI
|
||||
local ndpi = luci.http.formvalue("ndpi") or "1"
|
||||
|
|
|
@ -292,15 +292,23 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:When proxy shadowsocks is used, use it for UDP if VPN down%></label>
|
||||
<label class="cbi-value-title"><%:Shadowsocks UDP%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="checkbox" name="shadowsocksudp" class="cbi-input-checkbox" value="1" <% if luci.model.uci.cursor():get("openmptcprouter","settings","shadowsocksudp") == "1" then %>checked<% end %>>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:When proxy shadowsocks is used, use it for UDP if VPN down%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:When proxy V2Ray VLESS or VMESS is used, use it for UDP%></label>
|
||||
<label class="cbi-value-title"><%:V2Ray/XRay UDP%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="checkbox" name="v2rayudp" class="cbi-input-checkbox" value="1" <% if luci.model.uci.cursor():get("v2ray","main_transparent_proxy","redirect_udp") == "1" then %>checked<% end %>>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:When proxy V2Ray/XRay VLESS, VMESS or Trojan is used, use it for UDP%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cbi-value">
|
||||
|
|
|
@ -163,6 +163,18 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
|
|||
statusMessage += '<br/>';
|
||||
}
|
||||
}
|
||||
if (mArray.openmptcprouter.shadowsocksrust_enabled == true && mArray.openmptcprouter.service_addr != "")
|
||||
{
|
||||
if (mArray.openmptcprouter.shadowsocksrust_service == false)
|
||||
{
|
||||
statusMessage += '<%:ShadowSocks Rust is not running%>';
|
||||
if (mArray.openmptcprouter.shadowsocksrust_service_key == false && mArray.openmptcprouter.shadowsocksrust_service_method !== "none")
|
||||
{
|
||||
statusMessage += ' <i>(' + '<%:empty key%>' + ')</i>';
|
||||
}
|
||||
statusMessage += '<br/>';
|
||||
}
|
||||
}
|
||||
if (mArray.openmptcprouter.v2ray_enabled == true && mArray.openmptcprouter.service_addr != "")
|
||||
{
|
||||
if (mArray.openmptcprouter.v2ray_service == false)
|
||||
|
@ -171,6 +183,14 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
|
|||
statusMessage += '<br/>';
|
||||
}
|
||||
}
|
||||
if (mArray.openmptcprouter.xray_enabled == true && mArray.openmptcprouter.service_addr != "")
|
||||
{
|
||||
if (mArray.openmptcprouter.xray_service == false)
|
||||
{
|
||||
statusMessage += '<%:XRay is not running%>';
|
||||
statusMessage += '<br/>';
|
||||
}
|
||||
}
|
||||
if (mArray.openmptcprouter.fsro == true)
|
||||
{
|
||||
statusMessage += '<%:Filesystem is readonly%>' + '<br/>';
|
||||
|
@ -194,7 +214,7 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
|
|||
statusIcon = "<%=resource%>/openmptcprouter/images/statusError.png";
|
||||
} else if (mArray.openmptcprouter.service_addr != "")
|
||||
{
|
||||
if (mArray.openmptcprouter.v2ray_enabled == false && mArray.openmptcprouter.shadowsocks_enabled == false)
|
||||
if (mArray.openmptcprouter.xray_enabled == false && mArray.openmptcprouter.v2ray_enabled == false && mArray.openmptcprouter.shadowsocks_enabled == false && mArray.openmptcprouter.shadowsocksrust_enabled == false)
|
||||
{
|
||||
statusMessage += '<%:Proxy is DISABLED%>' + '<br/>';
|
||||
}
|
||||
|
@ -285,9 +305,15 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
|
|||
} else if (mArray.openmptcprouter.shadowsocks_enabled == true && mArray.openmptcprouter.proxy_addr == "" && mArray.openmptcprouter.external_check == true)
|
||||
{
|
||||
statusMessage += '<%:Can\'t get public IP address from ShadowSocks%>' + '<br/>';
|
||||
} else if (mArray.openmptcprouter.shadowsocksrust_enabled == true && mArray.openmptcprouter.proxy_addr == "" && mArray.openmptcprouter.external_check == true)
|
||||
{
|
||||
statusMessage += '<%:Can\'t get public IP address from ShadowSocks Rust%>' + '<br/>';
|
||||
} else if (mArray.openmptcprouter.v2ray_enabled == true && mArray.openmptcprouter.proxy_addr == "" && mArray.openmptcprouter.external_check == true)
|
||||
{
|
||||
statusMessage += '<%:Can\'t get public IP address from V2Ray%>' + '<br/>';
|
||||
} else if (mArray.openmptcprouter.xray_enabled == true && mArray.openmptcprouter.proxy_addr == "" && mArray.openmptcprouter.external_check == true)
|
||||
{
|
||||
statusMessage += '<%:Can\'t get public IP address from XRay%>' + '<br/>';
|
||||
} else if (mArray.openmptcprouter.wan_addr == "" && mArray.openmptcprouter.wan_addr6 == "" && mArray.openmptcprouter.external_check == true)
|
||||
{
|
||||
statusMessage += '<%:No public IP address detected in less than 1 second%>' + '<br/>';
|
||||
|
|
|
@ -227,7 +227,7 @@
|
|||
</fieldset>
|
||||
<fieldset class="cbi-section" id="proxy">
|
||||
<legend><%:Proxy settings%></legend>
|
||||
<div class="cbi-section-descr"><%:By default proxy is used for any traffic that is TCP (and UDP for V2Ray).%></div>
|
||||
<div class="cbi-section-descr"><%:By default proxy is used for any traffic that is TCP (and UDP for V2Ray/XRay).%></div>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Default Proxy%></label>
|
||||
<div class="cbi-value-field">
|
||||
|
@ -237,11 +237,17 @@
|
|||
<% if nixio.fs.access("/etc/init.d/v2ray") then %><option value="v2ray-vmess" <% if uci:get("openmptcprouter","settings","proxy") == "v2ray-vmess" then %>selected="selected"<% end %>>V2Ray VMESS</option><% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/v2ray") then %><option value="v2ray-trojan" <% if uci:get("openmptcprouter","settings","proxy") == "v2ray-trojan" then %>selected="selected"<% end %>>V2Ray TROJAN</option><% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/v2ray") then %><option value="v2ray-socks" <% if uci:get("openmptcprouter","settings","proxy") == "v2ray-socks" then %>selected="selected"<% end %>>V2Ray SOCKS</option><% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/xray") then %><option value="xray" <% if uci:get("openmptcprouter","settings","proxy") == "xray" then %>selected="selected"<% end %>>XRay VLESS</option><% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/xray") then %><option value="xray-vmess" <% if uci:get("openmptcprouter","settings","proxy") == "xray-vmess" then %>selected="selected"<% end %>>XRay VMESS</option><% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/xray") then %><option value="xray-trojan" <% if uci:get("openmptcprouter","settings","proxy") == "xray-trojan" then %>selected="selected"<% end %>>XRay Trojan</option><% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/xray") then %><option value="xray-socks" <% if uci:get("openmptcprouter","settings","proxy") == "xray-socks" then %>selected="selected"<% end %>>XRay Socks</option><% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/xray") then %><option value="xray-shadowsocks" <% if uci:get("openmptcprouter","settings","proxy") == "xray-shadowsocks" then %>selected="selected"<% end %>>XRay Shadowsocks 2022</option><% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/shadowsocks-rust") then %><option value="shadowsocks-rust" <% if uci:get("openmptcprouter","settings","proxy") == "shadowsocks-rust" then %>selected="selected"<% end %>>Shadowsocks-Rust 2022</option><% end %>
|
||||
<option value="none" <% if uci:get("openmptcprouter","settings","proxy") == "none" then %>selected="selected"<% end %>>None</option>
|
||||
</select>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Set the default Proxy used for TCP when ShadowSocks is enabled, for TCP and UDP when V2Ray VLESS, VMESS or Trojan is enabled.%>
|
||||
<%:Set the default Proxy used for TCP when ShadowSocks is enabled, for TCP and UDP when V2Ray/XRay VLESS, VMESS or Trojan is enabled.%>
|
||||
<%:Only ShadowSocks is supported with server multiple IPs for now.%>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -258,9 +264,21 @@
|
|||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/v2ray") then %>
|
||||
<% if nixio.fs.access("/etc/init.d/xray") or nixio.fs.access("/etc/init.d/shadowsocks-rust") then %>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:V2Ray user id%></label>
|
||||
<label class="cbi-value-title"><%:ShadowSocks 2022 key%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="shadowsocks2022_key" placeholder="<%:ShadowSocks 2022 key%>" class="cbi-input-text" value="<%=uci:get("shadowsocks-rust","sss0","password")%>" />
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
<%:Key is retrieved from server API by default.%> <%:ShadowSocks is used for TCP.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if nixio.fs.access("/etc/init.d/v2ray") or nixio.fs.access("/etc/init.d/xray") then %>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:V2Ray/XRay user id%></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="text" name="v2ray_user" placeholder="<%:V2Ray user%>" class="cbi-input-text" value="<%=uci:get("v2ray","omrout","s_vmess_user_id")%>" />
|
||||
<br />
|
||||
|
@ -284,7 +302,7 @@
|
|||
%>
|
||||
<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="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 == "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>
|
||||
|
@ -297,7 +315,7 @@
|
|||
<% else %>
|
||||
<%:There is no Advanced Encryption Standard (AES) instruction set integrated in the processor, you should use chacha20.%>
|
||||
<% end %>
|
||||
<%:Encryption method is used for Shadowsocks, V2Ray, Glorytun and OpenVPN.%>
|
||||
<%:Encryption method is used for Shadowsocks, V2Ray/XRay, Glorytun and OpenVPN.%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -334,6 +334,10 @@ function server_settings(server,server_ip,openmptcprouter_vps_key)
|
|||
ucic:set("v2ray","omrout","s_vless_address",server_ip)
|
||||
ucic:set("v2ray","omrout","s_socks_address",server_ip)
|
||||
ucic:set("v2ray","omrout","s_trojan_address",server_ip)
|
||||
ucic:set("xray","omrout","s_vmess_address",server_ip)
|
||||
ucic:set("xray","omrout","s_vless_address",server_ip)
|
||||
ucic:set("xray","omrout","s_socks_address",server_ip)
|
||||
ucic:set("xray","omrout","s_trojan_address",server_ip)
|
||||
ucic:save("qos")
|
||||
ucic:commit("qos")
|
||||
ucic:save("mlvpn")
|
||||
|
@ -341,7 +345,9 @@ function server_settings(server,server_ip,openmptcprouter_vps_key)
|
|||
ucic:save("dsvpn")
|
||||
ucic:commit("dsvpn")
|
||||
ucic:save("v2ray")
|
||||
ucic:save("xray")
|
||||
ucic:commit("v2ray")
|
||||
ucic:commit("xray")
|
||||
ucic:save("glorytun")
|
||||
ucic:commit("glorytun")
|
||||
ucic:save("shadowsocks-libev")
|
||||
|
@ -428,6 +434,7 @@ function restart_all()
|
|||
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")
|
||||
sys.exec("/etc/init.d/xray restart >/dev/null 2>/dev/null")
|
||||
end
|
||||
|
||||
function redirectports(server,redirect_ports)
|
||||
|
@ -822,9 +829,9 @@ function interfaces_status()
|
|||
-- shadowsocksaddr
|
||||
mArray.openmptcprouter["proxy_addr"] = uci:get("openmptcprouter","omr","detected_ss_ipv4") or ""
|
||||
if mArray.openmptcprouter["proxy_addr"] == "" and mArray.openmptcprouter["service_addr"] ~= "" then
|
||||
tracker_ip = uci:get("shadowsocks-libev","tracker_sss0","local_address") or ""
|
||||
tracker_ip = uci:get("shadowsocks-libev","tracker_sss0","local_address") or "127.0.0.1"
|
||||
if tracker_ip ~= "" then
|
||||
local tracker_port = uci:get("shadowsocks-libev","tracker_sss0","local_port")
|
||||
local tracker_port = uci:get("shadowsocks-libev","tracker_sss0","local_port") or "1111"
|
||||
if mArray.openmptcprouter["external_check"] ~= false then
|
||||
mArray.openmptcprouter["proxy_addr"] = ut.trim(sys.exec("curl -s -4 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m " .. timeout .. " " .. check_ipv4_website))
|
||||
if mArray.openmptcprouter["proxy_addr"] == "" then
|
||||
|
@ -930,7 +937,16 @@ function interfaces_status()
|
|||
mArray.openmptcprouter["v2ray_traffic_tx"] = "0"
|
||||
mArray.openmptcprouter["v2ray_traffic"] = "0"
|
||||
end
|
||||
mArray.openmptcprouter["proxy_traffic"] = mArray.openmptcprouter["ss_traffic"] + mArray.openmptcprouter["v2ray_traffic"]
|
||||
if status and vpsinfo.xray ~= nil then
|
||||
mArray.openmptcprouter["xray_traffic_rx"] = vpsinfo.xray.rx or "0"
|
||||
mArray.openmptcprouter["xray_traffic_tx"] = vpsinfo.xray.tx or "0"
|
||||
mArray.openmptcprouter["xray_traffic"] = mArray.openmptcprouter["xray_traffic_tx"] + mArray.openmptcprouter["xray_traffic_rx"]
|
||||
else
|
||||
mArray.openmptcprouter["xray_traffic_rx"] = "0"
|
||||
mArray.openmptcprouter["xray_traffic_tx"] = "0"
|
||||
mArray.openmptcprouter["xray_traffic"] = "0"
|
||||
end
|
||||
mArray.openmptcprouter["proxy_traffic"] = mArray.openmptcprouter["ss_traffic"] + mArray.openmptcprouter["v2ray_traffic"] + mArray.openmptcprouter["xray_traffic"]
|
||||
mArray.openmptcprouter["total_traffic"] = mArray.openmptcprouter["proxy_traffic"] + mArray.openmptcprouter["vpn_traffic"]
|
||||
else
|
||||
mArray.openmptcprouter["vps_admin"] = false
|
||||
|
@ -1048,6 +1064,11 @@ function interfaces_status()
|
|||
if string.find(sys.exec("/usr/bin/pgrep ss-redir"), "%d+") then
|
||||
mArray.openmptcprouter["shadowsocks_service"] = true
|
||||
end
|
||||
-- check Shadowsocks Rust is running
|
||||
mArray.openmptcprouter["shadowsocksrust_service"] = false
|
||||
if string.find(sys.exec("/usr/bin/pgrep sslocal"), "%d+") then
|
||||
mArray.openmptcprouter["shadowsocksrust_service"] = true
|
||||
end
|
||||
|
||||
mArray.openmptcprouter["shadowsocks_enabled"] = true
|
||||
local ss_server = "1"
|
||||
|
@ -1061,6 +1082,18 @@ function interfaces_status()
|
|||
mArray.openmptcprouter["shadowsocks_enabled"] = false
|
||||
end
|
||||
|
||||
mArray.openmptcprouter["shadowsocksrust_enabled"] = true
|
||||
local ss_server = "1"
|
||||
ucic:foreach("shadowsocks-rust", "server", function(s)
|
||||
local ss_server_disabled = uci:get("shadowsocks-rust",s[".name"],"disabled") or "0"
|
||||
if ss_server_disabled == "0" then
|
||||
ss_server = "0"
|
||||
end
|
||||
end)
|
||||
if ss_server == "1" then
|
||||
mArray.openmptcprouter["shadowsocksrust_enabled"] = false
|
||||
end
|
||||
|
||||
-- check V2Ray is running
|
||||
mArray.openmptcprouter["v2ray_service"] = false
|
||||
if string.find(sys.exec("/usr/bin/pgrep v2ray"), "%d+") then
|
||||
|
@ -1071,6 +1104,16 @@ function interfaces_status()
|
|||
if v2ray == "1" then
|
||||
mArray.openmptcprouter["v2ray_enabled"] = true
|
||||
end
|
||||
-- check XRay is running
|
||||
mArray.openmptcprouter["xray_service"] = false
|
||||
if string.find(sys.exec("/usr/bin/pgrep xray"), "%d+") then
|
||||
mArray.openmptcprouter["xray_service"] = true
|
||||
end
|
||||
mArray.openmptcprouter["xray_enabled"] = false
|
||||
local xray = uci:get("xray","main","enabled") or "0"
|
||||
if xray == "1" then
|
||||
mArray.openmptcprouter["xray_enabled"] = true
|
||||
end
|
||||
local ss_key = uci:get("shadowsocks-libev","sss0","key") or ""
|
||||
mArray.openmptcprouter["shadowsocks_service_method"] = uci:get("shadowsocks-libev","sss0","method")
|
||||
if ss_key == "" then
|
||||
|
@ -1078,6 +1121,13 @@ function interfaces_status()
|
|||
else
|
||||
mArray.openmptcprouter["shadowsocks_service_key"] = true
|
||||
end
|
||||
local ssr_key = uci:get("shadowsocks-rust","sss0","key") or ""
|
||||
mArray.openmptcprouter["shadowsocksrust_service_method"] = uci:get("shadowsocks-rust","sss0","method")
|
||||
if ssr_key == "" then
|
||||
mArray.openmptcprouter["shadowsocksrust_service_key"] = false
|
||||
else
|
||||
mArray.openmptcprouter["shadowsocksrust_service_key"] = true
|
||||
end
|
||||
|
||||
-- Add DHCP infos by parsing dnsmasq config file
|
||||
mArray.openmptcprouter.dhcpd = {}
|
||||
|
|
Loading…
Reference in a new issue