/Iran-clash-rules

Enhanced Clash and Clash.Meta routing rules with Iranian domains ruleset and a focus on security and adblocking.

Primary LanguageShellGNU General Public License v3.0GPL-3.0

a logo for iran clash rules in both dark and light mode

GitHub Workflow Status GitHub release GitHub Release Date License

✍️ Introduction

An enhanced and All-in-One set of geo-location routing files optimized for Iranian users to use in Clash/Clash.Meta.

💡 For V2Ray geolocation rules please refer to Iran V2Ray Rules
💡 For Sing-Box geolocation rules please refer to Iran Sing-Box Rules

📃 Categories

Important

There are two clash rule formats, text and yaml. text is preferred as it's faster to process by Clash and is supported in Clash Premium 1.15.0+ and clash.Meta 1.14.4+ . If you are using an older version of Clash/Clash.Meta, you should use yaml format.

Classical Rules

  • apps.txt, apps.yaml
    Contains a list of Persian Android apps.

  • irasn.txt, irasn.yaml
    Contains a list of Iran ASN numbers.

Domain Rules

  • ir.txt, ir.yaml
    Contains non-ir TLD Iranian domains (e.g. .com .net .org etc.) and rules to bypass all .ir domains.

  • ir-lite.txt, ir-lite.yaml
    Contains Active non-ir TLD Iranian domains (e.g. .com .net .org etc.) and rules to bypass all .ir domains.

  • ads.txt, ads.yaml
    Contains a list of Persian advertisement and tracking domains.

  • category-ads-all.txt, category-ads-all.yaml
    Contains a curated list of Persian and Foreign advertisement and tracking domains based on multiple sources. It is optimized to has as low as possible false positives while also retain small size and efficiency.

  • malware.txt, malware.yaml
    Contains a list of active malware domains.

  • phishing.txt, phishing.yaml
    Contains a list of scam and phishing domains.

  • cryptominers.txt, cryptominers.yaml
    Contains a list of cryptocurrency miners that run in the background of a web browser and affect system performance.

  • social.txt,social.yaml
    Contains Domain Addresses of popular social media platforms, including Facebook, Instagram, Whatsapp, Twitter, LinkedIn, MySpace, Pinterest, Tumblr, Reddit, TikTok, clubhouse.

  • nsfw.txt,nsfw.yaml Contains a list of porn and gambling websites.

IP Rules

  • ircidr.txt, ircidr.yaml
    Contains Iran IP addresses from Maxmind database and IP addresses of Iranian messengers such as eitaa, rubika, etc.

  • private.txt, private.yaml
    Contains a list of local (LAN) IP addresses.

  • arvancloud.txt, arvancloud.yaml
    Contains the IP addresses of ArvanCloud.ir CDN.

  • derakcloud.txt, derakcloud.yaml
    Contains the IP addresses of Derak.cloud CDN.

  • iranserver.txt, iranserver.yaml
    Contains the IP addresses of IranServer.com CDN.

  • parspack.txt, parspack.yaml
    Contains the IP addresses of ParsPack.com CDN.

  • cloudflare.txt, cloudflare.yaml
    Contains the IP addresses of Cloudflare CDN.

  • google.txt, google.yaml
    Contains the IP addresses of Google, GoogleCloud and GoogleBot.

  • amazon.txt, amazon.yaml
    Contains the IP addresses of Amazon and Amazon Web Services (AWS).

  • microsoft.txt, microsoft.yaml
    Contains the IP addresses of Microsoft and Azure Platform.

  • bing.txt, bing.yaml
    Contains the IP addresses of Bing and Bingbot.

  • github.txt, github.yaml
    Contains the IP addresses of GitHub.

  • facebook.txt, facebook.yaml
    Contains the IP addresses of the Meta ecosystem, including Facebook, Instagram and WhatsApp.

  • twitter.txt, twitter.yaml
    Contains the IP addresses of Twitter (now called X!).

  • telegram.txt, telegram.yaml
    Contains the IP addresses of Telegram Messenger.

  • oracle.txt, oracle.yaml
    Contains the IP addresses of Oracle Cloud.

  • digitalocean.txt, digitalocean.yaml
    Contains the IP addresses of DigitalOcean related services.

  • linode.txt, linode.yaml
    Contains the IP addresses of Linode related services.

  • openai.txt, openai.yaml
    Contains the IP addresses of OpenAI and ChatGPT.

  • phishing-ip.txt, phishing-ip.yaml
    Contains Phishing IP addresses.

  • malware-ip.txt, malware-ip.yaml
    Contains Active Malware IP addresses.

