hiddify-geo

This commit is contained in:
ElonJunior 2025-03-15 22:58:07 +08:00
parent 14d75c3d5f
commit 30f438957c
2 changed files with 38 additions and 1 deletions

View File

@ -58,6 +58,13 @@ jobs:
path: Iran-sing-box-rules path: Iran-sing-box-rules
ref: rule-set ref: rule-set
- name: Checkout hiddify-geo
uses: actions/checkout@v4
with:
repository: hiddify/hiddify-geo
path: hiddify-geo
ref: rule-set
- name: IR copy geo rules - name: IR copy geo rules
env: env:
NO_SKIP: true NO_SKIP: true

View File

@ -20,6 +20,9 @@ work_dir=$(realpath "$target_dir")
target_dir="${work_dir}/chinese" target_dir="${work_dir}/chinese"
sing_exe="${work_dir}/sing-box" sing_exe="${work_dir}/sing-box"
LOG_FILE="merge.log"
# cat /dev/null > $LOG_FILE
# ——————————————————————————————————————————————————————————————————————————————————————————————— # ———————————————————————————————————————————————————————————————————————————————————————————————
@ -69,6 +72,32 @@ function download_adblockfilters() {
} }
function merge_hiddify_geo(){
src_dir=$(dirname $work_dir)/hiddify-geo/country
LOG_FILE="${work_dir}/geo/${LOG_FILE}"
echo "merge dir >> ${src_dir}"
# 遍历country目录下所有以geoip或geosite开头的.srs文件
for file1 in $(ls $src_dir/geo*-*.srs); do
filename1=${file1##*/}
# 修正2移除多余的$$符号
caty=${filename1%%-*} # 截取第一个"-"前的部分
country=${filename1#*-} # 截取第一个"-"后的部分
# echo "类型: $caty, 国家代码: $country"
# Check if file exists in folder b with the same name
file2="$work_dir/geo/$caty/$country"
# If file not found, print filename
if [ ! -f $file2 ]; then
cp $file1 $file2
echo "hiddify-geo/country/${filename1}" >> $LOG_FILE
fi
done
}
# ——————————————————————————————————————————————————————————————————————————————————————————————— # ———————————————————————————————————————————————————————————————————————————————————————————————
chmod +x $sing_exe chmod +x $sing_exe
@ -76,7 +105,8 @@ chmod +x $sing_exe
mkdir $target_dir ; cd $target_dir mkdir $target_dir ; cd $target_dir
echo "start<= ${target_dir}" echo "start<= ${target_dir}"
download_adblockfilters # download_adblockfilters
merge_hiddify_geo
echo "end<= ${target_dir}" echo "end<= ${target_dir}"
#END FILE #END FILE