#!/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