mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Don't use Nginx HA for ShadowSocks
This commit is contained in:
parent
b757773c8c
commit
5baee9a93e
2 changed files with 18 additions and 3 deletions
|
@ -88,11 +88,15 @@ function wizard_add()
|
|||
elseif default_vpn == "openvpn" then
|
||||
vpn_port = 65301
|
||||
end
|
||||
ucic:set("openmptcprouter","settings","vpn",default_vpn)
|
||||
ucic:save("openmptcprouter")
|
||||
ucic:commit("openmptcprouter")
|
||||
|
||||
-- Get all servers ips
|
||||
local server_ip = luci.http.formvalue("server_ip")
|
||||
-- We have an IP, so set it everywhere
|
||||
if server_ip ~= "" then
|
||||
local ss_ip
|
||||
-- Check if we have more than one IP, in this case use Nginx HA
|
||||
if (type(server_ip) == "table") then
|
||||
local ss_servers = {}
|
||||
|
@ -100,6 +104,7 @@ function wizard_add()
|
|||
local k = 0
|
||||
for _, ip in pairs(server_ip) do
|
||||
if k == 0 then
|
||||
ss_ip=ip
|
||||
table.insert(ss_servers,ip .. ":65101 max_fails=3 fail_timeout=30s")
|
||||
table.insert(vpn_servers,ip .. ":65001 max_fails=3 fail_timeout=30s")
|
||||
ucic:set("qos","serverin","srchost",ip)
|
||||
|
@ -119,6 +124,9 @@ function wizard_add()
|
|||
ucic:save("nginx-ha")
|
||||
ucic:commit("nginx-ha")
|
||||
server_ip = "127.0.0.1"
|
||||
ucic:set("shadowsocks-libev","sss0","server",ss_ip)
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:commit("shadowsocks-libev")
|
||||
else
|
||||
ucic:set("nginx-ha","ShadowSocks","enable","0")
|
||||
ucic:set("nginx-ha","VPN","enable","0")
|
||||
|
@ -126,10 +134,10 @@ function wizard_add()
|
|||
ucic:set("qos","serverout","dsthost",server_ip)
|
||||
ucic:save("qos")
|
||||
ucic:commit("qos")
|
||||
ucic:set("shadowsocks-libev","sss0","server",server_ip)
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:commit("shadowsocks-libev")
|
||||
end
|
||||
ucic:set("shadowsocks-libev","sss0","server",server_ip)
|
||||
ucic:save("shadowsocks-libev")
|
||||
ucic:commit("shadowsocks-libev")
|
||||
ucic:set("glorytun","vpn","host",server_ip)
|
||||
ucic:save("glorytun")
|
||||
ucic:commit("glorytun")
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<%
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
local net = require "luci.model.network".init()
|
||||
local fs = require "nixio.fs"
|
||||
local ifaces = net:get_interfaces()
|
||||
local servers_ip = {}
|
||||
local server_ip = uci:get("shadowsocks-libev","sss0","server")
|
||||
|
@ -28,8 +29,13 @@
|
|||
<div class="cbi-value cbi-value-last" id="server_ip" data-depends="[]" data-index="0">
|
||||
<label class="cbi-value-title" for="server_ip"><%:Server IP%></label>
|
||||
<div class="cbi-value-field">
|
||||
<%
|
||||
local has_nginxha = fs.access("/etc/config/nginx-ha")
|
||||
if has_nginxha then
|
||||
%>
|
||||
<div data-prefix="server_ip" data-browser-path="" data-dynlist="[[],[],null,false]" data-placeholder="123.123.123.123">
|
||||
<%
|
||||
end
|
||||
local k = 0
|
||||
for _,server in ipairs(servers_ip) do
|
||||
k = k+1
|
||||
|
@ -105,6 +111,7 @@
|
|||
<% if nixio.fs.access("/usr/sbin/glorytun-udp") then %><option value="glorytun_udp" <% if uci:get("glorytun","vpn","enable") == "1" and uci:get("glorytun","vpn","proto") == "udp" then %>selected="selected"<% end %>>Glorytun UDP</option><% end %>
|
||||
<% if nixio.fs.access("/usr/sbin/mlvpn") then %><option value="mlvpn" <% if uci:get("mlvpn","general","enable") == "1" then %>selected="selected"<% end %>>MLVPN</option><% end %>
|
||||
<% if nixio.fs.access("/usr/sbin/openvpn") then %><option value="openvpn" <% if uci:get("openvpn","omr","enabled") == "1" then %>selected="selected"<% end %>>OpenVPN</option><% end %>
|
||||
<option value="none" <% if uci:get("openmptcprouter","settings","vpn") == "none" then %>selected="selected"<% end %>>None</option>
|
||||
</select>
|
||||
<br />
|
||||
<div class="cbi-value-description">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue