# doingdog/rconvert architecture

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

- Interactive diagram: https://gitdiagram.com/doingdog/rconvert
- Repository: https://github.com/doingdog/rconvert

## Overview

rconvert builds seven categorized domain-rule feeds from configured local or HTTPS sources. Its main workflow loads ruleset configuration, fetches and parses source rules, applies whitelist and normalization logic, then renders six client-specific formats into each feed directory. The README also documents how consumers use the feeds and distinguishes blocking, proxy, direct, CDN, large-traffic, and Telegram purposes. Relationships below follow the README and shown source references; unsampled internals are not assumed.

Main entry points: [`generate.py`](https://github.com/doingdog/rconvert/blob/main/generate.py) (Build orchestration), [`formats.py`](https://github.com/doingdog/rconvert/blob/main/formats.py) (Surge outputs), [`cdn/fin.txt`](https://github.com/doingdog/rconvert/blob/main/cdn/fin.txt) (CDN feeds), [`a3/fin.txt`](https://github.com/doingdog/rconvert/blob/main/a3/fin.txt) (Ad blocking feeds)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_config["Configuration and sources"]
  node_config_file["Ruleset config<br/>[rulesets.json]"]
  node_source_loader["Source resolution<br/>[sources.py]"]
  node_static_lists["Whitelist lists<br/>[Direct.list]"]
  node_fetcher["HTTPS fetch<br/>[generate.py]"]
end

subgraph group_engine["Rule processing"]
  node_generator["Build orchestration<br/>[generate.py]"]
  node_rule_parser["Rule parsing<br/>[rules.py]"]
  node_rule_sets["Rule normalization<br/>[rules.py]"]
  node_whitelisting["Whitelist filtering<br/>[rules.py]"]
end

subgraph group_render["Format rendering"]
  node_format_renderer["Format rendering<br/>[formats.py]"]
  node_surge["Surge outputs<br/>[formats.py]"]
  node_qx["Quantumult X output<br/>[formats.py]"]
  node_mihomo["Mihomo output<br/>[formats.py]"]
  node_adguard["AdGuard DNS output<br/>[formats.py]"]
end

subgraph group_feeds["Published rule feeds"]
  node_cdn_feed["CDN feeds<br/>[fin.txt]"]
  node_a3_feed["Ad blocking feeds<br/>[fin.txt]"]
  node_a4_feed["Alternate block feeds<br/>[fin.txt]"]
  node_bigdata_feed["Large traffic feeds<br/>[fin.txt]"]
  node_tg_feed["Telegram feeds<br/>[fin.txt]"]
  node_proxy_feed["Proxy feeds<br/>[fin.txt]"]
  node_direct_feed["Direct feeds<br/>[fin.txt]"]
end

node_operator(("Feed operator"))
node_upstream(("Rule sources"))
node_consumers(("Rule consumers"))

node_operator -->|"runs build"| node_generator
node_generator -->|"loads config"| node_source_loader
node_source_loader -->|"reads"| node_config_file
node_generator -->|"fetches sources"| node_fetcher
node_fetcher -->|"downloads rules"| node_upstream
node_generator -->|"parses rules"| node_rule_parser
node_generator -->|"parses whitelist"| node_whitelisting
node_generator -->|"normalizes rules"| node_rule_sets
node_generator -->|"renders groups"| node_format_renderer
node_format_renderer -->|"uses rule logic"| node_rule_parser
node_generator -->|"reads whitelist"| node_static_lists
node_format_renderer -->|"emits"| node_surge
node_format_renderer -->|"emits"| node_qx
node_format_renderer -->|"emits"| node_mihomo
node_format_renderer -->|"emits"| node_adguard
node_generator -->|"writes feed"| node_cdn_feed
node_generator -->|"writes feed"| node_a3_feed
node_generator -->|"writes feed"| node_a4_feed
node_generator -->|"writes feed"| node_bigdata_feed
node_generator -->|"writes feed"| node_tg_feed
node_generator -->|"writes feed"| node_proxy_feed
node_generator -->|"writes feed"| node_direct_feed
node_surge -->|"includes format"| node_cdn_feed
node_surge -->|"includes format"| node_a3_feed
node_surge -->|"includes format"| node_a4_feed
node_surge -->|"includes format"| node_bigdata_feed
node_surge -->|"includes format"| node_tg_feed
node_surge -->|"includes format"| node_proxy_feed
node_surge -->|"includes format"| node_direct_feed
node_qx -->|"includes format"| node_cdn_feed
node_mihomo -->|"includes format"| node_cdn_feed
node_adguard -->|"includes format"| node_a3_feed
node_consumers -->|"uses"| node_cdn_feed
node_consumers -->|"uses"| node_a3_feed
node_consumers -->|"uses"| node_a4_feed
node_consumers -->|"uses"| node_bigdata_feed
node_consumers -->|"uses"| node_tg_feed
node_consumers -->|"uses"| node_proxy_feed
node_consumers -->|"uses"| node_direct_feed

click node_config_file "https://github.com/doingdog/rconvert/blob/main/rulesets.json"
click node_source_loader "https://github.com/doingdog/rconvert/blob/main/sources.py"
click node_static_lists "https://github.com/doingdog/rconvert/blob/main/static/main/Direct.list"
click node_fetcher "https://github.com/doingdog/rconvert/blob/main/generate.py"
click node_generator "https://github.com/doingdog/rconvert/blob/main/generate.py"
click node_rule_parser "https://github.com/doingdog/rconvert/blob/main/rules.py"
click node_rule_sets "https://github.com/doingdog/rconvert/blob/main/rules.py"
click node_whitelisting "https://github.com/doingdog/rconvert/blob/main/rules.py"
click node_format_renderer "https://github.com/doingdog/rconvert/blob/main/formats.py"
click node_surge "https://github.com/doingdog/rconvert/blob/main/formats.py"
click node_qx "https://github.com/doingdog/rconvert/blob/main/formats.py"
click node_mihomo "https://github.com/doingdog/rconvert/blob/main/formats.py"
click node_adguard "https://github.com/doingdog/rconvert/blob/main/formats.py"
click node_cdn_feed "https://github.com/doingdog/rconvert/blob/main/cdn/fin.txt"
click node_a3_feed "https://github.com/doingdog/rconvert/blob/main/a3/fin.txt"
click node_a4_feed "https://github.com/doingdog/rconvert/blob/main/a4/fin.txt"
click node_bigdata_feed "https://github.com/doingdog/rconvert/blob/main/big-data/fin.txt"
click node_tg_feed "https://github.com/doingdog/rconvert/blob/main/tg/fin.txt"
click node_proxy_feed "https://github.com/doingdog/rconvert/blob/main/proxy/fin.txt"
click node_direct_feed "https://github.com/doingdog/rconvert/blob/main/dirt/fin.txt"

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_config_file,node_source_loader,node_static_lists,node_fetcher toneBlue
class node_generator,node_rule_parser,node_rule_sets,node_whitelisting toneAmber
class node_format_renderer,node_surge,node_qx,node_mihomo,node_adguard toneMint
class node_cdn_feed,node_a3_feed,node_a4_feed,node_bigdata_feed,node_tg_feed,node_proxy_feed,node_direct_feed toneRose
class node_operator,node_upstream,node_consumers toneIndigo
```

## Components

### Configuration and sources

- [Ruleset config](https://github.com/doingdog/rconvert/blob/main/rulesets.json): `rulesets.json`
- [Source resolution](https://github.com/doingdog/rconvert/blob/main/sources.py): `sources.py`
- [Whitelist lists](https://github.com/doingdog/rconvert/blob/main/static/main/Direct.list): `static/main/Direct.list`
- [HTTPS fetch](https://github.com/doingdog/rconvert/blob/main/generate.py): `generate.py`

### Rule processing

- [Build orchestration](https://github.com/doingdog/rconvert/blob/main/generate.py): `generate.py`
- [Rule parsing](https://github.com/doingdog/rconvert/blob/main/rules.py): `rules.py`
- [Rule normalization](https://github.com/doingdog/rconvert/blob/main/rules.py): `rules.py`
- [Whitelist filtering](https://github.com/doingdog/rconvert/blob/main/rules.py): `rules.py`

### Format rendering

- [Format rendering](https://github.com/doingdog/rconvert/blob/main/formats.py): `formats.py`
- [Surge outputs](https://github.com/doingdog/rconvert/blob/main/formats.py): `formats.py`
- [Quantumult X output](https://github.com/doingdog/rconvert/blob/main/formats.py): `formats.py`
- [Mihomo output](https://github.com/doingdog/rconvert/blob/main/formats.py): `formats.py`
- [AdGuard DNS output](https://github.com/doingdog/rconvert/blob/main/formats.py): `formats.py`

### Published rule feeds

- [CDN feeds](https://github.com/doingdog/rconvert/blob/main/cdn/fin.txt): `cdn/fin.txt`
- [Ad blocking feeds](https://github.com/doingdog/rconvert/blob/main/a3/fin.txt): `a3/fin.txt`
- [Alternate block feeds](https://github.com/doingdog/rconvert/blob/main/a4/fin.txt): `a4/fin.txt`
- [Large traffic feeds](https://github.com/doingdog/rconvert/blob/main/big-data/fin.txt): `big-data/fin.txt`
- [Telegram feeds](https://github.com/doingdog/rconvert/blob/main/tg/fin.txt): `tg/fin.txt`
- [Proxy feeds](https://github.com/doingdog/rconvert/blob/main/proxy/fin.txt): `proxy/fin.txt`
- [Direct feeds](https://github.com/doingdog/rconvert/blob/main/dirt/fin.txt): `dirt/fin.txt`

### Other components

- **Feed operator**
- **Rule sources**
- **Rule consumers**

## Connections

- Feed operator → Build orchestration: runs build (evidence: `generate.py`)
- Build orchestration → Source resolution: loads config (evidence: `generate.py`)
- Source resolution → Ruleset config: reads (evidence: `sources.py`)
- Build orchestration → HTTPS fetch: fetches sources (evidence: `generate.py`)
- HTTPS fetch → Rule sources: downloads rules (evidence: `generate.py`)
- Build orchestration → Rule parsing: parses rules (evidence: `generate.py`)
- Build orchestration → Whitelist filtering: parses whitelist (evidence: `generate.py`)
- Build orchestration → Rule normalization: normalizes rules (evidence: `generate.py`)
- Build orchestration → Format rendering: renders groups (evidence: `generate.py`)
- Format rendering → Rule parsing: uses rule logic (evidence: `formats.py`)
- Build orchestration → Whitelist lists: reads whitelist (evidence: `README.md`)
- Format rendering → Surge outputs: emits (evidence: `formats.py`)
- Format rendering → Quantumult X output: emits (evidence: `formats.py`)
- Format rendering → Mihomo output: emits (evidence: `formats.py`)
- Format rendering → AdGuard DNS output: emits (evidence: `formats.py`)
- Build orchestration → CDN feeds: writes feed (evidence: `README.md`)
- Build orchestration → Ad blocking feeds: writes feed (evidence: `README.md`)
- Build orchestration → Alternate block feeds: writes feed (evidence: `README.md`)
- Build orchestration → Large traffic feeds: writes feed (evidence: `README.md`)
- Build orchestration → Telegram feeds: writes feed (evidence: `README.md`)
- Build orchestration → Proxy feeds: writes feed (evidence: `README.md`)
- Build orchestration → Direct feeds: writes feed (evidence: `README.md`)
- Surge outputs → CDN feeds: includes format (evidence: `README.md`)
- Surge outputs → Ad blocking feeds: includes format (evidence: `README.md`)
- Surge outputs → Alternate block feeds: includes format (evidence: `README.md`)
- Surge outputs → Large traffic feeds: includes format (evidence: `README.md`)
- Surge outputs → Telegram feeds: includes format (evidence: `README.md`)
- Surge outputs → Proxy feeds: includes format (evidence: `README.md`)
- Surge outputs → Direct feeds: includes format (evidence: `README.md`)
- Quantumult X output → CDN feeds: includes format (evidence: `README.md`)
- Mihomo output → CDN feeds: includes format (evidence: `README.md`)
- AdGuard DNS output → Ad blocking feeds: includes format (evidence: `README.md`)
- Rule consumers → CDN feeds: uses (evidence: `README.md`)
- Rule consumers → Ad blocking feeds: uses (evidence: `README.md`)
- Rule consumers → Alternate block feeds: uses (evidence: `README.md`)
- Rule consumers → Large traffic feeds: uses (evidence: `README.md`)
- Rule consumers → Telegram feeds: uses (evidence: `README.md`)
- Rule consumers → Proxy feeds: uses (evidence: `README.md`)
- Rule consumers → Direct feeds: uses (evidence: `README.md`)
