mirror of
https://github.com/itdoginfo/allow-domains.git
synced 2026-03-25 18:19:43 +03:00
Feat: add mihomo MRS format
This commit is contained in:
15
.github/workflows/create-lists.yml
vendored
15
.github/workflows/create-lists.yml
vendored
@@ -34,6 +34,20 @@ jobs:
|
||||
wget -qO- https://github.com/SagerNet/sing-box/releases/download/v1.12.25/sing-box-1.12.25-linux-amd64.tar.gz | tar xz
|
||||
sudo mv sing-box-*/sing-box /usr/local/bin/
|
||||
|
||||
- name: Cache mihomo
|
||||
uses: actions/cache@v5.0.3
|
||||
id: cache-mihomo
|
||||
with:
|
||||
path: /usr/local/bin/mihomo
|
||||
key: mihomo-1.19.8
|
||||
|
||||
- name: Install mihomo
|
||||
if: steps.cache-mihomo.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
wget -qO- https://github.com/MetaCubeX/mihomo/releases/download/v1.19.8/mihomo-linux-amd64-v1.19.8.gz | gunzip > mihomo
|
||||
chmod +x mihomo
|
||||
sudo mv mihomo /usr/local/bin/
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: pip install -r requirements.txt
|
||||
|
||||
@@ -88,5 +102,6 @@ jobs:
|
||||
with:
|
||||
files: |
|
||||
${{ github.workspace }}/SRS/*.srs
|
||||
${{ github.workspace }}/MRS/*.mrs
|
||||
${{ github.workspace }}/DAT/*.dat
|
||||
tag_name: ${{ env.TAG_NAME }}
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@ antifilter-domains.lst
|
||||
uablacklist-domains.lst
|
||||
zaboronahelp-domains.lst
|
||||
SRS
|
||||
MRS
|
||||
JSON
|
||||
DAT
|
||||
geosite_data
|
||||
|
||||
36
README.md
36
README.md
@@ -7,6 +7,7 @@
|
||||
- Dnsmasq ipset. Для Dnsmasq в формате ipset (OpenWrt <= 21.02) `ipset=/showip.net/vpn_domains`
|
||||
- Sing-box Source. Для Sing-box версии 1.11.0 и выше.
|
||||
- Xray Dat. Общий файл geosite.dat с разбивкой по категориям.
|
||||
- Mihomo MRS. Бинарные rule-set для Mihomo (Clash Meta). Файлы с суффиксом `_domain` для доменов, `_ipcidr` для подсетей.
|
||||
- ClashX `DOMAIN-SUFFIX,showip.net`
|
||||
- Mikrotik FWD `/ip dns static add name=fast.com type=FWD...`
|
||||
- Kvas. Для Kvas 1.1.8 и новее. Просто отсортированный список доменов.
|
||||
@@ -75,6 +76,7 @@
|
||||
- [Kvas](https://raw.githubusercontent.com/itdoginfo/allow-domains/main/Russia/inside-kvas.lst)
|
||||
- [Mikrotik](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Russia/inside-mikrotik-fwd.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/russia_inside.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/russia_inside_domain.mrs)
|
||||
- geosite:russia-inside
|
||||
|
||||
</details>
|
||||
@@ -89,6 +91,7 @@
|
||||
- [Kvas](https://raw.githubusercontent.com/itdoginfo/allow-domains/main/Russia/outside-kvas.lst)
|
||||
- [Mikrotik](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Russia/outside-mikrotik-fwd.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/russia_outside.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/russia_outside_domain.mrs)
|
||||
- geosite:russia-outside
|
||||
|
||||
</details>
|
||||
@@ -102,6 +105,7 @@
|
||||
- [Kvas](https://raw.githubusercontent.com/itdoginfo/allow-domains/main/Ukraine/inside-kvas.lst)
|
||||
- [Mikrotik](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Ukraine/inside-mikrotik-fwd.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/ukraine_inside.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/ukraine_inside_domain.mrs)
|
||||
- geosite:ukraine
|
||||
|
||||
</details>
|
||||
@@ -111,6 +115,7 @@
|
||||
|
||||
- [RAW](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Categories/anime.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/anime.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/anime_domain.mrs)
|
||||
- geosite:russia-inside@anime
|
||||
|
||||
</details>
|
||||
@@ -120,6 +125,7 @@
|
||||
|
||||
- [RAW](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Categories/block.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/block.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/block_domain.mrs)
|
||||
- geosite:russia-inside@block
|
||||
|
||||
</details>
|
||||
@@ -129,6 +135,7 @@
|
||||
|
||||
- [RAW](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Categories/geoblock.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/geoblock.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/geoblock_domain.mrs)
|
||||
- geosite:russia-inside@geoblock
|
||||
|
||||
</details>
|
||||
@@ -138,6 +145,7 @@
|
||||
|
||||
- [RAW](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Categories/news.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/news.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/news_domain.mrs)
|
||||
- geosite:russia-inside@news
|
||||
|
||||
</details>
|
||||
@@ -147,6 +155,7 @@
|
||||
|
||||
- [RAW](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Categories/porn.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/porn.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/porn_domain.mrs)
|
||||
- geosite:russia-inside@porn
|
||||
|
||||
</details>
|
||||
@@ -156,6 +165,7 @@
|
||||
|
||||
- [RAW](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Categories/hodca.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/hodca.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/hodca_domain.mrs)
|
||||
- geosite:russia-inside@hodca
|
||||
|
||||
</details>
|
||||
@@ -165,6 +175,8 @@
|
||||
|
||||
- [Subnets](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Subnets/IPv4/cloudflare.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/cloudflare.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/cloudflare_domain.mrs)
|
||||
- [MRS ipcidr](https://github.com/itdoginfo/allow-domains/releases/latest/download/cloudflare_ipcidr.mrs)
|
||||
|
||||
</details>
|
||||
|
||||
@@ -174,6 +186,8 @@
|
||||
- [RAW](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Services/discord.lst)
|
||||
- [Subnets](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Subnets/IPv4/discord.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/discord.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/discord_domain.mrs)
|
||||
- [MRS ipcidr](https://github.com/itdoginfo/allow-domains/releases/latest/download/discord_ipcidr.mrs)
|
||||
|
||||
</details>
|
||||
|
||||
@@ -182,6 +196,7 @@
|
||||
|
||||
- [RAW](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Services/hdrezka.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/hdrezka.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/hdrezka_domain.mrs)
|
||||
- geosite:russia-inside@hdrezka
|
||||
|
||||
</details>
|
||||
@@ -192,6 +207,8 @@
|
||||
- [RAW](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Services/meta.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/meta.srs)
|
||||
- [Subnets](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Subnets/IPv4/meta.lst)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/meta_domain.mrs)
|
||||
- [MRS ipcidr](https://github.com/itdoginfo/allow-domains/releases/latest/download/meta_ipcidr.mrs)
|
||||
- geosite:russia-inside@meta
|
||||
|
||||
</details>
|
||||
@@ -202,6 +219,8 @@
|
||||
- [RAW](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Services/telegram.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/telegram.srs)
|
||||
- [Subnets](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Subnets/IPv4/telegram.lst)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/telegram_domain.mrs)
|
||||
- [MRS ipcidr](https://github.com/itdoginfo/allow-domains/releases/latest/download/telegram_ipcidr.mrs)
|
||||
|
||||
</details>
|
||||
|
||||
@@ -210,6 +229,7 @@
|
||||
|
||||
- [RAW](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Services/tiktok.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/tiktok.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/tiktok_domain.mrs)
|
||||
- geosite:russia-inside@tiktok
|
||||
|
||||
</details>
|
||||
@@ -220,6 +240,8 @@
|
||||
- [RAW](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Services/twitter.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/twitter.srs)
|
||||
- [Subnets](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Subnets/IPv4/twitter.lst)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/twitter_domain.mrs)
|
||||
- [MRS ipcidr](https://github.com/itdoginfo/allow-domains/releases/latest/download/twitter_ipcidr.mrs)
|
||||
- geosite:russia-inside@twitter
|
||||
|
||||
</details>
|
||||
@@ -229,16 +251,18 @@
|
||||
|
||||
- [RAW](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Services/youtube.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/youtube.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/youtube_domain.mrs)
|
||||
- geosite:russia-inside@youtube
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
<details>
|
||||
<summary>Google Meet</summary>
|
||||
|
||||
- [Subnets](https://raw.githubusercontent.com/itdoginfo/allow-domains/refs/heads/main/Subnets/IPv4/google_meet.lst)
|
||||
- [SRS](https://github.com/itdoginfo/allow-domains/releases/latest/download/google_meet.srs)
|
||||
- [MRS domain](https://github.com/itdoginfo/allow-domains/releases/latest/download/google_meet_domain.mrs)
|
||||
- [MRS ipcidr](https://github.com/itdoginfo/allow-domains/releases/latest/download/google_meet_ipcidr.mrs)
|
||||
|
||||
</details>
|
||||
|
||||
@@ -303,6 +327,16 @@ service firewall restart && service dnsmasq restart
|
||||
|
||||
*Meta признана экстремистской и террористической организацией в России
|
||||
|
||||
# Разработка
|
||||
|
||||
```bash
|
||||
nix-shell
|
||||
|
||||
python3 get-subnets.py
|
||||
|
||||
python3 convert.py
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
[Telegram-канал с обновлениями](https://t.me/itdoginfo)
|
||||
|
||||
42
convert.py
42
convert.py
@@ -101,6 +101,25 @@ def lines_from_file(filepath):
|
||||
with open(filepath, 'r', encoding='utf-8') as f:
|
||||
return [line.strip() for line in f if line.strip()]
|
||||
|
||||
def compile_mrs(domains, name, mrs_dir='MRS', behavior='domain'):
|
||||
os.makedirs(mrs_dir, exist_ok=True)
|
||||
|
||||
txt_path = os.path.join(mrs_dir, f"{name}.txt")
|
||||
mrs_path = os.path.join(mrs_dir, f"{name}.mrs")
|
||||
|
||||
with open(txt_path, 'w', encoding='utf-8') as f:
|
||||
for d in domains:
|
||||
f.write(f"{d}\n")
|
||||
|
||||
try:
|
||||
subprocess.run(
|
||||
["mihomo", "convert-ruleset", behavior, "text", txt_path, mrs_path], check=True
|
||||
)
|
||||
print(f"Compiled: {mrs_path}")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Compile error {txt_path}: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
def compile_srs(data, name, json_dir='JSON', srs_dir='SRS'):
|
||||
os.makedirs(json_dir, exist_ok=True)
|
||||
os.makedirs(srs_dir, exist_ok=True)
|
||||
@@ -315,6 +334,29 @@ if __name__ == '__main__':
|
||||
{"network": ["udp"], "ip_cidr": discord_subnets, "port_range": ["50000:65535"]},
|
||||
])
|
||||
|
||||
# Mihomo main
|
||||
to_mrs = lambda domains: [f'+.{d.lstrip(".")}' for d in domains]
|
||||
mrs_russia_inside = to_mrs(russia_inside)
|
||||
mrs_russia_outside = to_mrs(russia_outside)
|
||||
mrs_ukraine_inside = to_mrs(ukraine_inside)
|
||||
compile_mrs(mrs_russia_inside, 'russia_inside_domain')
|
||||
compile_mrs(mrs_russia_outside, 'russia_outside_domain')
|
||||
compile_mrs(mrs_ukraine_inside, 'ukraine_inside_domain')
|
||||
|
||||
# Mihomo categories
|
||||
for directory in ['Categories', 'Services']:
|
||||
for filename in os.listdir(directory):
|
||||
file_path = os.path.join(directory, filename)
|
||||
if os.path.isfile(file_path):
|
||||
domains = to_mrs(lines_from_file(file_path))
|
||||
name = os.path.splitext(filename)[0]
|
||||
compile_mrs(domains, f'{name}_domain')
|
||||
|
||||
# Mihomo subnets
|
||||
for service in SUBNET_SERVICES:
|
||||
subnets = lines_from_file(f'Subnets/IPv4/{service}.lst')
|
||||
compile_mrs(subnets, f'{service}_ipcidr', behavior='ipcidr')
|
||||
|
||||
# Xray domains
|
||||
prepare_dat_domains(russia_inside, 'russia-inside', directories)
|
||||
prepare_dat_domains(russia_outside, 'russia-outside')
|
||||
|
||||
@@ -6,11 +6,13 @@ pkgs.mkShell {
|
||||
python312Packages.tldextract
|
||||
python312Packages.protobuf
|
||||
sing-box
|
||||
mihomo
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
echo "Environment ready!"
|
||||
echo "Python version: $(python --version)"
|
||||
echo "sing-box version: $(sing-box version 2>/dev/null || echo 'not available')"
|
||||
echo "mihomo version: $(mihomo -v 2>/dev/null || echo 'not available')"
|
||||
'';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user