luci-app-passwall2: sync

* cde115a9cd58b299e41994cfe85f2d13c8a1de42
This commit is contained in:
sbwml 2023-09-08 18:22:56 +08:00
parent 3567c4635b
commit df4a5072d7
21 changed files with 148 additions and 721 deletions

View File

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall2
PKG_VERSION:=1.20-6
PKG_VERSION:=1.20-7
PKG_RELEASE:=
PKG_CONFIG_DEPENDS:= \

View File

@ -128,35 +128,34 @@ o:depends("ipv6_tproxy", true)
o.default = 0
if has_xray then
s = m:section(TypedSection, "global_xray", "Xray " .. translate("Settings"))
s.anonymous = true
s.addremove = false
s_xray = m:section(TypedSection, "global_xray", "Xray " .. translate("Settings"))
s_xray.anonymous = true
s_xray.addremove = false
o = s:option(Flag, "sniffing", translate("Sniffing"), translate("When using the shunt, must be enabled, otherwise the shunt will invalid."))
o = s_xray:option(Flag, "sniffing", translate("Sniffing"), translate("When using the shunt, must be enabled, otherwise the shunt will invalid."))
o.default = 1
o.rmempty = false
if has_xray then
o = s:option(Flag, "route_only", translate("Sniffing Route Only"))
o.default = 0
o:depends("sniffing", true)
o = s_xray:option(Flag, "route_only", translate("Sniffing Route Only"))
o.default = 0
o:depends("sniffing", true)
local domains_excluded = string.format("/usr/share/%s/domains_excluded", appname)
o = s:option(TextValue, "no_sniffing_hosts", translate("No Sniffing Lists"), translate("Hosts added into No Sniffing Lists will not resolve again on server."))
o.rows = 15
o.wrap = "off"
o.cfgvalue = function(self, section) return fs.readfile(domains_excluded) or "" end
o.write = function(self, section, value) fs.writefile(domains_excluded, value:gsub("\r\n", "\n")) end
o.remove = function(self, section, value)
if s.fields["route_only"]:formvalue(section) == "0" then
fs.writefile(domains_excluded, "")
end
local domains_excluded = string.format("/usr/share/%s/domains_excluded", appname)
o = s_xray:option(TextValue, "no_sniffing_hosts", translate("No Sniffing Lists"), translate("Hosts added into No Sniffing Lists will not resolve again on server."))
o.rows = 15
o.wrap = "off"
o.cfgvalue = function(self, section) return fs.readfile(domains_excluded) or "" end
o.write = function(self, section, value) fs.writefile(domains_excluded, value:gsub("\r\n", "\n")) end
o.remove = function(self, section)
local route_only_value = s_xray.fields["route_only"]:formvalue(section)
if not route_only_value or route_only_value == "0" then
fs.writefile(domains_excluded, "")
end
o:depends({sniffing = true, route_only = false})
o = s:option(Value, "buffer_size", translate("Buffer Size"), translate("Buffer size for every connection (kB)"))
o.datatype = "uinteger"
end
o:depends({sniffing = true, route_only = false})
o = s_xray:option(Value, "buffer_size", translate("Buffer Size"), translate("Buffer size for every connection (kB)"))
o.datatype = "uinteger"
end
if has_singbox then
@ -169,7 +168,7 @@ if has_singbox then
o.rmempty = false
o = s:option(Value, "geoip_path", translate("Custom geoip Path"))
o.default = "/tmp/singbox/geoip.db"
o.default = "/usr/share/singbox/geoip.db"
o.rmempty = false
o = s:option(Value, "geoip_url", translate("Custom geoip URL"))
@ -178,14 +177,13 @@ if has_singbox then
o.rmempty = false
o = s:option(Value, "geosite_path", translate("Custom geosite Path"))
o.default = "/tmp/singbox/geosite.db"
o.default = "/usr/share/singbox/geosite.db"
o.rmempty = false
o = s:option(Value, "geosite_url", translate("Custom geosite URL"))
o.default = "https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db"
o:value("https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db")
o.rmempty = false
end
return m

View File