Meta GeoIP

Note

Only usable in Clash.Meta.

GeoIP database in Clash.Meta format.

  • geoip.metadb
    Same as GeoIP but in Clash.Meta format.
  • geoip-lite.metadb
    Same as GeoIP-Lite but in Clash.Meta format.
  • security-ip.metadb
    Same as Security-IP but in Clash.Meta format.

⬇️ How to download

github logo in dark and light mode. From GitHub

github logo in dark and light mode. From jsDelivr CDN

💻 Usage

Clash and Clash.Meta

Add the following to the rule section of your clash/clash.meta client configuration:

TEXT Format

rule-providers:
  ir:
    type: http
    format: text
    behavior: domain
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/ir.txt"
    path: ./ruleset/ir.txt
    interval: 86400
  ads:
    type: http
    format: text
    behavior: domain
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/ads.txt"
    path: ./ruleset/ads.txt
    interval: 86400
  malware:
    type: http
    format: text
    behavior: domain
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/malware.txt"
    path: ./ruleset/malware.txt
    interval: 86400
  phishing:
    type: http
    format: text
    behavior: domain
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/phishing.txt"
    path: ./ruleset/phishing.txt
    interval: 86400
  cryptominers:
    type: http
    format: text
    behavior: domain
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/cryptominers.txt"
    path: ./ruleset/cryptominers.txt
    interval: 86400
  apps:
    type: http
    format: text
    behavior: classical
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/apps.txt"
    path: ./ruleset/apps.txt
    interval: 86400
  ircidr:
    type: http
    format: text
    behavior: ipcidr
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/ircidr.txt"
    path: ./ruleset/ircidr.txt
    interval: 86400
  private:
    type: http
    format: text
    behavior: ipcidr
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/private.txt"
    path: ./ruleset/private.txt
    interval: 86400
  irasn:
    type: http
    format: text
    behavior: classical
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/irasn.txt"
    path: ./ruleset/irasn.txt
    interval: 86400

rules :
  - RULE-SET,private,DIRECT,no-resolve
  - RULE-SET,apps,DIRECT
  - RULE-SET,ads,REJECT
  - RULE-SET,malware,REJECT
  - RULE-SET,phishing,REJECT
  - RULE-SET,cryptominers,REJECT
  - RULE-SET,ir,DIRECT
  - RULE-SET,ircidr,DIRECT
  - RULE-SET,irasn,DIRECT
  - MATCH,PROXY

YAML Format

rule-providers:
  ir:
    type: http
    format: yaml
    behavior: domain
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/ir.yaml"
    path: ./ruleset/ir.yaml
    interval: 86400
  ads:
    type: http
    format: yaml
    behavior: domain
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/ads.yaml"
    path: ./ruleset/ads.yaml
    interval: 86400
  malware:
    type: http
    format: yaml
    behavior: domain
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/malware.yaml"
    path: ./ruleset/malware.yaml
    interval: 86400
  phishing:
    type: http
    format: yaml
    behavior: domain
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/phishing.yaml"
    path: ./ruleset/phishing.yaml
    interval: 86400
  cryptominers:
    type: http
    format: yaml
    behavior: domain
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/cryptominers.yaml"
    path: ./ruleset/cryptominers.yaml
    interval: 86400
  apps:
    type: http
    format: yaml
    behavior: classical
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/apps.yaml"
    path: ./ruleset/apps.yaml
    interval: 86400
  ircidr:
    type: http
    format: yaml
    behavior: ipcidr
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/ircidr.yaml"
    path: ./ruleset/ircidr.yaml
    interval: 86400
  private:
    type: http
    format: yaml
    behavior: ipcidr
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/private.yaml"
    path: ./ruleset/private.yaml
    interval: 86400
  irasn:
    type: http
    format: yaml
    behavior: classical
    url: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/irasn.yaml"
    path: ./ruleset/irasn.yaml
    interval: 86400

rules :
  - RULE-SET,private,DIRECT,no-resolve
  - RULE-SET,apps,DIRECT
  - RULE-SET,ads,REJECT
  - RULE-SET,malware,REJECT
  - RULE-SET,phishing,REJECT
  - RULE-SET,cryptominers,REJECT
  - RULE-SET,ir,DIRECT
  - RULE-SET,ircidr,DIRECT
  - RULE-SET,irasn,DIRECT
  - MATCH,PROXY

