# bootmortis/iran-hosted-domains architecture

> Architecture diagram of the GitHub repository bootmortis/iran-hosted-domains, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bootmortis/iran-hosted-domains
- Repository: https://github.com/bootmortis/iran-hosted-domains

## Overview

Iran Hosted Domains is a Python data-generation tool: it gathers Iranian domain and advertising data, normalizes and filters it, separates direct-use domain categories, and writes domain lists plus client-specific rule/configuration files. The main script owns the workflow and calls the source collectors, cleanup utilities, and configuration generators. The README documents additional client formats and release artifacts; the sampled implementation shows their generators in `src/create_config.py`. Relationships are limited to calls or data flow visible in the excerpts and README.

Main entry points: [`src/main.py`](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/main.py) (Generation workflow), [`src/get_domians.py`](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/get_domians.py) (Feed collectors), [`src/create_config.py`](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/create_config.py) (Client rule generators), [`src/utils.py`](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/utils.py) (Domain utilities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Data collection"]
  node_source_feeds(("Public domain feeds"))
  node_ads_feed(("Advertising feed"))
  node_feed_collectors["Feed collectors<br/>[get_domians.py]"]
  node_local_seed["Custom domain sets<br/>[custom_domains.py]"]
  node_v2fly_reference(("V2Fly domain data"))
end

subgraph group_processing["Domain processing"]
  node_runner["Generation workflow<br/>[main.py]"]
  node_domain_cleanup["Normalize and filter<br/>[main.py]"]
  node_category_split["Direct categories<br/>[main.py]"]
end

subgraph group_generation["Output generation"]
  node_domain_lists["Domain list files<br/>[main.py]"]
  node_client_formats["Client rule generators<br/>[create_config.py]"]
  node_client_files["Client config files<br/>[create_config.py]"]
end

subgraph group_support["Runtime support"]
  node_domain_helpers["Domain utilities<br/>[utils.py]"]
  node_output_paths["Output path settings<br/>[constants.py]"]
  node_file_writer["File writer<br/>[utils.py]"]
end

node_runner -->|"requests feeds"| node_feed_collectors
node_feed_collectors -->|"fetches domains"| node_source_feeds
node_feed_collectors -->|"fetches ads"| node_ads_feed
node_runner -->|"uses domain sets"| node_local_seed
node_runner -->|"cleans domains"| node_domain_cleanup
node_domain_cleanup -->|"filters domains"| node_domain_helpers
node_runner -->|"loads exclusions"| node_domain_helpers
node_domain_helpers -->|"downloads domain data"| node_v2fly_reference
node_runner -->|"splits categories"| node_category_split
node_runner -->|"writes domain lists"| node_domain_lists
node_runner -->|"generates formats"| node_client_formats
node_client_formats -->|"writes files"| node_file_writer
node_runner -->|"writes lists"| node_file_writer
node_file_writer -->|"uses output paths"| node_output_paths
node_client_formats -->|"produces configs"| node_client_files

click node_runner "https://github.com/bootmortis/iran-hosted-domains/blob/main/src/main.py"
click node_feed_collectors "https://github.com/bootmortis/iran-hosted-domains/blob/main/src/get_domians.py"
click node_local_seed "https://github.com/bootmortis/iran-hosted-domains/blob/main/src/data/custom_domains.py"
click node_domain_cleanup "https://github.com/bootmortis/iran-hosted-domains/blob/main/src/main.py"
click node_domain_helpers "https://github.com/bootmortis/iran-hosted-domains/blob/main/src/utils.py"
click node_category_split "https://github.com/bootmortis/iran-hosted-domains/blob/main/src/main.py"
click node_output_paths "https://github.com/bootmortis/iran-hosted-domains/blob/main/src/constants.py"
click node_file_writer "https://github.com/bootmortis/iran-hosted-domains/blob/main/src/utils.py"
click node_domain_lists "https://github.com/bootmortis/iran-hosted-domains/blob/main/src/main.py"
click node_client_formats "https://github.com/bootmortis/iran-hosted-domains/blob/main/src/create_config.py"
click node_client_files "https://github.com/bootmortis/iran-hosted-domains/blob/main/src/create_config.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_source_feeds,node_ads_feed,node_feed_collectors,node_local_seed,node_v2fly_reference toneBlue
class node_runner,node_domain_cleanup,node_category_split toneAmber
class node_domain_lists,node_client_formats,node_client_files toneMint
class node_domain_helpers,node_output_paths,node_file_writer toneRose
```

## Components

### Data collection

- **Public domain feeds**
- **Advertising feed**
- [Feed collectors](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/get_domians.py): `src/get_domians.py`
- [Custom domain sets](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/data/custom_domains.py): `src/data/custom_domains.py`
- **V2Fly domain data**

### Domain processing

- [Generation workflow](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/main.py): `src/main.py`
- [Normalize and filter](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/main.py): `src/main.py`
- [Direct categories](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/main.py): `src/main.py`

### Output generation

- [Domain list files](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/main.py): `src/main.py`
- [Client rule generators](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/create_config.py): `src/create_config.py`
- [Client config files](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/create_config.py): `src/create_config.py`

### Runtime support

- [Domain utilities](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/utils.py): `src/utils.py`
- [Output path settings](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/constants.py): `src/constants.py`
- [File writer](https://github.com/bootmortis/iran-hosted-domains/blob/main/src/utils.py): `src/utils.py`

## Connections

- Generation workflow → Feed collectors: requests feeds (evidence: `src/main.py`)
- Feed collectors → Public domain feeds: fetches domains (evidence: `src/get_domians.py`)
- Feed collectors → Advertising feed: fetches ads (evidence: `src/get_domians.py`)
- Generation workflow → Custom domain sets: uses domain sets (evidence: `src/main.py`)
- Generation workflow → Normalize and filter: cleans domains (evidence: `src/main.py`)
- Normalize and filter → Domain utilities: filters domains (evidence: `src/main.py`)
- Generation workflow → Domain utilities: loads exclusions (evidence: `src/main.py`)
- Domain utilities → V2Fly domain data: downloads domain data (evidence: `src/utils.py`)
- Generation workflow → Direct categories: splits categories (evidence: `src/main.py`)
- Generation workflow → Domain list files: writes domain lists (evidence: `src/main.py`)
- Generation workflow → Client rule generators: generates formats (evidence: `src/main.py`)
- Client rule generators → File writer: writes files (evidence: `src/create_config.py`)
- Generation workflow → File writer: writes lists (evidence: `src/main.py`)
- File writer → Output path settings: uses output paths (evidence: `src/constants.py`)
- Client rule generators → Client config files: produces configs (evidence: `src/create_config.py`)