@ -14,26 +14,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
-- [[ Brook ]]
s.fields["type"]:value(type_name, translate("Brook"))
@ -57,21 +37,4 @@ o:depends({ [option_name("protocol")] = "wsclient" })
o = s:option(Value, option_name("password"), translate("Password"))
o.password = true
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -14,26 +14,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
-- [[ Hysteria ]]
s.fields["type"]:value(type_name, translate("Hysteria"))
@ -49,25 +29,25 @@ o = s:option(Value, option_name("port"), translate("Port"))
o.datatype = "port"
o = s:option(Value, option_name("hop"), translate("Additional ports for hysteria hop"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("obfs"), translate("Obfs Password"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(ListValue, option_name("auth_type"), translate("Auth Type"))
o:value("disable", translate("Disable"))
o:value("string", translate("STRING"))
o:value("base64", translate("BASE64"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("auth_password"), translate("Auth Password"))
o.password = true
o:depends({ [option_name("auth_type")] = "string"})
o:depends({ [option_name("auth_type")] = "base64"})
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("alpn"), translate("QUIC TLS ALPN"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Flag, option_name("fast_open"), translate("Fast Open"))
o.default = "0"
@ -79,48 +59,31 @@ o.default = "0"
o = s:option(Value, option_name("up_mbps"), translate("Max upload Mbps"))
o.default = "10"
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("down_mbps"), translate("Max download Mbps"))
o.default = "50"
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("recv_window_conn"), translate("QUIC stream receive window"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("recv_window"), translate("QUIC connection receive window"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("handshake_timeout"), translate("Handshake Timeout"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("idle_timeout"), translate("Idle Timeout"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("hop_interval"), translate("Hop Interval"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Flag, option_name("disable_mtu_discovery"), translate("Disable MTU detection"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Flag, option_name("lazy_start"), translate("Lazy Start"))
o.not_rewrite = true
o.rewrite_option = o.option
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -14,26 +14,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
-- [[ Naive ]]
s.fields["type"]:value(type_name, translate("NaiveProxy"))
@ -52,21 +32,4 @@ o = s:option(Value, option_name("username"), translate("Username"))
o = s:option(Value, option_name("password"), translate("Password"))
o.password = true
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -17,26 +17,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
local x_ss_encrypt_method_list = {
"aes-128-gcm", "aes-256-gcm", "chacha20-poly1305", "xchacha20-poly1305", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305"
}
@ -247,17 +227,9 @@ o:value("none")
o:depends({ [option_name("protocol")] = "vless" })
o = s:option(ListValue, option_name("x_ss_encrypt_method"), translate("Encrypt Method"))
o.not_rewrite = true
o.rewrite_option = "method"
for a, t in ipairs(x_ss_encrypt_method_list) do o:value(t) end
o:depends({ [option_name("protocol")] = "shadowsocks" })
function o.cfgvalue(self, section)
return m:get(section, "method")
end
function o.write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
m:set(section, "method", value)
end
end
o = s:option(Flag, option_name("iv_check"), translate("IV Check"))
o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("x_ss_encrypt_method")] = "aes-128-gcm" })
@ -545,21 +517,4 @@ o = s:option(Value, option_name("xudp_concurrency"), translate("XUDP Mux concurr
o.default = 8
o:depends({ [option_name("xmux")] = true })
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -21,26 +21,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
local ss_method_new_list = {
"none", "aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305"
}
@ -223,32 +203,16 @@ for a, t in ipairs(security_list) do o:value(t) end
o:depends({ [option_name("protocol")] = "vmess" })
o = s:option(ListValue, option_name("ss_method"), translate("Encrypt Method"))
o.not_rewrite = true
o.rewrite_option = "method"
for a, t in ipairs(ss_method_new_list) do o:value(t) end
for a, t in ipairs(ss_method_old_list) do o:value(t) end
o:depends({ [option_name("protocol")] = "shadowsocks" })
function o.cfgvalue(self, section)
return m:get(section, "method")
end
function o.write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
m:set(section, "method", value)
end
end
if singbox_tags:find("with_shadowsocksr") then
o = s:option(ListValue, option_name("ssr_method"), translate("Encrypt Method"))
o.not_rewrite = true
o.rewrite_option = "method"
for a, t in ipairs(ss_method_old_list) do o:value(t) end
o:depends({ [option_name("protocol")] = "shadowsocksr" })
function o.cfgvalue(self, section)
return m:get(section, "method")
end
function o.write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
m:set(section, "method", value)
end
end
local ssr_protocol_list = {
"origin", "verify_simple", "verify_deflate", "verify_sha1", "auth_simple",
@ -357,6 +321,9 @@ if singbox_tags:find("with_quic") then
o.datatype = "uinteger"
o.default = "3"
o:depends({ [option_name("protocol")] = "tuic" })
o = s:option(Value, option_name("tuic_alpn"), translate("QUIC TLS ALPN"))
o:depends({ [option_name("protocol")] = "tuic" })
end
if singbox_tags:find("with_quic") then
@ -558,21 +525,4 @@ o = s:option(Value, option_name("mux_concurrency"), translate("Mux concurrency")
o.default = 8
o:depends({ [option_name("mux")] = true })
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -14,26 +14,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
local ssrust_encrypt_method_list = {
"plain", "none",
"aes-128-gcm", "aes-256-gcm", "chacha20-ietf-poly1305",
@ -74,21 +54,4 @@ o:depends({ [option_name("plugin")] = "xray-plugin"})
o:depends({ [option_name("plugin")] = "v2ray-plugin"})
o:depends({ [option_name("plugin")] = "obfs-local"})
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -14,26 +14,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
local ss_encrypt_method_list = {
"rc4-md5", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-ctr",
"aes-192-ctr", "aes-256-ctr", "bf-cfb", "salsa20", "chacha20", "chacha20-ietf",
@ -75,21 +55,4 @@ o:depends({ [option_name("plugin")] = "xray-plugin"})
o:depends({ [option_name("plugin")] = "v2ray-plugin"})
o:depends({ [option_name("plugin")] = "obfs-local"})
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -14,26 +14,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
local ssr_encrypt_method_list = {
"none", "table", "rc2-cfb", "rc4", "rc4-md5", "rc4-md5-6", "aes-128-cfb",
"aes-192-cfb", "aes-256-cfb", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr",
@ -86,21 +66,4 @@ o = s:option(ListValue, option_name("tcp_fast_open"), "TCP " .. translate("Fast
o:value("false")
o:value("true")
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -14,26 +14,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
-- [[ TUIC ]]
s.fields["type"]:value(type_name, translate("TUIC"))
@ -51,34 +31,34 @@ o = s:option(Value, option_name("password"), translate("TUIC User Password For C
o.password = true
o.rmempty = true
o.default = ""
o.not_rewrite = true
o.rewrite_option = o.option
--[[
-- Tuic username for local socks connect
o = s:option(Value, option_name("socks_username"), translate("TUIC UserName For Local Socks"))
o.rmempty = true
o.default = ""
o.not_rewrite = true
o.rewrite_option = o.option
-- Tuic Password for local socks connect
o = s:option(Value, option_name("socks_password"), translate("TUIC Password For Local Socks"))
o.password = true
o.rmempty = true
o.default = ""
o.not_rewrite = true
o.rewrite_option = o.option
--]]
o = s:option(Value, option_name("ip"), translate("Set the TUIC proxy server ip address"))
o.datatype = "ipaddr"
o.rmempty = true
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(ListValue, option_name("udp_relay_mode"), translate("UDP relay mode"))
o:value("native", translate("native"))
o:value("quic", translate("QUIC"))
o.default = "native"
o.rmempty = true
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(ListValue, option_name("congestion_control"), translate("Congestion control algorithm"))
o:value("bbr", translate("BBR"))
@ -86,85 +66,68 @@ o:value("cubic", translate("CUBIC"))
o:value("new_reno", translate("New Reno"))
o.default = "cubic"
o.rmempty = true
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("heartbeat"), translate("Heartbeat interval(second)"))
o.datatype = "uinteger"
o.default = "3"
o.rmempty = true
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("timeout"), translate("Timeout for establishing a connection to server(second)"))
o.datatype = "uinteger"
o.default = "8"
o.rmempty = true
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("gc_interval"), translate("Garbage collection interval(second)"))
o.datatype = "uinteger"
o.default = "3"
o.rmempty = true
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("gc_lifetime"), translate("Garbage collection lifetime(second)"))
o.datatype = "uinteger"
o.default = "15"
o.rmempty = true
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("send_window"), translate("TUIC send window"))
o.datatype = "uinteger"
o.default = 20971520
o.rmempty = true
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("receive_window"), translate("TUIC receive window"))
o.datatype = "uinteger"
o.default = 10485760
o.rmempty = true
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("max_package_size"), translate("TUIC Maximum packet size the socks5 server can receive from external, in bytes"))
o.datatype = "uinteger"
o.default = 1500
o.rmempty = true
o.not_rewrite = true
o.rewrite_option = o.option
--Tuic settings for the local inbound socks5 server
o = s:option(Flag, option_name("dual_stack"), translate("Set if the listening socket should be dual-stack"))
o.default = 0
o.rmempty = true
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Flag, option_name("disable_sni"), translate("Disable SNI"))
o.default = 0
o.rmempty = true
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Flag, option_name("zero_rtt_handshake"), translate("Enable 0-RTT QUIC handshake"))
o.default = 0
o.rmempty = true
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(DynamicList, option_name("tls_alpn"), translate("TLS ALPN"))
o.rmempty = true
o.not_rewrite = true
o.rewrite_option = o.option
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -14,26 +14,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
-- [[ Brook ]]
s.fields["type"]:value(type_name, translate("Brook"))
@ -58,21 +38,4 @@ o = s:option(Flag, option_name("log"), translate("Log"))
o.default = "1"
o.rmempty = false
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -14,26 +14,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
-- [[ Hysteria ]]
s.fields["type"]:value(type_name, translate("Hysteria"))
@ -47,41 +27,41 @@ o:value("faketcp", "faketcp")
o:value("wechat-video", "wechat-video")
o = s:option(Value, option_name("obfs"), translate("Obfs Password"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(ListValue, option_name("auth_type"), translate("Auth Type"))
o:value("disable", translate("Disable"))
o:value("string", translate("STRING"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("auth_password"), translate("Auth Password"))
o.password = true
o:depends({ [option_name("auth_type")] = "string" })
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("alpn"), translate("QUIC TLS ALPN"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Flag, option_name("udp"), translate("UDP"))
o.default = "1"
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("up_mbps"), translate("Max upload Mbps"))
o.default = "10"
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("down_mbps"), translate("Max download Mbps"))
o.default = "50"
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("recv_window_conn"), translate("QUIC stream receive window"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Value, option_name("recv_window"), translate("QUIC connection receive window"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Flag, option_name("disable_mtu_discovery"), translate("Disable MTU detection"))
o.not_rewrite = true
o.rewrite_option = o.option
o = s:option(Flag, option_name("tls"), translate("TLS"))
o.default = 0
@ -130,21 +110,4 @@ o = s:option(Flag, option_name("log"), translate("Log"))
o.default = "1"
o.rmempty = false
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -14,26 +14,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
local x_ss_method_list = {
"aes-128-gcm", "aes-256-gcm", "chacha20-poly1305", "xchacha20-poly1305", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305"
}
@ -98,17 +78,9 @@ o.default = "none"
o:depends({ [option_name("protocol")] = "vless" })
o = s:option(ListValue, option_name("x_ss_method"), translate("Encrypt Method"))
o.not_rewrite = true
o.rewrite_option = "method"
for a, t in ipairs(x_ss_method_list) do o:value(t) end
o:depends({ [option_name("protocol")] = "shadowsocks" })
function o.cfgvalue(self, section)
return m:get(section, "method")
end
function o.write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == "Xray" then
m:set(section, "method", value)
end
end
o = s:option(Flag, option_name("iv_check"), translate("IV Check"))
o:depends({ [option_name("protocol")] = "shadowsocks" })
@ -391,21 +363,4 @@ o:value("warning")
o:value("error")
o:depends({ [option_name("log")] = true })
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -18,26 +18,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
local ss_method_list = {
"none", "aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305",
"2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305"
@ -152,6 +132,9 @@ if singbox_tags:find("with_quic") then
o.datatype = "uinteger"
o.default = "3"
o:depends({ [option_name("protocol")] = "tuic" })
o = s:option(Value, option_name("tuic_alpn"), translate("QUIC TLS ALPN"))
o:depends({ [option_name("protocol")] = "tuic" })
end
if singbox_tags:find("with_quic") then
@ -196,17 +179,9 @@ o.default = "none"
o:depends({ [option_name("protocol")] = "vless" })
o = s:option(ListValue, option_name("ss_method"), translate("Encrypt Method"))
o.not_rewrite = true
o.rewrite_option = "method"
for a, t in ipairs(ss_method_list) do o:value(t) end
o:depends({ [option_name("protocol")] = "shadowsocks" })
function o.cfgvalue(self, section)
return m:get(section, "method")
end
function o.write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
m:set(section, "method", value)
end
end
o = s:option(DynamicList, option_name("uuid"), translate("ID") .. "/" .. translate("Password"))
for i = 1, 3 do
@ -368,21 +343,4 @@ o:value("warn")
o:value("error")
o:depends({ [option_name("log")] = true })
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -14,26 +14,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
local ssrust_encrypt_method_list = {
"plain", "none",
"aes-128-gcm", "aes-256-gcm", "chacha20-ietf-poly1305",
@ -64,21 +44,4 @@ o = s:option(Flag, option_name("log"), translate("Log"))
o.default = "1"
o.rmempty = false
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -14,26 +14,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
local ss_encrypt_method_list = {
"rc4-md5", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-ctr",
"aes-192-ctr", "aes-256-ctr", "bf-cfb", "camellia-128-cfb",
@ -67,21 +47,4 @@ o = s:option(Flag, option_name("log"), translate("Log"))
o.default = "1"
o.rmempty = false
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -14,26 +14,6 @@ local function option_name(name)
return option_prefix .. name
end
local function rm_prefix_cfgvalue(self, section)
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
local function rm_prefix_write(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
local function rm_prefix_remove(self, section, value)
if s.fields["type"]:formvalue(arg[1]) == type_name then
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
local ssr_encrypt_method_list = {
"none", "table", "rc2-cfb", "rc4", "rc4-md5", "rc4-md5-6", "aes-128-cfb",
"aes-192-cfb", "aes-256-cfb", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr",
@ -91,21 +71,4 @@ o = s:option(Flag, option_name("log"), translate("Log"))
o.default = "1"
o.rmempty = false
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = rm_prefix_cfgvalue
s.fields[key].write = rm_prefix_write
s.fields[key].remove = rm_prefix_remove
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
api.luci_types(arg[1], m, s, type_name, option_prefix)

View File

@ -913,3 +913,52 @@ function to_move(app_name,file)
return {code = 0}
end
function luci_types(id, m, s, type_name, option_prefix)
for key, value in pairs(s.fields) do
if key:find(option_prefix) == 1 then
if not s.fields[key].not_rewrite then
s.fields[key].cfgvalue = function(self, section)
if self.rewrite_option then
return m:get(section, self.rewrite_option)
else
if self.option:find(option_prefix) == 1 then
return m:get(section, self.option:sub(1 + #option_prefix))
end
end
end
s.fields[key].write = function(self, section, value)
if s.fields["type"]:formvalue(id) == type_name then
if self.rewrite_option then
m:set(section, self.rewrite_option, value)
else
if self.option:find(option_prefix) == 1 then
m:set(section, self.option:sub(1 + #option_prefix), value)
end
end
end
end
s.fields[key].remove = function(self, section)
if s.fields["type"]:formvalue(id) == type_name then
if self.rewrite_option then
m:del(section, self.rewrite_option)
else
if self.option:find(option_prefix) == 1 then
m:del(section, self.option:sub(1 + #option_prefix))
end
end
end
end
end
local deps = s.fields[key].deps
if #deps > 0 then
for index, value in ipairs(deps) do
deps[index]["type"] = type_name
end
else
s.fields[key]:depends({ type = type_name })
end
end
end
end

View File

@ -306,6 +306,9 @@ function gen_outbound(flag, node, tag, proxy_table)
enabled = true,
server_name = node.tls_serverName,
insecure = (node.tls_allowInsecure == "1") and true or false,
alpn = (node.tuic_alpn and node.tuic_alpn ~= "") and {
node.tuic_alpn
} or nil,
},
}
end
@ -548,6 +551,9 @@ function gen_config_server(node)
enabled = true,
certificate_path = node.tls_certificateFile,
key_path = node.tls_keyFile,
alpn = (node.tuic_alpn and node.tuic_alpn ~= "") and {
node.tuic_alpn
} or nil,
}
}
end

View File

@ -69,7 +69,7 @@ https://github.com/pure-css/pure/blob/master/LICENSE.md
width: 100%;
}
.block h4 {
margin: 1rem 0rem 1rem -0.5rem;
margin: 1rem 0rem 1rem 0.5rem;
}
}