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

Add V2Ray Trojan and VMess protocol support

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-08-25 11:06:40 +02:00
parent 051577195e
commit a8387400ba
6 changed files with 139 additions and 14 deletions

View file

@ -675,9 +675,16 @@ function wizard_add()
ucic:set("shadowsocks-libev",sectionname,"disabled","0")
end
end)
elseif default_proxy == "v2ray" and serversnb > 0 and serversnb > disablednb then
elseif (default_proxy == "v2ray" or default_proxy == "v2ray-vmess" or default_proxy == "v2ray-trojan") and serversnb > 0 and serversnb > disablednb then
--ucic:set("shadowsocks-libev","sss0","disabled","1")
ucic:set("v2ray","main","enabled","1")
if default_proxy == "v2ray" then
ucic:set("v2ray","omrout","protocol","vless")
elseif default_proxy == "v2ray-vmess" then
ucic:set("v2ray","omrout","protocol","vmess")
elseif default_proxy == "v2ray-trojan" then
ucic:set("v2ray","omrout","protocol","trojan")
end
ucic:foreach("shadowsocks-libev", "server", function(s)
local sectionname = s[".name"]
ucic:set("shadowsocks-libev",sectionname,"disabled","1")
@ -733,6 +740,7 @@ function wizard_add()
ucic:set("ubond","general","host",server_ip)
ucic:set("v2ray","omrout","s_vmess_address",server_ip)
ucic:set("v2ray","omrout","s_vless_address",server_ip)
ucic:set("v2ray","omrout","s_trojan_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)
@ -771,6 +779,7 @@ function wizard_add()
ucic:set("ubond","general","host",server_ip)
ucic:set("v2ray","omrout","s_vmess_address",server_ip)
ucic:set("v2ray","omrout","s_vless_address",server_ip)
ucic:set("v2ray","omrout","s_trojan_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)
@ -822,6 +831,7 @@ function wizard_add()
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")
elseif encryption == "aes-256-gcm" then
ucic:set("openmptcprouter","settings","encryption","aes-256-gcm")
ucic:set("shadowsocks-libev","sss0","method","aes-256-gcm")
@ -832,6 +842,7 @@ function wizard_add()
ucic:set("mlvpn","general","cleartext_data","0")
ucic:set("v2ray","omrout","s_vmess_user_security","aes-128-gcm")
ucic:set("v2ray","omrout","s_vless_user_security","aes-128-gcm")
ucic:set("v2ray","omrout","s_trojan_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")
@ -842,6 +853,7 @@ function wizard_add()
ucic:set("mlvpn","general","cleartext_data","0")
ucic:set("v2ray","omrout","s_vmess_user_security","aes-128-gcm")
ucic:set("v2ray","omrout","s_vless_user_security","aes-128-gcm")
ucic:set("v2ray","omrout","s_trojan_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")
@ -852,6 +864,7 @@ 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")
ucic:set("v2ray","omrout","s_trojan_user_security","chacha20-poly1305")
else
ucic:set("openmptcprouter","settings","encryption","other")
end
@ -892,6 +905,7 @@ function wizard_add()
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)
ucic:set("v2ray","omrout","s_trojan_user_id",v2ray_user)
ucic:save("v2ray")
ucic:commit("v2ray")

View file

@ -298,7 +298,7 @@
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title"><%:When proxy V2Ray is used, use it for UDP%></label>
<label class="cbi-value-title"><%:When proxy V2Ray VLESS or VMESS is used, use it for 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 %>>
</div>

View file

@ -233,12 +233,14 @@
<div class="cbi-value-field">
<select class="cbi-input-select" name="default_proxy" size="1">
<% if nixio.fs.access("/etc/init.d/shadowsocks-libev") then %><option value="shadowsocks" <% if uci:get("openmptcprouter","settings","shadowsocks") == "0" or uci:get("openmptcprouter","settings","proxy") == nil then %>selected="selected"<% end %>>Shadowsocks</option><% end %>
<% if nixio.fs.access("/etc/init.d/v2ray") then %><option value="v2ray" <% if uci:get("openmptcprouter","settings","proxy") == "v2ray" then %>selected="selected"<% end %>>V2Ray</option><% end %>
<% if nixio.fs.access("/etc/init.d/v2ray") then %><option value="v2ray" <% if uci:get("openmptcprouter","settings","proxy") == "v2ray" then %>selected="selected"<% end %>>V2Ray VLESS</option><% end %>
<% 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 %>
<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 is enabled.%>
<%:Set the default Proxy used for TCP when ShadowSocks is enabled, for TCP and UDP when V2Ray VLESS or VMESS is enabled.%>
<%:Only ShadowSocks is supported with server multiple IPs for now.%>
</div>
</div>