Home

Awesome

<picture> <source media="(prefers-color-scheme: dark)" srcset="assets/logo-white.png"> <source media="(prefers-color-scheme: light)" srcset="assets/logo-dark.png"> <img alt="a logo for iran clash rules in both dark and light mode" src="assets/logo-dark.png"> </picture> <p align="center"> <img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/Chocolate4U/Iran-clash-rules/release.yml?event=schedule&style=for-the-badge&logo=github&cacheSeconds=3600"> <img alt="GitHub release" src="https://img.shields.io/github/v/release/Chocolate4U/Iran-clash-rules?style=for-the-badge&cacheSeconds=3600"> <img alt="GitHub Release Date" src="https://img.shields.io/github/release-date/Chocolate4U/Iran-clash-rules?display_date=published_at&style=for-the-badge&cacheSeconds=3600"> <img alt="License" src="https://img.shields.io/github/license/Chocolate4U/Iran-clash-rules?style=for-the-badge&color=blue&cacheSeconds=3600"> </p>

:writing_hand: Introduction

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

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

:page_with_curl: 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

Domain Rules

IP Rules

Meta GeoIP

[!NOTE] Only usable in Clash.Meta.

GeoIP database in Clash.Meta format.

:arrow_down: How to download

<picture><source media="(prefers-color-scheme: dark)" srcset="https://cdn.simpleicons.org/github/white"><source media="(prefers-color-scheme: light)" srcset="https://cdn.simpleicons.org/github/dark"><img height="32" width="32" alt="github logo in dark and light mode." src="https://cdn.simpleicons.org/github/dark"></picture> From GitHub

<picture><source media="(prefers-color-scheme: dark)" srcset="https://cdn.simpleicons.org/jsdelivr/white"><source media="(prefers-color-scheme: light)" srcset="https://cdn.simpleicons.org/jsdelivr/dark"><img height="32" width="32" alt="github logo in dark and light mode." src="https://cdn.simpleicons.org/jsdelivr/dark"></picture> From jsDelivr CDN

:computer: 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

:information_desk_person: 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.

:handshake: 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.

:raising_hand_man: Also one more thing, if this repository was useful to you, kindly leave a :star: up there so this project can be seen by more people.

:copyright: 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.

:package: Sources

GeoIP

SourceMaintainerHome PageLicenseCategory
GeoLite2MaxMindHome PageCC BY-SA 4.0ir, ru, us
IP2Location LITEIP2LocationHome PageCC BY-SA 4.0ir
ITO GOVITO GOVHome PageN/Air(messenger IPs)
V2ray-rules-datLoyalsoldierHome PageGPL-3.0cn
Arvan CloudArvan CloudHome PageAll rights reservedarvancloud
Derak CloudDerak CloudHome PageAll rights reservedderakcloud
IranServerIranServerHome PageAll rights reservediranserver
ParsPackParsPackHome PageAll rights reservedparspack
CloudflareCloudflareHome PageAll rights reservedcloudflare
TelegramTelegramHome PageAll rights reservedTelegram
URLhausabuse.chHome PageCC0malware
Phishing URL Blocklistmalware-filter GroupHome PageMITphishing
IPRangeslord-alfredHome PageCC0 1.0everything else

GeoSite

SourceMaintainerHome PageLicenseCategory
Iran Hosted DomainsbootmortisHome PageMITir
PersianBlockerMasterKiaHome PageAGPL-3.0ads
DNS BlocklistsHageziHome PageAll rights reservedads
Ad and tracking server listPeter LoweHome PageMcRae GPLads
GoodbyeAdsjerryn70Home PageMITads
AdGuard DNS filterAdguard TeamHome PageGPL-3.0ads
URLhausabuse.chHome PageCC0malware
Phishing URL Blocklistmalware-filter GroupHome PageMITphishing
NoCoin adblock listhoshsadiqHome PageMITcryptominers
Unified HostsStevenBlackHome PageMITsocial, nsfw
Domain list communityDomain list communityHome PageMITeverything else

:warning: 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.

:pray: Special Thanks