mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-02 05:43:56 +08:00
update 2026-06-17 00:42:25
This commit is contained in:
1 parent
0bae71881b
commit
3e2b32ac97
30 files changed
+412
-298
No files matched your search
@@ -2,6 +2,15 @@
|
||||
|
||||
START=99
|
||||
|
||||
boot_func() {
|
||||
sleep 90
|
||||
restart
|
||||
}
|
||||
|
||||
boot() {
|
||||
boot_func >/dev/null 2>&1 &
|
||||
}
|
||||
|
||||
start() {
|
||||
lua /usr/lib/lua/luci/passwall2/server_app.lua start
|
||||
}
|
||||
|
||||
@@ -88,6 +88,23 @@ config shunt_rules 'Russia'
|
||||
option ip_list 'geoip:ru
|
||||
#rule-set:remote:https://raw.githubusercontent.com/runetfreedom/russia-v2ray-rules-dat/refs/heads/release/sing-box/rule-set-geoip/geoip-ru.srs'
|
||||
|
||||
config shunt_rules 'PrivateIP'
|
||||
option remarks 'PrivateIP'
|
||||
option network 'tcp,udp'
|
||||
option ip_list '10.0.0.0/8
|
||||
127.0.0.0/8
|
||||
198.51.100.0/24
|
||||
192.0.0.0/24
|
||||
169.254.0.0/16
|
||||
224.0.0.0/3
|
||||
192.168.0.0/16
|
||||
192.88.99.0/24
|
||||
100.64.0.0/10
|
||||
172.16.0.0/12
|
||||
0.0.0.0/8
|
||||
192.0.2.0/24
|
||||
203.0.113.0/24'
|
||||
|
||||
config nodes 'examplenode'
|
||||
option remarks 'Example'
|
||||
option type 'Xray'
|
||||
@@ -104,6 +121,7 @@ config nodes 'rulenode'
|
||||
option remarks 'rulenode'
|
||||
option type 'Xray'
|
||||
option protocol '_shunt'
|
||||
option PrivateIP '_direct'
|
||||
option default_node 'examplenode'
|
||||
option domainStrategy 'IPOnDemand'
|
||||
option domainMatcher 'hybrid'
|
||||
|
||||
@@ -1937,7 +1937,6 @@ local function curl(url, file, ua, mode)
|
||||
ua = (ua == "passwall2") and ("passwall2/" .. api.get_version()) or ua
|
||||
curl_args[#curl_args + 1] = '--user-agent "' .. ua .. '"'
|
||||
end
|
||||
curl_args[#curl_args + 1] = get_headers()
|
||||
local return_code, result
|
||||
if mode == "direct" then
|
||||
return_code, result = api.curl_direct(url, file, curl_args)
|
||||
@@ -1949,57 +1948,6 @@ local function curl(url, file, ua, mode)
|
||||
return return_code, tonumber(result)
|
||||
end
|
||||
|
||||
function get_headers()
|
||||
local cache_file = "/tmp/etc/" .. appname .. "_tmp/sub_curl_headers"
|
||||
if fs.access(cache_file) then
|
||||
return luci.sys.exec("cat " .. cache_file)
|
||||
end
|
||||
local headers = {}
|
||||
|
||||
local function readfile(path)
|
||||
local f = io.open(path, "r")
|
||||
if not f then return nil end
|
||||
local c = f:read("*a")
|
||||
f:close()
|
||||
return api.trim(c)
|
||||
end
|
||||
|
||||
headers[#headers + 1] = "x-device-os: OpenWrt"
|
||||
|
||||
local rel = readfile("/etc/openwrt_release")
|
||||
local os_ver = rel and rel:match("DISTRIB_RELEASE='([^']+)'")
|
||||
if os_ver then
|
||||
headers[#headers + 1] = "x-ver-os: " .. os_ver
|
||||
end
|
||||
|
||||
local model = readfile("/tmp/sysinfo/model")
|
||||
if model then
|
||||
headers[#headers + 1] = "x-device-model: " .. model
|
||||
end
|
||||
|
||||
local mac = readfile("/sys/class/net/eth0/address")
|
||||
if mac and model then
|
||||
local raw = mac .. "-" .. model
|
||||
local p = io.popen("printf '%s' '" .. raw:gsub("'", "'\\''") .. "' | sha256sum")
|
||||
if p then
|
||||
local hash = p:read("*l")
|
||||
p:close()
|
||||
hash = hash and hash:match("^%w+")
|
||||
if hash then
|
||||
headers[#headers + 1] = "x-hwid: " .. hash
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local out = {}
|
||||
for i = 1, #headers do
|
||||
out[i] = "-H '" .. headers[i]:gsub("'", "'\\''") .. "'"
|
||||
end
|
||||
local headers_str = table.concat(out, " ")
|
||||
local f = io.open(cache_file, "w"); if f then f:write(headers_str); f:close() end
|
||||
return headers_str
|
||||
end
|
||||
|
||||
local function truncate_nodes(group)
|
||||
for _, config in pairs(CONFIG) do
|
||||
if config.currentNodes and #config.currentNodes > 0 then
|
||||
|
||||
Reference in new issue
Block a user