From f45297afe2c8734b49cfba23d697be25d2abbd96 Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Sat, 11 Nov 2023 22:34:30 +0300 Subject: [PATCH] update readme && updater example --- README.md | 22 ++++++++++++++++++++-- update.sh | 13 +++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100755 update.sh diff --git a/README.md b/README.md index 4ed707a..ea3e496 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# GeoIP & GeoSite with RU blacklist +# GeoIP & GeoSite with RU Blacklist Generates `geoip.dat` and `geosite.dat` for Xray with additional data: - Category with sites blocked in Russia (`geosite:category-ru-blocked-domains`). @@ -6,4 +6,22 @@ Generates `geoip.dat` and `geosite.dat` for Xray with additional data: Data sources: - [v2fly/geoip](https://github.com/v2fly/geoip) for `geoip.dat`. -- [v2fly/domain-list-community](https://github.com/v2fly/domain-list-community) for `geosite.dat`. \ No newline at end of file +- [v2fly/domain-list-community](https://github.com/v2fly/domain-list-community) for `geosite.dat`. + +You can replace original `geoip.dat` and `geosite.dat` with the ones from this repo and route only blocked traffic through the proxy. + +# GeoIP Categories + +- `geoip:ru-blocked-ips-all` - IP's and IP ranges blocked in Russia. +- `geoip:ru-blocked-ips-directblock` - IP's blocked in Russia directly by address. +- `geoip:ru-blocked-ips-noid2971` - IP's and IP ranges blocked in Russia excluding those blocked by 33а-5536/2019. + +# GeoSite Categories + +- `geosite:category-ru-blocked-domains` - domains and subdomains blocked in Russia. +- `geosite:category-ru-blocked-zones` - only second-level domains blocked in Russia (even if only subdomain was blocked). + +# Automatic Update + +There is no universal recipe. Just download `geoip.dat` and `geosite.dat` from latest release daily and replace old files with the new ones. +You can find an example of how to get the latest files in the [`update.sh`](./update.sh). And please, for the love of all that is holy, **don't put** `curl -fsSL ... | bash` to your crontab, **it's not safe**. diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..92a2cb9 --- /dev/null +++ b/update.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -euxo pipefail; +current=`curl 'https://gitea.neur0tx.site/api/v1/repos/xray-addons/geoip-geosite-with-ru-blocklist/releases/latest'` +geoipUrl=`echo "$current" | jq -r '.assets | map( { (.name|tostring): . } ) | add | ."geoip.dat".browser_download_url'` +geositeUrl=`echo "$current" | jq -r '.assets | map( { (.name|tostring): . } ) | add | ."geosite.dat".browser_download_url'` +[ -f geoip.dat ] && mv geoip.dat geoip.dat.bak +[ -f geosite.dat ] && mv geosite.dat geosite.dat.bak +curl -fsSL "$geoipUrl" -o geoip.dat +curl -fsSL "$geositeUrl" -o geosite.dat +[ -f geoip.dat ] && [ -f geoip.dat.bak ] && rm geoip.dat.bak +[ -f geosite.dat ] && [ -f geosite.dat.bak ] && rm geosite.dat.bak +[ ! -f geoip.dat ] && mv geoip.dat.bak geoip.dat +[ ! -f geosite.dat ] && mv geosite.dat.bak geosite.dat