add_archive_project

This commit is contained in:
2026-04-04 13:25:49 +04:00
commit 810b3b1372
17 changed files with 642 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#!/bin/sh
/etc/init.d/xray running 2>/dev/null
if [ $? -ne 0 ]; then
exit 0
fi
ipnet_dir="/etc/xray/ipnet"
dnsmasq_dir="/etc/dnsmasq.d"
nft_table="xray"
nft_sets=$(
nft list table ip "$nft_table" \
| grep 'set ' \
| grep '{' \
| awk '{print $2}'
)
for set in $nft_sets; do
nft list set ip $nft_table $set >/dev/null 2>&1 && nft flush set ip $nft_table $set
done
nft list table ip $nft_table >/dev/null 2>&1 && nft delete table ip $nft_table
ip rule show | grep -q "fwmark 0xa lookup 110" && ip rule del fwmark 10 table 110
ip route show table 110 | grep -q "local default" && ip route del local default dev lo table 110
for f in "$dnsmasq_dir"/xray_domain*; do
[ -f "$f" ] || continue
rm "$f"
done
find "$ipnet_dir" -type f -exec rm -f {} \;
service dnsmasq restart >/dev/null 2>&1
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
common_dir="/etc/xray/common"
ipnet_dir="/etc/xray/ipnet"
sh $common_dir/check.sh
nft -f $common_dir/nft.conf
sh $common_dir/prepare_domain.sh
sh $common_dir/prepare_net.sh
for ipnet_file in "$ipnet_dir"/*; do
[ -f "$ipnet_file" ] || continue
if ! nft -f "$ipnet_file"; then
logger -t xray-startup "$ipnet_file: apply failed"
fi
done
ip route show table 110 | grep -q "local default" || ip route add local default dev lo table 110
ip rule show | grep -q "fwmark 0xa lookup 110" || ip rule add fwmark 10 table 110
service dnsmasq restart >/dev/null 2>&1
+76
View File
@@ -0,0 +1,76 @@
#!/bin/sh
ipset_dir="/etc/xray/ipset"
dnsmasq_dir="/etc/dnsmasq.d"
common_dir="/etc/xray/common"
sh $common_dir/check.sh
xray_ip="
https://raw.githubusercontent.com/1andrevich/Re-filter-lists/refs/heads/main/community_ips.lst
https://raw.githubusercontent.com/1andrevich/Re-filter-lists/refs/heads/main/discord_ips.lst
https://raw.githubusercontent.com/1andrevich/Re-filter-lists/refs/heads/main/ipsum.lst
https://raw.githubusercontent.com/123jjck/cdn-ip-ranges/refs/heads/main/all/all_plain_ipv4.txt
https://raw.githubusercontent.com/fernvenue/telegram-cidr-list/refs/heads/master/CIDRv4.txt
"
xray_ip_whitelist=""
xray_domain="
https://raw.githubusercontent.com/v2ray/domain-list-community/refs/heads/master/data/spotify
https://raw.githubusercontent.com/v2ray/domain-list-community/refs/heads/master/data/microsoft
https://raw.githubusercontent.com/v2ray/domain-list-community/refs/heads/master/data/openai
"
xray_domain_whitelist=""
download_lists() {
local urls="$1"
local prefix="$2"
local suffix="$3"
[ -z "$(echo "$urls" | tr -d '[:space:]')" ] && return
for url in $urls; do
[ -z "$url" ] && continue
base_name=$(basename "$url")
clean_name="${base_name%.*}"
filename="${prefix}${clean_name}${suffix}.lst"
target_path="$ipset_dir/$filename"
curl -L -s -o "$target_path.tmp" "$url"
if [ $? -eq 0 ]; then
if echo "$prefix" | grep -q "domain"; then
sed -i -E \
-e '/^regexp:/d' \
-e '/^include:/d' \
-e '/^#/d' \
-e '/^$/d' \
-e '/@cn$/d' \
-e '/@ads$/d' \
-e 's/^full://' \
-e 's/[[:space:]].*//' \
-e '/\./!d' \
"$target_path.tmp"
fi
mv "$target_path.tmp" "$target_path"
else
logger -t xray-updater "$url: failed to download"
fi
done
}
find "$ipset_dir" -type f ! -name "*user*" -exec rm -f {} \;
download_lists "$xray_ip" "xray_ip_" ""
download_lists "$xray_ip_whitelist" "xray_ip_" "_whitelist"
download_lists "$xray_domain" "xray_domain_" ""
download_lists "$xray_domain_whitelist" "xray_domain_" "_whitelist"
if /etc/init.d/xray status >/dev/null 2>&1; then
/etc/init.d/xray restart
else
/etc/init.d/xray start
fi