Note

Currently there is a problem with "ClashMetaForAndroid" version 2.8.6 and above, in which it can't match Android package names thus - RULE-SET,apps,DIRECT is completely ineffective for now.

Only CLash.Meta

Add this to the top of your configuration.

geox-url:
  geoip: "https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geoip.dat"
  geosite: "https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geosite.dat"
  mmdb: "https://raw.githubusercontent.com/Chocolate4U/Iran-clash-rules/release/geoip.metadb"
  asn: "https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/geolite2/GeoLite2-ASN.mmdb"

Usage:

rules:
  - GEOIP,private,DIRECT,no-resolve
  - GEOSITE,category-ads-all,REJECT
  - GEOSITE,malware,REJECT
  - GEOSITE,phishing,REJECT
  - GEOSITE,cryptominers,REJECT
  - GEOIP,malware,REJECT
  - GEOIP,phishing,REJECT
  - GEOSITE,ir,DIRECT
  - GEOIP,ir,DIRECT
  - MATCH,PROXY

💁 How is this made?

Source files are pulled from Iran V2Ray Rules and get converted to clash text and yaml format by a GitHub actions workflow.
geoip.metadb and geoip-lite.metadb are generated from geoip.dat and geoip-lite.dat in Iran-v2ray-rules repository using source code from metacubex/geo.

🤝 Contribution

All contributions are welcome and appreciated. You can contribute to this project in 2 ways:

  1. Contribute to its upstream sources
    Do you know a Domain that should be bypassed? report it to Iran Hosted Domains
    Do you know a Persian advertisement domain that should be blocked or a false positive? report it to PersianBlocker
    Do you know... OK, you got the idea!
  2. Contribute directly to this project
    Report issues, open pull requests, suggest new sources or categories or any idea, in general, to make this repository more useful for everyone.

🙋‍♂️ Also one more thing, if this repository was useful to you, kindly leave a ⭐ up there so this project can be seen by more people.

©️ License

This project, except for upstream sources, is licensed under the GNU GPLv3 License - see the LICENSE file for details.

All rights are reserved for All upstream sources used in this project according to their respective licenses. Please refer to Sources section for more details.

📦 Sources

GeoIP

Source Maintainer Home Page License Category
GeoLite2 MaxMind Home Page CC BY-SA 4.0 ir, ru, us
IP2Location LITE IP2Location Home Page CC BY-SA 4.0 ir
ITO GOV ITO GOV Home Page N/A ir(messenger IPs)
V2ray-rules-dat Loyalsoldier Home Page GPL-3.0 cn
Arvan Cloud Arvan Cloud Home Page All rights reserved arvancloud
Derak Cloud Derak Cloud Home Page All rights reserved derakcloud
IranServer IranServer Home Page All rights reserved iranserver
ParsPack ParsPack Home Page All rights reserved parspack
Cloudflare Cloudflare Home Page All rights reserved cloudflare
Telegram Telegram Home Page All rights reserved Telegram
URLhaus abuse.ch Home Page CC0 malware
Phishing URL Blocklist malware-filter Group Home Page MIT phishing
IPRanges lord-alfred Home Page CC0 1.0 everything else

GeoSite

Source Maintainer Home Page License Category
Iran Hosted Domains bootmortis Home Page MIT ir
PersianBlocker MasterKia Home Page AGPL-3.0 ads
DNS Blocklists Hagezi Home Page All rights reserved ads
Ad and tracking server list Peter Lowe Home Page McRae GPL ads
GoodbyeAds jerryn70 Home Page MIT ads
AdGuard DNS filter Adguard Team Home Page GPL-3.0 ads
URLhaus abuse.ch Home Page CC0 malware
Phishing URL Blocklist malware-filter Group Home Page MIT phishing
NoCoin adblock list hoshsadiq Home Page MIT cryptominers
Unified Hosts StevenBlack Home Page MIT social, nsfw
Domain list community Domain list community Home Page MIT everything else

⚠️ Disclaimer

This repository is not affiliated, associated, authorized, endorsed by, or in any way officially connected to any of the aforementioned resources, websites, services, or any entity which this may concern, in any way.
The data in this repository is gathered from publicly available resources and is provided as-is, intended for informational purposes only with no guarantee of accuracy, liability or availability and We are not responsible for any harm or damage that may arise from using the data in this repository. Please do your research before using any data from this repository.

🙏 Special Thanks