mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-03 19:03:56 +08:00
🎄 Sync 2026-09-02 23:53:04
This commit is contained in:
1 parent
e27699fe9a
commit
351528cefe
53 files changed
+1219
-1072
No files matched your search
@@ -6,8 +6,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall2
|
||||
PKG_VERSION:=26.8.27
|
||||
PKG_RELEASE:=107
|
||||
PKG_VERSION:=26.9.2
|
||||
PKG_RELEASE:=108
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@@ -853,7 +853,7 @@ function geo_view()
|
||||
return
|
||||
end
|
||||
local function get_rules(str, type)
|
||||
local rules_id = {}
|
||||
local rules = {}
|
||||
uci_foreach("shunt_rules", function(s)
|
||||
local list
|
||||
if type == "geoip" then list = s.ip_list else list = s.domain_list end
|
||||
@@ -862,14 +862,18 @@ function geo_view()
|
||||
local prefix, main = line:match("^(.-):(.*)")
|
||||
if not main then main = line end
|
||||
if type == "geoip" and (api.datatypes.ipaddr(str) or api.datatypes.ip6addr(str)) then
|
||||
if main:find(str, 1, true) then rules_id[#rules_id + 1] = s[".name"] end
|
||||
if main:find(str, 1, true) then
|
||||
table.insert(rules, {id = s[".name"], group = s.group or i18n.translate("default")})
|
||||
end
|
||||
else
|
||||
if main == str then rules_id[#rules_id + 1] = s[".name"] end
|
||||
if main == str then
|
||||
table.insert(rules, {id = s[".name"], group = s.group or i18n.translate("default")})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
return rules_id
|
||||
return rules
|
||||
end
|
||||
local geo_dir = (uci_get("@global_rules[0]", "v2ray_location_asset") or "/usr/share/v2ray/"):match("^(.*)/")
|
||||
local geosite_path = geo_dir .. "/geosite.dat"
|
||||
@@ -890,11 +894,17 @@ function geo_view()
|
||||
for line in geo_string:gmatch("([^\n]+)") do
|
||||
lines[#lines + 1] = geo_type .. ":" .. line
|
||||
for _, r in ipairs(get_rules(line, geo_type) or {}) do
|
||||
if not seen[r] then seen[r] = true; rules[#rules + 1] = r end
|
||||
if not seen[r.id] then
|
||||
seen[r.id] = true
|
||||
rules[#rules + 1] = string.format("[%s]%s", r.group, r.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, r in ipairs(get_rules(value, geo_type) or {}) do
|
||||
if not seen[r] then seen[r] = true; rules[#rules + 1] = r end
|
||||
if not seen[r.id] then
|
||||
seen[r.id] = true
|
||||
rules[#rules + 1] = string.format("[%s]%s", r.group, r.id)
|
||||
end
|
||||
end
|
||||
geo_string = table.concat(lines, "\n")
|
||||
if #rules > 0 then
|
||||
|
||||
@@ -40,6 +40,7 @@ local security_list = { "none", "auto", "aes-128-gcm", "chacha20-poly1305", "zer
|
||||
local singbox_tags = luci.sys.exec(singbox_bin .. " version | grep 'Tags:' | awk '{print $2}'")
|
||||
|
||||
local singbox_version = api.get_app_version("sing-box"):match("[^v]+")
|
||||
local version_ge_1_14_0 = api.compare_versions(singbox_version, ">=", "1.14.0")
|
||||
|
||||
o = s:option(ListValue, "protocol", translate("Protocol"))
|
||||
o:value("socks", "Socks")
|
||||
@@ -68,6 +69,9 @@ o:value("ssh", "SSH")
|
||||
if singbox_tags:find("with_naive_outbound") then
|
||||
o:value("naive", "NaïveProxy")
|
||||
end
|
||||
if version_ge_1_14_0 then
|
||||
o:value("snell", "Snell")
|
||||
end
|
||||
o:value("_urltest", translate("URLTest"))
|
||||
o:value("_shunt", translate("Shunt"))
|
||||
o:value("_iface", translate("Custom Interface"))
|
||||
@@ -237,6 +241,43 @@ o:depends({ protocol = "anytls" })
|
||||
o:depends({ protocol = "ssh" })
|
||||
o:depends({ protocol = "naive" })
|
||||
|
||||
if version_ge_1_14_0 then
|
||||
-- snell
|
||||
s.fields["password"]:depends({ protocol = "snell" })
|
||||
|
||||
o = s:option(Value, "snell_psk", translate("Pre shared key"))
|
||||
o.rmempty = false
|
||||
o:depends({ protocol = "snell" })
|
||||
|
||||
o = s:option(ListValue, "snell_version", translate("Version"))
|
||||
o:value("4")
|
||||
o:value("6")
|
||||
o:depends({ protocol = "snell" })
|
||||
|
||||
o = s:option(Flag, "snell_reuse", translate("reuse"))
|
||||
o:depends({ protocol = "snell" })
|
||||
|
||||
o = s:option(ListValue, "snell_network", translate("Transport"))
|
||||
o:value("", "TCP UDP")
|
||||
o:value("tcp", "TCP")
|
||||
o:value("udp", "UDP")
|
||||
o:depends({ protocol = "snell" })
|
||||
|
||||
o = s:option(ListValue, "snell_obfs_mode", translate("Camouflage Type"))
|
||||
o:value("none")
|
||||
o:value("http")
|
||||
o:depends({ protocol = "snell", snell_version = "4" })
|
||||
|
||||
o = s:option(Value, "snell_obfs_host", translate("HTTP Host"))
|
||||
o:depends({ protocol = "snell", snell_version = "4", snell_obfs_mode = "http" })
|
||||
|
||||
o = s:option(ListValue, "snell_mode", translate("Mode"))
|
||||
o:value("default")
|
||||
o:value("unshaped")
|
||||
o:value("unsafe-raw")
|
||||
o:depends({ protocol = "snell", snell_version = "6" })
|
||||
end
|
||||
|
||||
o = s:option(ListValue, "security", translate("Encrypt Method"))
|
||||
for a, t in ipairs(security_list) do o:value(t) end
|
||||
o:depends({ protocol = "vmess" })
|
||||
@@ -400,7 +441,7 @@ if singbox_tags:find("with_quic") then
|
||||
|
||||
o = s:option(Flag, "hysteria2_realms", translate("Realms"))
|
||||
o.default = "0"
|
||||
if api.compare_versions(singbox_version, ">=", "1.14.0") then
|
||||
if version_ge_1_14_0 then
|
||||
o:depends({ protocol = "hysteria2"})
|
||||
else
|
||||
o:depends({ protocol = "__hide"})
|
||||
|
||||
@@ -2,6 +2,7 @@ local api = require "luci.passwall2.api"
|
||||
api.set_default_cbi()
|
||||
|
||||
m = Map(api.s_config)
|
||||
m.redirect = api.url("server")
|
||||
|
||||
t = m:section(NamedSection, "global", "global", translate("Server-Side"))
|
||||
t.anonymous = true
|
||||
|
||||
@@ -27,6 +27,9 @@ s.option_prefix = "singbox_"
|
||||
|
||||
local singbox_tags = luci.sys.exec(singbox_bin .. " version | grep 'Tags:' | awk '{print $2}'")
|
||||
|
||||
local local_version = api.get_app_version("sing-box"):match("[^v]+")
|
||||
local version_ge_1_14_0 = api.compare_versions(local_version, ">=", "1.14.0")
|
||||
|
||||
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"
|
||||
@@ -56,6 +59,7 @@ o.custom_write = function(self, section, value)
|
||||
end
|
||||
|
||||
o = s:option(ListValue, "protocol", translate("Protocol"))
|
||||
o:value("direct", "Direct")
|
||||
o:value("mixed", "Mixed")
|
||||
o:value("socks", "Socks")
|
||||
o:value("http", "HTTP")
|
||||
@@ -64,28 +68,9 @@ o:value("vmess", "Vmess")
|
||||
o:value("vless", "VLESS")
|
||||
o:value("trojan", "Trojan")
|
||||
o:value("naive", "Naive")
|
||||
if singbox_tags:find("with_quic") then
|
||||
o:value("hysteria", "Hysteria")
|
||||
end
|
||||
if singbox_tags:find("with_quic") then
|
||||
o:value("tuic", "TUIC")
|
||||
end
|
||||
if singbox_tags:find("with_quic") then
|
||||
o:value("hysteria2", "Hysteria2")
|
||||
end
|
||||
o:value("anytls", "AnyTLS")
|
||||
if singbox_tags:find("with_wireguard") then
|
||||
o:value("wireguard", "WireGuard")
|
||||
end
|
||||
o:value("direct", "Direct")
|
||||
o:depends({ custom = false })
|
||||
|
||||
o = s:option(DummyValue, "is_endpoint", "")
|
||||
o.not_rewrite = true
|
||||
o.template = m:template_path("/cbi/hidevalue")
|
||||
o.value = "1"
|
||||
o:depends({ custom = false, protocol = "wireguard" })
|
||||
|
||||
o = s:option(Value, "port", translate("Listen Port"))
|
||||
o.datatype = "port"
|
||||
o:depends({ custom = false })
|
||||
@@ -102,13 +87,13 @@ o:depends({ protocol = "vmess" })
|
||||
o:depends({ protocol = "vless" })
|
||||
o:depends({ protocol = "trojan" })
|
||||
o:depends({ protocol = "naive" })
|
||||
o:depends({ protocol = "hysteria" })
|
||||
o:depends({ protocol = "tuic" })
|
||||
o:depends({ protocol = "hysteria2" })
|
||||
o:depends({ protocol = "anytls" })
|
||||
o:depends({ protocol = "wireguard" })
|
||||
|
||||
if singbox_tags:find("with_quic") then
|
||||
-- hysteria
|
||||
s.fields["protocol"]:value("hysteria", "Hysteria")
|
||||
s.fields["users"]:depends({ protocol = "hysteria" })
|
||||
|
||||
o = s:option(Value, "hysteria_obfs", translate("Obfs Password"))
|
||||
o:depends({ protocol = "hysteria" })
|
||||
|
||||
@@ -135,6 +120,10 @@ if singbox_tags:find("with_quic") then
|
||||
end
|
||||
|
||||
if singbox_tags:find("with_quic") then
|
||||
-- tuic
|
||||
s.fields["protocol"]:value("tuic", "TUIC")
|
||||
s.fields["users"]:depends({ protocol = "tuic" })
|
||||
|
||||
o = s:option(ListValue, "tuic_congestion_control", translate("Congestion control algorithm"))
|
||||
o.default = "cubic"
|
||||
o:value("bbr", translate("BBR"))
|
||||
@@ -166,6 +155,10 @@ if singbox_tags:find("with_quic") then
|
||||
end
|
||||
|
||||
if singbox_tags:find("with_quic") then
|
||||
-- hysteria2
|
||||
s.fields["protocol"]:value("hysteria2", "Hysteria2")
|
||||
s.fields["users"]:depends({ protocol = "hysteria2" })
|
||||
|
||||
o = s:option(Flag, "hysteria2_realms", translate("Realms"))
|
||||
o.default = "0"
|
||||
o:depends({ protocol = "hysteria2"})
|
||||
@@ -435,6 +428,10 @@ o.default = "50"
|
||||
o:depends({ tcpbrutal = true })
|
||||
|
||||
if singbox_tags:find("with_wireguard") then
|
||||
-- wireguard
|
||||
s.fields["protocol"]:value("wireguard", "WireGuard")
|
||||
s.fields["users"]:depends({ protocol = "wireguard" })
|
||||
|
||||
o = s:option(Flag, "wireguard_system_interface", translate("System interface"))
|
||||
o.default = 0
|
||||
o:depends({ protocol = "wireguard" })
|
||||
@@ -459,6 +456,32 @@ if singbox_tags:find("with_wireguard") then
|
||||
o:depends({ protocol = "wireguard" })
|
||||
end
|
||||
|
||||
if version_ge_1_14_0 then
|
||||
-- snell
|
||||
s.fields["protocol"]:value("snell", "Snell")
|
||||
s.fields["users"]:depends({ protocol = "snell" })
|
||||
|
||||
o = s:option(ListValue, "snell_version", translate("Version"))
|
||||
o:value("5")
|
||||
o:value("6")
|
||||
o:depends({ protocol = "snell" })
|
||||
|
||||
o = s:option(Value, "snell_psk", translate("Pre shared key"))
|
||||
o.rmempty = false
|
||||
o:depends({ protocol = "snell" })
|
||||
|
||||
o = s:option(ListValue, "snell_obfs_mode", translate("Obfs"))
|
||||
o:value("none")
|
||||
o:value("http")
|
||||
o:depends({ protocol = "snell", snell_version = "5" })
|
||||
|
||||
o = s:option(ListValue, "snell_mode", translate("Mode"))
|
||||
o:value("default")
|
||||
o:value("unshaped")
|
||||
o:value("unsafe-raw")
|
||||
o:depends({ protocol = "snell", snell_version = "6" })
|
||||
end
|
||||
|
||||
o = s:option(Flag, "firewall_allow", translate("Firewall Allow"))
|
||||
o.default = "0"
|
||||
o:depends({ custom = false })
|
||||
|
||||
@@ -667,6 +667,19 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
}
|
||||
end
|
||||
|
||||
if node.protocol == "snell" then
|
||||
protocol_table = {
|
||||
version = tonumber(node.snell_version),
|
||||
psk = node.snell_psk,
|
||||
userkey = node.password,
|
||||
reuse = node.snell_reuse == "1" and true or false,
|
||||
network = node.snell_network,
|
||||
obfs_mode = node.snell_version == "4" and node.snell_obfs_mode or nil,
|
||||
obfs_host = node.snell_version == "4" and node.snell_obfs_host or nil,
|
||||
mode = node.snell_version == "6" and node.snell_mode or nil,
|
||||
}
|
||||
end
|
||||
|
||||
if protocol_table then
|
||||
for key, value in pairs(protocol_table) do
|
||||
result[key] = value
|
||||
@@ -823,6 +836,10 @@ function gen_config_server(node)
|
||||
u.allowed_ips = user.allowed_ips or {}
|
||||
u.persistent_keepalive_interval = 0
|
||||
end
|
||||
if node.protocol == "snell" then
|
||||
u.name = user.username
|
||||
u.userkey = user.password
|
||||
end
|
||||
users[#users + 1] = u
|
||||
end
|
||||
end
|
||||
@@ -1003,6 +1020,16 @@ function gen_config_server(node)
|
||||
end
|
||||
end
|
||||
|
||||
if node.protocol == "snell" then
|
||||
protocol_table = {
|
||||
users = users,
|
||||
version = tonumber(node.snell_version),
|
||||
psk = node.snell_psk,
|
||||
obfs_mode = node.snell_version == "5" and node.snell_obfs_mode or nil,
|
||||
mode = node.snell_version == "6" and node.snell_mode or nil,
|
||||
}
|
||||
end
|
||||
|
||||
if node.protocol == "direct" then
|
||||
protocol_table = {
|
||||
network = (node.d_protocol ~= "TCP,UDP") and node.d_protocol or nil,
|
||||
|
||||
Reference in new issue
Block a user