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")