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
This commit is contained in:
caicaicai21 2019-12-29 10:34:21 +08:00 committed by coolsnowwolf
parent 4ae1049cff
commit d11dfd403d
3 changed files with 31 additions and 6 deletions

View File

@ -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",

View File

@ -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

View File

@ -16,6 +16,9 @@ msgstr "备注"
msgid "Port"
msgstr "端口"
msgid "User name"
msgstr "用户名"
msgid "Password"
msgstr "密码"