Skip to content

Commit da0bc4a

Browse files
authored
Feat: add v2fly domain-list-community (#13)
* feat: add v2fly domain-list-community as source * docs: add v2fly in sources section
1 parent 506c10c commit da0bc4a

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed

README.fa.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,12 @@ rule-providers:
164164
- **qv2ray_schema.json:** فایل قابل استفاده در کلاینت [Qv2ray](https://github.com/Qv2ray/Qv2ray).
165165
- **shadowrocket.conf:** فایل قابل استفاده در کلاینت [Shadowrocket](https://apps.apple.com/us/app/shadowrocket/id932747118).
166166

167-
## منابع
167+
## منابع و قدردانی‌ها
168168

169169
- دامنه‌های ایران:
170170
- [سازمان فناوری اطلاعات ایران](https://g2b.ito.gov.ir/index.php/site/list_ip)
171171
- [سامانه مدیریت اینترنت مشتریان شرکت مخابرات ایران](https://adsl.tci.ir/panel/sites)
172+
- [انجمن لیست دامنه v2fly](https://github.com/v2fly/domain-list-community)
172173
- [لیست شخصی][link-custom]
173174
- تبلیغات:
174175
- [PersianBlocker](https://github.com/MasterKia/PersianBlocker) (لایسنس AGPL-3.0)

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,12 @@ go run ./ --outputdir=../
181181
- **qv2ray_schema.json:** Importable json schema that can be used in [Qv2ray](https://github.com/Qv2ray/Qv2ray).
182182
- **shadowrocket.conf:** Importable conf file that can be used in [Shadowrocket](https://apps.apple.com/us/app/shadowrocket/id932747118).
183183
184-
## Source
184+
## Sources & Acknowledgements
185185
186186
- Iran Domains:
187187
- [ITO GOV](https://eservices.ito.gov.ir/page/iplist) - [Mirror](https://github.com/bootmortis/ito-gov-mirror)
188188
- [ADSL TCI](https://adsl.tci.ir/panel/sites)
189+
- [V2fly Domain List Community](https://github.com/v2fly/domain-list-community)
189190
- [Custom List][link-custom]
190191
- ADs:
191192
- [PersianBlocker](https://github.com/MasterKia/PersianBlocker) (AGPL-3.0 License)

src/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# https://eservices.ito.gov.ir/page/iplist
22
g2b_gov_url = "https://raw.githubusercontent.com/bootmortis/ito-gov-mirror/main/out/domains.csv"
33
ads_url = "https://raw.githubusercontent.com/MasterKia/PersianBlocker/main/PersianBlockerHosts.txt"
4+
v2fly_base_url = "https://raw.githubusercontent.com/v2fly/domain-list-community/master/data/"
45

56
# input files
67
adsl_tci_file_path = "src/data/adsl_tci.txt"

src/get_domians.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,20 @@ def ads() -> Iterable[str]:
3333
ads = filter(utils.is_not_ip, ads)
3434
ads = filter(utils.is_url, ads)
3535
return sorted(ads)
36+
37+
def v2fly(filename = "category-ir") -> Iterable[str]:
38+
resp = requests.get(consts.v2fly_base_url + filename)
39+
resp.raise_for_status()
40+
41+
domains = []
42+
for line in resp.text.splitlines():
43+
line = re.sub(r'(?m)^\s*#.*\n?', '', line)
44+
if line.startswith("include:"):
45+
domains.extend(v2fly(line.split(":")[1]))
46+
else:
47+
domains.append(line)
48+
49+
domains = (domain.strip() for domain in domains if domain.strip() != '')
50+
domains = filter(utils.is_not_ip, domains)
51+
domains = filter(utils.is_url, domains)
52+
return sorted(domains)

src/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def collect_and_clean_domains(*domain_set: Iterable[Iterable[str]]) -> Iterable[
4444
all_domains = collect_and_clean_domains(
4545
get_domians.g2b_ito_gov(),
4646
get_domians.adsl_tci(),
47+
get_domians.v2fly(),
4748
)
4849

4950
# Divide info

0 commit comments

Comments
 (0)