This commit is contained in:
parent
e613460912
commit
1f189a1f62
26
.drone.yml
Normal file
26
.drone.yml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: generate
|
||||||
|
image: ubuntu:latest
|
||||||
|
commands:
|
||||||
|
- apt install -y idn sipcalc gawk git golang-1.20
|
||||||
|
- bash generate.sh
|
||||||
|
- name: release
|
||||||
|
image: plugins/gitea-release
|
||||||
|
settings:
|
||||||
|
api_key:
|
||||||
|
from_secret: gitea_api_key
|
||||||
|
base_url: https://gitea.neur0tx.site
|
||||||
|
files: .temp/result/*
|
||||||
|
checksum:
|
||||||
|
- sha256
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- push
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.temp
|
||||||
|
.tool-versions
|
10
README.md
10
README.md
@ -1,3 +1,9 @@
|
|||||||
# ru-blocklist
|
# GeoIP & GeoSite with RU blacklist
|
||||||
|
|
||||||
Generates ru-blocked-dlc.dat and ru-blocked-ips.dat files which can be used in Xray config to route only blocked domains & ips via proxy.
|
Generates `geoip.dat` and `geosite.dat` for Xray with additional data:
|
||||||
|
- Category with sites blocked in Russia (`geosite:category-ru-blocked-domains`).
|
||||||
|
- category with second-level domains of sites blocked in Russia (`geosite:category-ru-blocked-zones`).
|
||||||
|
|
||||||
|
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`.
|
13
data/az-cyrillic-idn-fix.patch
Normal file
13
data/az-cyrillic-idn-fix.patch
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/parse.sh b/parse.sh
|
||||||
|
index c15aba6..c840f3f 100755
|
||||||
|
--- a/parse.sh
|
||||||
|
+++ b/parse.sh
|
||||||
|
@@ -7,7 +7,7 @@ HERE="$(dirname "$(readlink -f "${0}")")"
|
||||||
|
cd "$HERE"
|
||||||
|
|
||||||
|
# Extract domains from list
|
||||||
|
-awk -F ';' '{print $2}' temp/list.csv | sort -u | awk '/^$/ {next} /\\/ {next} /^[а-яА-Яa-zA-Z0-9\-\_\.\*]*+$/ {gsub(/\*\./, ""); gsub(/\.$/, ""); print}' | CHARSET=UTF-8 idn > result/hostlist_original.txt
|
||||||
|
+awk -F ';' '{print $2}' temp/list.csv | sort -u | awk '/^$/ {next} /\\/ {next} /^[а-яА-Яa-zA-Z0-9\-\_\.\*]*+$/ {gsub(/\*\./, ""); gsub(/\.$/, ""); print}' | grep -Fv 'bеllonа' | CHARSET=UTF-8 idn > result/hostlist_original.txt
|
||||||
|
|
||||||
|
# Generate zones from domains
|
||||||
|
# FIXME: nxdomain list parsing is disabled due to its instability on z-i
|
32
data/geoip-generator-config.json
Normal file
32
data/geoip-generator-config.json
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"input": [
|
||||||
|
{
|
||||||
|
"type": "v2rayGeoIPDat",
|
||||||
|
"action": "add",
|
||||||
|
"args": {
|
||||||
|
"uri": "./geoip-src.dat"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"action": "add",
|
||||||
|
"args": {
|
||||||
|
"inputDir": "./data"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"output": [
|
||||||
|
{
|
||||||
|
"type": "v2rayGeoIPDat",
|
||||||
|
"action": "output",
|
||||||
|
"args": {
|
||||||
|
"outputName": "geoip.dat"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"action": "output"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
28
generate.sh
Executable file
28
generate.sh
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euxo pipefail
|
||||||
|
mkdir -p .temp/result
|
||||||
|
[ ! -d .temp/az ] && \
|
||||||
|
git clone --depth=1 https://bitbucket.org/anticensority/antizapret-pac-generator-light.git .temp/az && \
|
||||||
|
cd .temp/az && \
|
||||||
|
patch < ../../data/az-cyrillic-idn-fix.patch && \
|
||||||
|
bash update.sh && \
|
||||||
|
bash parse.sh && \
|
||||||
|
cd ../..
|
||||||
|
[ ! -d .temp/geoip ] && \
|
||||||
|
git clone --depth=1 https://github.com/v2fly/geoip.git .temp/geoip && \
|
||||||
|
cat data/geoip-generator-config.json > .temp/geoip/config.json && \
|
||||||
|
cd .temp/geoip && \
|
||||||
|
([ ! -f geoip-src.dat ] && curl -fsSL https://github.com/v2fly/geoip/releases/latest/download/geoip.dat -o geoip-src.dat) && \
|
||||||
|
mkdir -p data && \
|
||||||
|
cp ../az/result/iplist_all.txt data/ru-blocked-ips-all && \
|
||||||
|
cp ../az/result/iplist_blockedbyip.txt data/ru-blocked-ips-directblock && \
|
||||||
|
cp ../az/result/iplist_blockedbyip_noid2971.txt data/ru-blocked-ips-noid2971 && \
|
||||||
|
go run ./ && \
|
||||||
|
mv output/dat/geoip.dat ../result/ && \
|
||||||
|
cd ../..
|
||||||
|
[ ! -d .temp/geosite ] && \
|
||||||
|
git clone --depth=1 https://github.com/v2fly/domain-list-community.git .temp/geosite && \
|
||||||
|
cd .temp/geosite && \
|
||||||
|
cp ../az/result/hostlist_zones.txt data/category-ru-blocked-zones && \
|
||||||
|
cp ../az/result/hostlist_original.txt data/category-ru-blocked-domains && \
|
||||||
|
go run ./ --outputdir=../result --outputname=geosite.dat
|
Loading…
Reference in New Issue
Block a user