提交 d11dfd40 编写于 作者: C caicaicai21 提交者: coolsnowwolf

luci-app-v2ray-server: add http proxy support and fix bug (#2601)

* luci-app-v2ray-server: add http proxy support and fix socks config saving when user or password empty error

* luci-app-v2ray-server: add missing msgid
上级 4ae1049c
......@@ -15,13 +15,23 @@ if server.protocol == "vmess" then
}
}
}
elseif server.protocol == "http" then
proset = {
allowTransparent = false,
accounts = {
{
user = (server.Http_user == nil) and "lean" or server.Http_user,
pass = (server.Http_pass == nil) and "password" or server.Http_pass
}
}
}
else
proset = {
auth = "password",
accounts = {
{
user = server.Socks_user,
pass = server.Socks_pass
user = (server.Socks_user == nil) and "lean" or server.Socks_user,
pass = (server.Socks_pass == nil) and "password" or server.Socks_pass
}
}
}
......@@ -33,12 +43,12 @@ local v2ray = {
--error = "/var/log/v2ray.log",
loglevel = "warning"
},
-- 传入连接
-- 传入连接
inbound = {
port = tonumber(server.port),
protocol = server.protocol,
settings = proset,
-- 底层传输配置
-- 底层传输配置
streamSettings = {
network = server.transport,
security = (server.tls == '1') and "tls" or "none",
......@@ -67,11 +77,11 @@ local v2ray = {
} or nil
}
},
-- 传出连接
-- 传出连接
outbound = {
protocol = "freedom"
},
-- 外传出连接
-- 额外传出连接
outboundDetour = {
{
protocol = "blackhole",
......
......@@ -32,6 +32,7 @@ e.default=10086
e=t:option(ListValue,"protocol",translate("Protocol"))
e:value("vmess",translate("Vmess"))
e:value("socks",translate("Socks"))
e:value("http",translate("Http"))
e=t:option(Value,"VMess_id",translate("ID"))
e.default=luci.sys.exec("cat /proc/sys/kernel/random/uuid")
......@@ -54,6 +55,17 @@ e.rmempty=true
e.password=true
e:depends("protocol","socks")
e=t:option(Value,"Http_user",translate("User name"))
e.default="lean"
e.rmempty=true
e:depends("protocol","http")
e=t:option(Value,"Http_pass",translate("Password"))
e.default="password"
e.rmempty=true
e.password=true
e:depends("protocol","http")
e=t:option(Value,"VMess_level",translate("User Level"))
e.default=1
......
......@@ -16,6 +16,9 @@ msgstr "备注"
msgid "Port"
msgstr "端口"
msgid "User name"
msgstr "用户名"
msgid "Password"
msgstr "密码"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册