mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-15 18:03:30 +00:00
luci-app-v2ray-server: fix socks user and pass auth
This commit is contained in:
parent
67ed2cf85c
commit
d24f24016b
@ -9,7 +9,7 @@ LUCI_TITLE:=LuCI support for V2ray Server
|
|||||||
LUCI_DEPENDS:=+v2ray
|
LUCI_DEPENDS:=+v2ray
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
PKG_VERSION:=1.0
|
PKG_VERSION:=1.0
|
||||||
PKG_RELEASE:=5
|
PKG_RELEASE:=6
|
||||||
|
|
||||||
include $(TOPDIR)/feeds/luci/luci.mk
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
|
|
||||||
|
@ -1,77 +1,82 @@
|
|||||||
local e=require"luci.model.uci".cursor()
|
local ucursor = require "luci.model.uci".cursor()
|
||||||
local a=require"luci.jsonc"
|
local json = require "luci.jsonc"
|
||||||
local t=arg[1]
|
local server_section = arg[1]
|
||||||
local e=e:get_all("v2ray_server",t)
|
local server = ucursor:get_all("v2ray_server", server_section)
|
||||||
|
|
||||||
local e={
|
local proset
|
||||||
log = {
|
|
||||||
loglevel = "warning"
|
if server.protocol == "vmess" then
|
||||||
},
|
proset = {
|
||||||
inbound = {
|
clients = {
|
||||||
port = tonumber(e.port),
|
{
|
||||||
protocol = e.protocol,
|
id = server.VMess_id,
|
||||||
(e.protocol == 'vmess') and {
|
alterId = tonumber(server.VMess_alterId),
|
||||||
settings = {
|
level = tonumber(server.VMess_level)
|
||||||
clients = {
|
|
||||||
{
|
|
||||||
id = e.VMess_id,
|
|
||||||
alterId = tonumber(e.VMess_alterId),
|
|
||||||
level = tonumber(e.VMess_level)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
(e.protocol == 'socks') and {
|
|
||||||
settings = {
|
|
||||||
auth= "password",
|
|
||||||
accounts = {
|
|
||||||
{
|
|
||||||
user = e.Socks_user,
|
|
||||||
pass = e.Socks_pass
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
streamSettings = {
|
|
||||||
network = e.transport,
|
|
||||||
security = (e.tls == '1') and "tls" or "none",
|
|
||||||
kcpSettings = (e.transport == "mkcp") and {
|
|
||||||
mtu = tonumber(e.mkcp_mtu),
|
|
||||||
tti = tonumber(e.mkcp_tti),
|
|
||||||
uplinkCapacity = tonumber(e.mkcp_uplinkCapacity),
|
|
||||||
downlinkCapacity = tonumber(e.mkcp_downlinkCapacity),
|
|
||||||
congestion = (e.mkcp_congestion == "1") and true or false,
|
|
||||||
readBufferSize = tonumber(e.mkcp_readBufferSize),
|
|
||||||
writeBufferSize = tonumber(e.mkcp_writeBufferSize),
|
|
||||||
header = {
|
|
||||||
type = e.mkcp_guise
|
|
||||||
}
|
|
||||||
}
|
|
||||||
or nil,
|
|
||||||
httpSettings = (e.transport == "h2") and {
|
|
||||||
path = e.h2_path,
|
|
||||||
host = e.h2_host,
|
|
||||||
}
|
|
||||||
or nil,
|
|
||||||
quicSettings = (e.transport == "quic") and {
|
|
||||||
security = e.quic_security,
|
|
||||||
key = e.quic_key,
|
|
||||||
header = {
|
|
||||||
type = e.quic_guise
|
|
||||||
}
|
|
||||||
}
|
|
||||||
or nil
|
|
||||||
}
|
|
||||||
},
|
|
||||||
outbound = {
|
|
||||||
protocol = "freedom"
|
|
||||||
},
|
|
||||||
outboundDetour = {
|
|
||||||
{
|
|
||||||
protocol = "blackhole",
|
|
||||||
tag = "blocked"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
proset = {
|
||||||
|
auth = "password",
|
||||||
|
accounts = {
|
||||||
|
{
|
||||||
|
user = server.Socks_user,
|
||||||
|
pass = server.Socks_pass
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
print(a.stringify(e,1))
|
|
||||||
|
local v2ray = {
|
||||||
|
log = {
|
||||||
|
--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",
|
||||||
|
kcpSettings = (server.transport == "mkcp") and {
|
||||||
|
mtu = tonumber(server.mkcp_mtu),
|
||||||
|
tti = tonumber(server.mkcp_tti),
|
||||||
|
uplinkCapacity = tonumber(server.mkcp_uplinkCapacity),
|
||||||
|
downlinkCapacity = tonumber(server.mkcp_downlinkCapacity),
|
||||||
|
congestion = (server.mkcp_congestion == "1") and true or false,
|
||||||
|
readBufferSize = tonumber(server.mkcp_readBufferSize),
|
||||||
|
writeBufferSize = tonumber(server.mkcp_writeBufferSize),
|
||||||
|
header = {
|
||||||
|
type = server.mkcp_guise
|
||||||
|
}
|
||||||
|
} or nil,
|
||||||
|
httpSettings = (server.transport == "h2") and {
|
||||||
|
path = server.h2_path,
|
||||||
|
host = server.h2_host,
|
||||||
|
} or nil,
|
||||||
|
quicSettings = (server.transport == "quic") and {
|
||||||
|
security = server.quic_security,
|
||||||
|
key = server.quic_key,
|
||||||
|
header = {
|
||||||
|
type = server.quic_guise
|
||||||
|
}
|
||||||
|
} or nil
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- 传出连接
|
||||||
|
outbound = {
|
||||||
|
protocol = "freedom"
|
||||||
|
},
|
||||||
|
-- 额外传出连接
|
||||||
|
outboundDetour = {
|
||||||
|
{
|
||||||
|
protocol = "blackhole",
|
||||||
|
tag = "blocked"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print(json.stringify(v2ray,1))
|
@ -31,7 +31,7 @@ e.default=10086
|
|||||||
|
|
||||||
e=t:option(ListValue,"protocol",translate("Protocol"))
|
e=t:option(ListValue,"protocol",translate("Protocol"))
|
||||||
e:value("vmess",translate("Vmess"))
|
e:value("vmess",translate("Vmess"))
|
||||||
e:value("socks",translate("Socks5"))
|
e:value("socks",translate("Socks"))
|
||||||
|
|
||||||
e=t:option(Value,"VMess_id",translate("ID"))
|
e=t:option(Value,"VMess_id",translate("ID"))
|
||||||
e.default=luci.sys.exec("cat /proc/sys/kernel/random/uuid")
|
e.default=luci.sys.exec("cat /proc/sys/kernel/random/uuid")
|
||||||
|
Loading…
Reference in New Issue
Block a user