Compare commits

...

21 Commits

Author SHA1 Message Date
MkQtS
912c689da3 Cast out !cn rules from cn lists (#3198)
* Cast out !cn rules from cn lists

* Docs: add notice about !cn rules in cn lists
2026-01-20 21:36:27 +08:00
Luo Chen
d1addde6f7 xiaomi: add xiaomi-iot domains (#3097)
- Add account.xiaomi.com for OAuth2 authentication
- Add ha.api.io.mi.com for HTTP API
- Add miot-spec.org for MIoT specification API
- Add cn-ha.mqtt.io.mi.com for MQTT broker
2026-01-20 21:06:11 +08:00
MkQtS
ec95fedc45 Refactor main.go (#3119)
* Refactor: reduce the use of strings.TrimSpace

* Refactor: use string attr before toProto

* Refactor parseEntry

- add value/attribute checker(check missing space)
- allow multiple spaces
- sort attributes
- improve readablity

* Refactor exportPlainTextList

- remove unnecessary variable
- improve readablity

* Remove support for partial include

This reverts e640ac2783

It is problematic and I will implement a new one

* Refactor: promote refMap

* Feat: add support for partial include

- refactor inclusion logic
- add basic deduplicate

* Refactor exporting plaintext list

* Feat: add support for affiliation

A domain rule is always added to the list corresponding to the filename
it resides in. Additionally, you can now add affiliations to a domain
rule, and the rule will be added to the list specified by the
affiliation. Each affiliation begins with `&` and followed by the name
of the affiliation.

This helps us to reduce the number of data files without compromising
functionality, and avoid writing a same rule in different files.

* Feat: add advanced deduplicate for subdomains

only for domain/full subdomains without attr

* Refactor: import and use slices

* Refactor: improve code
2026-01-20 20:58:32 +08:00
MkQtS
d50e2e1ad7 Update some cn rules (#3197)
* turn some full type rules into domain

* remove some unnecessary cn attrs
2026-01-20 15:33:15 +08:00
MkQtS
ab42940731 Update sensorsdata (#3196) 2026-01-20 14:33:58 +08:00
Cavano
efd57f30ee Add youmind (#3195) 2026-01-20 14:22:00 +08:00
xiyao
3ee190ac78 Add liveperson and standardchartered (#3192)
* Add liveperson

* Add standardchartered
2026-01-20 11:21:13 +08:00
Aethersailor
fa279bdd79 category-emby: add server2.cn2gias.uk (#3194) 2026-01-20 11:04:34 +08:00
tooadstool
b18f5e3049 Update annas-archive (#3193) 2026-01-20 11:04:18 +08:00
MkQtS
5411cefcaa Add more !cn domains (#3191)
* geolocation-!cn: reorder

* geolocation-!cn: add more CMP domains

* geolocation-!cn: add cataboom.com
2026-01-19 13:46:32 +08:00
Zeehan2005
d84e864ce8 Add pubg (#3175) 2026-01-17 13:36:10 +08:00
Loyalsoldier
49444d78b7 Update epochmediagroup (#3185) 2026-01-17 01:42:22 +08:00
someguyfromnowhere1
dad8e15cd0 Update xvideos (#3180)
Added several domains related to the site. These domains are only used when changing the language to Russian, Arabic, or Indian.
2026-01-15 13:13:39 +08:00
jinqiang zhang
e6e731a616 volcengine: add volcgslb-mlt.com (#3182) 2026-01-15 13:09:31 +08:00
EndlessEnding
8c0b190c3f Add 報導者 to category-media (#3179) 2026-01-14 17:53:11 +08:00
MkQtS
9f846c0f2e Add more cn domains (#3178)
* chinamobile: add cmft.com.cn

* category-entertainment-cn: add pipi.cn

* category-social-media-cn: add zsxq.com

* geolocation-cn: add more domains
2026-01-14 12:58:33 +08:00
MkQtS
fe01057830 Update category-entertainment (#3177)
* add steaminventoryhelper

* category-entertainment: include category-acg
2026-01-14 12:33:35 +08:00
深鸣
3ba71a115d category-games: add more domains (#3174) 2026-01-13 20:35:33 +08:00
MkQtS
8f1fe6b425 google-deepmind: add antigravity domains (#3173) 2026-01-13 14:08:15 +08:00
MkQtS
82ad580e6e google-deepmind: add more notebooklm domains (#3172) 2026-01-13 13:36:43 +08:00
MkQtS
488ee0334e cloudflare: add more domains (#3169)
encryptedsni.com
from https://blog.cloudflare.com/encrypt-that-sni-firefox-edition/

cloudflarechallenge.com
from https://blog.cloudflare.com/introducing-cryptographic-attestation-of-personhood/

cloudflareresearch.com
from https://blog.cloudflare.com/experiment-with-pq/

browser.run
cfdata.org
cloudflarebrowser.com
cloudflarecp.com
from https://developers.cloudflare.com/cloudflare-one/traffic-policies/global-policies/

cloudflare-terms-of-service-abuse.com
cloudflare.dev
cloudflaresupport.com
cloudflareworkers.com
from public information
2026-01-12 13:32:25 +08:00
37 changed files with 479 additions and 342 deletions

View File

@@ -11,6 +11,14 @@ This project is not opinionated. In other words, it does NOT endorse, claim or i
- **dlc.dat**[https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat](https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat) - **dlc.dat**[https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat](https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat)
- **dlc.dat.sha256sum**[https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat.sha256sum](https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat.sha256sum) - **dlc.dat.sha256sum**[https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat.sha256sum](https://github.com/v2fly/domain-list-community/releases/latest/download/dlc.dat.sha256sum)
## Notice
Rules with `@!cn` attribute has been cast out from cn lists. `geosite:geolocation-cn@!cn` is no longer available.
Check [#390](https://github.com/v2fly/domain-list-community/issues/390), [#3119](https://github.com/v2fly/domain-list-community/pull/3119) and [#3198](https://github.com/v2fly/domain-list-community/pull/3198) for more information.
Please report if you have any problems or questions.
## Usage example ## Usage example
Each file in the `data` directory can be used as a rule in this format: `geosite:filename`. Each file in the `data` directory can be used as a rule in this format: `geosite:filename`.

View File

@@ -17,6 +17,7 @@
4399biule.com 4399biule.com
4399dmw.com 4399dmw.com
4399er.com 4399er.com
4399hdhh.com
4399hhh.com 4399hhh.com
4399inc.com 4399inc.com
4399mail.com 4399mail.com
@@ -30,17 +31,22 @@
4399yyy.com 4399yyy.com
5054399.com 5054399.com
5054399.net 5054399.net
5wyxi.com
71acg.com 71acg.com
71acg.net 71acg.net
abdf002.com
appeeres.com appeeres.com
buke999.com
bx1k.com bx1k.com
edu4399.com edu4399.com
funnycore.com funnycore.com
guoping123.com guoping123.com
haohaowan.net
i3839.com i3839.com
ihykb.com ihykb.com
img4399.com img4399.com
mail4399.com mail4399.com
maindown4399.com
me4399.com me4399.com
my4399.com my4399.com
mysiteres.com mysiteres.com
@@ -52,4 +58,6 @@ wanwan4399.com
we4399.com we4399.com
webgame163.com webgame163.com
youba.com youba.com
yxhapi.com
yxhhdl.com yxhhdl.com
yxhimg.com

View File

@@ -1,3 +1,5 @@
annas-archive.in
annas-archive.li annas-archive.li
annas-archive.org annas-archive.org
annas-archive.pm
annas-archive.se annas-archive.se

View File

@@ -43,7 +43,6 @@ include:pocoiq-ads
include:pubmatic-ads include:pubmatic-ads
include:qihoo360-ads include:qihoo360-ads
include:segment-ads include:segment-ads
include:sensorsdata-ads
include:sina-ads include:sina-ads
include:sohu-ads include:sohu-ads
include:spotify-ads include:spotify-ads
@@ -194,6 +193,9 @@ reachmax.cn
# 热云数据 # 热云数据
reyun.com reyun.com
# 神策数据
static.sensorsdata.cn
# 诸葛io # 诸葛io
zhugeapi.com zhugeapi.com
zhugeapi.net zhugeapi.net

View File

@@ -7,10 +7,12 @@ include:elevenlabs
include:google-deepmind include:google-deepmind
include:groq include:groq
include:huggingface include:huggingface
include:liveperson
include:openai include:openai
include:perplexity include:perplexity
include:poe include:poe
include:xai include:xai
include:youmind
# CodeRabbit # CodeRabbit
coderabbit.ai coderabbit.ai

View File

@@ -1,9 +1,9 @@
include:boc include:boc @-!cn
include:ccb include:ccb @-!cn
include:citic include:citic @-!cn
include:cmb include:cmb @-!cn
include:hsbc-cn include:hsbc-cn
include:icbc include:icbc @-!cn
include:unionpay include:unionpay
abchina.com abchina.com

View File

@@ -4,7 +4,7 @@ include:apipost
include:baltamatica include:baltamatica
include:cnblogs include:cnblogs
include:csdn include:csdn
include:deepin include:deepin @-!cn
include:gitee include:gitee
include:goproxy include:goproxy
include:huawei-dev include:huawei-dev

View File

@@ -188,3 +188,6 @@ emby1.69yun69.com
# 云梯 # 云梯
yunti.online yunti.online
# 守候网络
server2.cn2gias.uk

View File

@@ -1,5 +1,6 @@
# This list contains services related to entertainment & games & music & podcasts & videos outside China mainland. # This list contains services related to entertainment & games & music & podcasts & videos outside China mainland.
include:category-acg
include:category-entertainment-ru include:category-entertainment-ru
include:category-games-!cn include:category-games-!cn
include:category-novel include:category-novel

View File

@@ -6,7 +6,7 @@ include:aamgame
include:acfun include:acfun
include:acplay include:acplay
include:bestv include:bestv
include:bilibili include:bilibili @-!cn
include:ciweimao include:ciweimao
include:dedao include:dedao
include:douyin include:douyin
@@ -18,7 +18,7 @@ include:gamersky
include:gitv include:gitv
include:hunantv include:hunantv
include:huya include:huya
include:iqiyi include:iqiyi @-!cn
include:ku6 include:ku6
include:kuaikan include:kuaikan
include:kuaishou include:kuaishou
@@ -89,6 +89,8 @@ motie.com
motieimg.com motieimg.com
# 梨视频 # 梨视频
pearvideo.com pearvideo.com
# 皮皮网
pipi.cn
# SF轻小说二次元 # SF轻小说二次元
sfacg.com sfacg.com
# 书海小说 # 书海小说

View File

@@ -12,6 +12,7 @@ include:itiger
include:longbridge include:longbridge
include:n26 include:n26
include:schwab include:schwab
include:standardchartered
include:wise include:wise
fxcorporate.com fxcorporate.com

View File

@@ -24,12 +24,14 @@ include:pandanet
include:pinkcore include:pinkcore
include:playstation include:playstation
include:projectsekai include:projectsekai
include:pubg
include:purikonejp include:purikonejp
include:riot include:riot
include:roblox include:roblox
include:rockstar include:rockstar
include:snk include:snk
include:steam include:steam
include:steaminventoryhelper
include:steamunlocked include:steamunlocked
include:supercell include:supercell
include:ubisoft include:ubisoft
@@ -38,6 +40,7 @@ include:wbgames
include:xbox include:xbox
include:ynoproject include:ynoproject
dinopoloclub.com
dodi-repacks.download dodi-repacks.download
dodi-repacks.site dodi-repacks.site
fabricmc.net fabricmc.net
@@ -48,8 +51,10 @@ humblebundle.com
joinsquad.com joinsquad.com
loverslab.com loverslab.com
minecraft.wiki minecraft.wiki
mobimon.com.tw
nexus-cdn.com nexus-cdn.com
nexusmods.com nexusmods.com
noxygames.com
offworldindustries.com offworldindustries.com
offworldindustries.net offworldindustries.net
papermc.io papermc.io
@@ -57,5 +62,7 @@ planetminecraft.com
prismlauncher.org prismlauncher.org
protondb.com protondb.com
quiltmc.org quiltmc.org
rayark.download
rayark.net
speedrun.com speedrun.com
steamdb.info steamdb.info

View File

@@ -9,7 +9,7 @@ include:mihoyo-cn
include:tencent-games include:tencent-games
include:tiancity include:tiancity
include:vrzwk include:vrzwk
include:xd include:xd @-!cn
include:yokaverse include:yokaverse
# 北京奇客创想科技有限公司 # 北京奇客创想科技有限公司
@@ -26,14 +26,16 @@ fxt365.com
gameabc.com gameabc.com
# 游戏魅 合肥启云软件 皖B2-20160087-3 # 游戏魅 合肥启云软件 皖B2-20160087-3
gamemei.com gamemei.com
# Enhance Gaming
heavenlywind.cc
# 乐都网 浙ICP备2024091002号-2 # 乐都网 浙ICP备2024091002号-2
ledu.com ledu.com
# 龙图游戏 京ICP备11023195号 # 龙图游戏 京ICP备11023195号
longtugame.com longtugame.com
# 北京慕飞科技 京ICP备20006112号-2 # 北京慕飞科技 京ICP备20006112号-2
morefreegame.com morefreegame.com
# Enhance Gaming # Phira
heavenlywind.cc phira.cn
# 沪ICP备18041304号-1 # 沪ICP备18041304号-1
tgpro.top tgpro.top
tgprocs.net tgprocs.net

View File

@@ -160,6 +160,7 @@ tnntoday.com
tvbs.com.tw tvbs.com.tw
tvmost.com.hk tvmost.com.hk
twgreatnews.com twgreatnews.com
twreporter.org
unwire.hk unwire.hk
upmedia.mg upmedia.mg
vjmedia.com.hk vjmedia.com.hk

View File

@@ -52,6 +52,7 @@ hwshu.com # 瀚文民国书库
hytung.cn # 瀚堂典藏古籍 hytung.cn # 瀚堂典藏古籍
incopat.com # incoPat 专利数据库 incopat.com # incoPat 专利数据库
lawyee.org # 北大法意网 中国法律资料库 lawyee.org # 北大法意网 中国法律资料库
libvideo.com # 知识视界 武汉缘来文化
neohytung.com # 瀚堂近代报刊 neohytung.com # 瀚堂近代报刊
nmrdata.com # 微谱数据 nmrdata.com # 微谱数据
nssd.cn # 国家哲学社会科学学术期刊数据库 nssd.cn # 国家哲学社会科学学术期刊数据库
@@ -67,5 +68,3 @@ unihan.com.cn # 书同文
wenxin-ge.com # 文心阁古籍全文数据库 wenxin-ge.com # 文心阁古籍全文数据库
wind.com.cn # Wind 资讯金融 wind.com.cn # Wind 资讯金融
yiigle.com # 中华医学期刊全文数据库 yiigle.com # 中华医学期刊全文数据库
full:www.libvideo.com # 武汉缘来文化-知识视界

View File

@@ -6,7 +6,7 @@ include:gracg
include:hupu include:hupu
include:meipian include:meipian
include:okjike include:okjike
include:sina include:sina @-!cn
include:xiaohongshu include:xiaohongshu
include:yy include:yy
include:zhihu include:zhihu
@@ -21,3 +21,6 @@ dandanvoice.com
# 脉脉 # 脉脉
maimai.cn maimai.cn
taou.com taou.com
# 知识星球
zsxq.com

View File

@@ -13,6 +13,9 @@ migucloud.com
migufun.com migufun.com
miguvideo.com miguvideo.com
# 中移金科
cmft.com.cn
# 中移在线 # 中移在线
cmcc-cs.cn cmcc-cs.cn
online-cmcc.cn online-cmcc.cn

View File

@@ -2,33 +2,44 @@ include:cloudflare-cn
include:cloudflare-ipfs include:cloudflare-ipfs
argotunnel.com argotunnel.com
browser.run
cfargotunnel.com cfargotunnel.com
cfdata.org
cfl.re cfl.re
cloudflare-dns.com cloudflare-dns.com
cloudflare-ech.com cloudflare-ech.com
cloudflare-esni.com cloudflare-esni.com
cloudflare-gateway.com cloudflare-gateway.com
cloudflare-quic.com cloudflare-quic.com
cloudflare-terms-of-service-abuse.com
cloudflare.com cloudflare.com
cloudflare.dev
cloudflare.net cloudflare.net
cloudflare.tv cloudflare.tv
cloudflareaccess.com cloudflareaccess.com
cloudflareapps.com cloudflareapps.com
cloudflarebolt.com cloudflarebolt.com
cloudflarebrowser.com
cloudflarechallenge.com
cloudflareclient.com cloudflareclient.com
cloudflarecp.com
cloudflareinsights.com cloudflareinsights.com
cloudflareok.com cloudflareok.com
cloudflarepartners.com cloudflarepartners.com
cloudflareportal.com cloudflareportal.com
cloudflarepreview.com cloudflarepreview.com
cloudflareregistrar.com cloudflareregistrar.com
cloudflareresearch.com
cloudflareresolve.com cloudflareresolve.com
cloudflaressl.com cloudflaressl.com
cloudflarestatus.com cloudflarestatus.com
cloudflarestorage.com cloudflarestorage.com
cloudflarestream.com cloudflarestream.com
cloudflaresupport.com
cloudflaretest.com cloudflaretest.com
cloudflarewarp.com cloudflarewarp.com
cloudflareworkers.com
encryptedsni.com
every1dns.net every1dns.net
imagedelivery.net imagedelivery.net
isbgpsafeyet.com isbgpsafeyet.com

View File

@@ -46,16 +46,20 @@ ntd.com
ntd.tv ntd.tv
ntdca.com ntdca.com
ntdimg.com ntdimg.com
ntdtv-dc.com
ntdtv.ca ntdtv.ca
ntdtv.co.il
ntdtv.co.kr ntdtv.co.kr
ntdtv.com ntdtv.com
ntdtv.com.tw ntdtv.com.tw
ntdtv.fr
ntdtv.jp ntdtv.jp
ntdtv.kr ntdtv.kr
ntdtv.org ntdtv.org
ntdtv.ru ntdtv.ru
ntdtv-dc.com ntdtv.se
ntdtvla.com ntdtvla.com
ntdvideo.tw
ntdvn.com ntdvn.com
persianepochtimes.com persianepochtimes.com
renminbao.com renminbao.com

View File

@@ -3,9 +3,6 @@
# AI Chat # AI Chat
include:category-ai-!cn include:category-ai-!cn
# Anime, Comics & Games
include:category-acg
# Advertisment & Analytics # Advertisment & Analytics
include:pubmatic include:pubmatic
include:taboola include:taboola
@@ -247,29 +244,31 @@ include:zeplin
include:zoho include:zoho
include:zoom include:zoom
biliplus.com # BiliPlus ## Aurora Open Source Software (https://gitlab.com/AuroraOSS)
# Graphing for Science and Engineering
originlab.com
# Online LaTeX Editor
cloudlatex.io
overleaf.com
# Translator & Dictionary
include:linguee
collinsdictionary.com
ldoceonline.com
immersivetranslate.com # 沉浸式翻译 (国际版)
# Aurora Open Source Software (https://gitlab.com/AuroraOSS)
auroraoss.com auroraoss.com
## BiliPlus
# CookiePro, provides cookies and tracking biliplus.com
## CataBoom
cataboom.com
## Consent Management Platforms / Cookie service
consentpro.com
cookiepro.com cookiepro.com
cookielaw.org cookielaw.org
onetrust.com onetrust.com
osano.com
usercentrics.eu
## Greasy Fork
greasyfork.org
## Online LaTeX Editor
cloudlatex.io
overleaf.com
## Translator & Dictionary
include:linguee
collinsdictionary.com
ldoceonline.com
immersivetranslate.com # 沉浸式翻译 (国际版)
## OriginLab (Graphing for Science and Engineering)
originlab.com
# Software development # Software development
include:category-dev include:category-dev
@@ -287,9 +286,6 @@ include:rarbg
dmhy.org dmhy.org
rutor.info rutor.info
# User scripts
greasyfork.org
# VPN services # VPN services
include:category-vpnservices include:category-vpnservices

View File

@@ -26,6 +26,9 @@ include:getui
include:jiguang include:jiguang
include:umeng include:umeng
# 神策数据
sensorsdata.cn
# category-httpdns-cn is mainly for advertising purpose # category-httpdns-cn is mainly for advertising purpose
include:category-httpdns-cn include:category-httpdns-cn
@@ -35,9 +38,9 @@ include:category-httpdns-cn
# Bank & Finance & Insurance & Securities # Bank & Finance & Insurance & Securities
include:category-bank-cn include:category-bank-cn
include:category-securities-cn include:category-securities-cn
include:eastmoney include:eastmoney @-!cn
include:everbright include:everbright
include:pingan include:pingan @-!cn
include:taikang include:taikang
## 航财通·校园付 ## 航财通·校园付
@@ -89,11 +92,11 @@ pkoplink.com
# E-commerce # E-commerce
include:58tongcheng include:58tongcheng
include:ctrip include:ctrip @-!cn
include:dangdang include:dangdang
include:dewu include:dewu @-!cn
include:dongjiao include:dongjiao
include:jd include:jd @-!cn
include:lianjia include:lianjia
include:meituan include:meituan
include:miaomiaozhe include:miaomiaozhe
@@ -321,6 +324,8 @@ include:zhubajie
## 容联七陌 客服 营销 ## 容联七陌 客服 营销
7moor-fs1.com 7moor-fs1.com
7moor.com 7moor.com
## Alook 浏览器
alookweb.com
## 安兔兔 ## 安兔兔
antutu.com antutu.com
antutu.net antutu.net
@@ -338,14 +343,27 @@ clink.cn
## 当贝 ## 当贝
dangbei.com dangbei.com
dangbei.net dangbei.net
## DCloud 数字天堂
dcloud.io
dcloud.net.cn
## 酷控 ## 酷控
deepepg.com deepepg.com
kookong.com kookong.com
## 滴答清单 ## 滴答清单
dida365.com dida365.com
## 兑吧
dui88.com
duiba.com.cn
## 快应用 ## 快应用
hapjs.org hapjs.org
quickapp.cn quickapp.cn
## 乐播投屏
hpplay.cn
lbtp.com
lebo.cn
lebo.com.cn
lebo.top
mirrorcast.cn
## 货拉拉 ## 货拉拉
huolala.cn huolala.cn
## 火绒 ## 火绒
@@ -383,6 +401,8 @@ soboten.com
tacool.com tacool.com
## Via 浏览器 ## Via 浏览器
viayoo.com viayoo.com
## X 浏览器
xbext.com
## 印象笔记 ## 印象笔记
yinxiang.com yinxiang.com
## 智联招聘 ## 智联招聘
@@ -391,19 +411,19 @@ zhaopin.cn
# Tech companies & Orginations # Tech companies & Orginations
include:aisiku # 北京艾斯酷科技有限公司 include:aisiku # 北京艾斯酷科技有限公司
include:akiko # 秋子酱科技 include:akiko # 秋子酱科技
include:alibaba include:alibaba @-!cn
include:baidu include:baidu
include:beisen include:beisen
include:bluepoch include:bluepoch
include:bytedance include:bytedance @-!cn
include:didi include:didi @-!cn
include:dingdatech # 叮哒出行(杭州金通互联科技有限公司) include:dingdatech # 叮哒出行(杭州金通互联科技有限公司)
include:dji include:dji
include:gree include:gree
include:haier include:haier
include:hikvision include:hikvision
include:honor include:honor
include:huawei include:huawei @-!cn
include:hupun # 杭州湖畔网络技术有限公司 include:hupun # 杭州湖畔网络技术有限公司
include:iflytek include:iflytek
include:ishumei # 北京数美时代科技有限公司 include:ishumei # 北京数美时代科技有限公司
@@ -415,14 +435,14 @@ include:meizu
include:midea include:midea
include:narwal # 云鲸科技 include:narwal # 云鲸科技
include:netease include:netease
include:oppo include:oppo @-!cn
include:qihoo360 include:qihoo360
include:sumkoo #北京尚古创新科技有限公司 include:sumkoo #北京尚古创新科技有限公司
include:tcl include:tcl
include:tencent include:tencent @-!cn
include:tongfang include:tongfang
include:vivo include:vivo @-!cn
include:xiaomi include:xiaomi @-!cn
include:xunlei include:xunlei
include:youquan # 祐全科技 include:youquan # 祐全科技
include:yuanbei # 上海圆贝信息科技有限公司 include:yuanbei # 上海圆贝信息科技有限公司
@@ -459,13 +479,14 @@ xsbapp.cn
# Telecommunication # Telecommunication
include:chinabroadnet include:chinabroadnet
include:chinamobile include:chinamobile @-!cn
include:chinatelecom include:chinatelecom @-!cn
include:chinatower include:chinatower
include:chinaunicom include:chinaunicom @-!cn
# 在线工具 # 在线工具
include:ipip # IPIP ip地理位置数据库 ## IPIP ip地理位置数据库
include:ipip @-!cn
chaziyu.com # 滇ICP备2024035496号 chaziyu.com # 滇ICP备2024035496号
fofa.info # Fofa网站测绘华顺信安 fofa.info # Fofa网站测绘华顺信安

View File

@@ -22,7 +22,15 @@ bard.google.com
gemini.google gemini.google
gemini.google.com gemini.google.com
# Gemini Code Assist
# https://docs.cloud.google.com/gemini/docs/codeassist/set-up-gemini
full:cloudaicompanion.googleapis.com
full:cloudcode-pa.googleapis.com
full:daily-cloudcode-pa.googleapis.com
# NotebookLM # NotebookLM
full:notebooklm-pa.googleapis.com
full:notebooklm.googleapis.com
notebooklm.google notebooklm.google
notebooklm.google.com notebooklm.google.com
@@ -41,3 +49,9 @@ aida.googleapis.com
# Opal # Opal
opal.google opal.google
opal.google.com opal.google.com
# Antigravity
full:antigravity-pa.googleapis.com
full:antigravity.googleapis.com
antigravity.google
antigravity-unleash.goog

View File

@@ -1,23 +1,23 @@
bisheng.cn @cn bisheng.cn
bishengcompiler.cn @cn bishengcompiler.cn
devui.design @cn devui.design
gneec.com @cn gneec.com
gneec.com.cn @cn gneec.com.cn
gneec3.com @cn gneec3.com
gneec4.com @cn gneec4.com
gneec7.com @cn gneec7.com
harmonyos.com @cn harmonyos.com
hiascend.cn @cn hiascend.cn
hiascend.com @cn hiascend.com
hiclc.com @cn hiclc.com
hikunpeng.cn @cn hikunpeng.cn
hikunpeng.com @cn hikunpeng.com
hikunpeng.com.cn @cn hikunpeng.com.cn
hikunpeng.net @cn hikunpeng.net
hisilicon.com @cn hisilicon.com
hisilicon.com.cn @cn hisilicon.com.cn
huaweiapaas.com @cn huaweiapaas.com
mindspore.cn @cn mindspore.cn
owsgo.com @cn owsgo.com
teleows.com @cn saasops.tech
saasops.tech @cn teleows.com

View File

@@ -1,2 +1,2 @@
kechuang.org kechuang.org
full:kc.kexinshe.com @cn kexinshe.com

View File

@@ -1,4 +1,4 @@
kurogames.com @cn kurogames.com
# Wuthering Waves # Wuthering Waves
aki-game.com @cn aki-game.com

2
data/liveperson Normal file
View File

@@ -0,0 +1,2 @@
liveperson.net
lpsnmedia.net

5
data/pubg Normal file
View File

@@ -0,0 +1,5 @@
kraftonde.com
playbattlegrounds.com
pubg.com
full:pubg1.battleye.com

View File

@@ -1 +0,0 @@
static.sensorsdata.cn @ads

4
data/standardchartered Normal file
View File

@@ -0,0 +1,4 @@
sc.com
standardchartered.com
full:standchartbank.sc.omtrdc.net
full:standchartbank.tt.omtrdc.net

View File

@@ -0,0 +1,3 @@
sih-db.com
sih.app
steaminventoryhelper.com

View File

@@ -11,4 +11,4 @@ tencentcloud.com
tjstats.com tjstats.com
wegamedeveloper.com wegamedeveloper.com
weixinbridge.com weixinbridge.com
weui.io @cn weui.io

View File

@@ -107,6 +107,7 @@ volcfcdnrd.com
volcfcdnsc.com volcfcdnsc.com
volcfxgjrtm.com volcfxgjrtm.com
volcgroup.com volcgroup.com
volcgslb-mlt.com
volcgslb.com volcgslb.com
volcgtm.com volcgtm.com
volciad.com volciad.com

View File

@@ -1,5 +1,6 @@
include:xiaomi-ads include:xiaomi-ads
include:xiaomi-ai include:xiaomi-ai
include:xiaomi-iot
mgslb.com mgslb.com
mi-idc.com mi-idc.com

5
data/xiaomi-iot Normal file
View File

@@ -0,0 +1,5 @@
# Xiaomi IoT Services
account.xiaomi.com
cn-ha.mqtt.io.mi.com
ha.api.io.mi.com
miot-spec.org

View File

@@ -1,2 +1,5 @@
xv-ru.com
xvideos-ar.com
xvideos-cdn.com xvideos-cdn.com
xvideos-india.com
xvideos.com xvideos.com

4
data/youmind Normal file
View File

@@ -0,0 +1,4 @@
# Youmind
youmind.ai
youmind.com
youmind.site

532
main.go
View File

@@ -7,7 +7,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"regexp" "regexp"
"sort" "slices"
"strings" "strings"
router "github.com/v2fly/v2ray-core/v5/app/router/routercommon" router "github.com/v2fly/v2ray-core/v5/app/router/routercommon"
@@ -29,286 +29,307 @@ const (
RuleTypeInclude string = "include" RuleTypeInclude string = "include"
) )
var (
TypeChecker = regexp.MustCompile(`^(domain|full|keyword|regexp|include)$`)
ValueChecker = regexp.MustCompile(`^[a-z0-9!\.-]+$`)
AttrChecker = regexp.MustCompile(`^[a-z0-9!-]+$`)
SiteChecker = regexp.MustCompile(`^[A-Z0-9!-]+$`)
)
var (
refMap = make(map[string][]*Entry)
plMap = make(map[string]*ParsedList)
finalMap = make(map[string][]*Entry)
cirIncMap = make(map[string]bool) // Used for circular inclusion detection
)
type Entry struct { type Entry struct {
Type string Type string
Value string Value string
Attrs []*router.Domain_Attribute Attrs []string
Plain string
Affs []string
} }
type List struct { type Inclusion struct {
Name string Source string
Entry []Entry MustAttrs []string
BanAttrs []string
} }
type ParsedList struct { type ParsedList struct {
Name string Name string
Inclusion map[string]bool Inclusions []*Inclusion
Entry []Entry Entries []*Entry
} }
func (l *ParsedList) toPlainText(listName string) error { func makeProtoList(listName string, entries []*Entry) (*router.GeoSite, error) {
var entryBytes []byte
for _, entry := range l.Entry {
var attrString string
if entry.Attrs != nil {
for _, attr := range entry.Attrs {
attrString += "@" + attr.GetKey() + ","
}
attrString = strings.TrimRight(":"+attrString, ",")
}
// Entry output format is: type:domain.tld:@attr1,@attr2
entryBytes = append(entryBytes, []byte(entry.Type+":"+entry.Value+attrString+"\n")...)
}
if err := os.WriteFile(filepath.Join(*outputDir, listName+".txt"), entryBytes, 0644); err != nil {
return err
}
return nil
}
func (l *ParsedList) toProto() (*router.GeoSite, error) {
site := &router.GeoSite{ site := &router.GeoSite{
CountryCode: l.Name, CountryCode: listName,
Domain: make([]*router.Domain, 0, len(entries)),
} }
for _, entry := range l.Entry { for _, entry := range entries {
pdomain := &router.Domain{Value: entry.Value}
for _, attr := range entry.Attrs {
pdomain.Attribute = append(pdomain.Attribute, &router.Domain_Attribute{
Key: attr,
TypedValue: &router.Domain_Attribute_BoolValue{BoolValue: true},
})
}
switch entry.Type { switch entry.Type {
case RuleTypeDomain: case RuleTypeDomain:
site.Domain = append(site.Domain, &router.Domain{ pdomain.Type = router.Domain_RootDomain
Type: router.Domain_RootDomain,
Value: entry.Value,
Attribute: entry.Attrs,
})
case RuleTypeRegexp: case RuleTypeRegexp:
// check regexp validity to avoid runtime error pdomain.Type = router.Domain_Regex
_, err := regexp.Compile(entry.Value)
if err != nil {
return nil, fmt.Errorf("invalid regexp in list %s: %s", l.Name, entry.Value)
}
site.Domain = append(site.Domain, &router.Domain{
Type: router.Domain_Regex,
Value: entry.Value,
Attribute: entry.Attrs,
})
case RuleTypeKeyword: case RuleTypeKeyword:
site.Domain = append(site.Domain, &router.Domain{ pdomain.Type = router.Domain_Plain
Type: router.Domain_Plain,
Value: entry.Value,
Attribute: entry.Attrs,
})
case RuleTypeFullDomain: case RuleTypeFullDomain:
site.Domain = append(site.Domain, &router.Domain{ pdomain.Type = router.Domain_Full
Type: router.Domain_Full,
Value: entry.Value,
Attribute: entry.Attrs,
})
default:
return nil, fmt.Errorf("unknown domain type: %s", entry.Type)
} }
site.Domain = append(site.Domain, pdomain)
} }
return site, nil return site, nil
} }
func exportPlainTextList(list []string, refName string, pl *ParsedList) { func writePlainList(exportedName string) error {
for _, listName := range list { targetList, exist := finalMap[strings.ToUpper(exportedName)]
if strings.EqualFold(refName, listName) { if !exist || len(targetList) == 0 {
if err := pl.toPlainText(strings.ToLower(refName)); err != nil { return fmt.Errorf("'%s' list does not exist or is empty.", exportedName)
fmt.Println("Failed:", err)
continue
}
fmt.Printf("'%s' has been generated successfully.\n", listName)
}
} }
file, err := os.Create(filepath.Join(*outputDir, strings.ToLower(exportedName) + ".txt"))
if err != nil {
return err
}
defer file.Close()
w := bufio.NewWriter(file)
for _, entry := range targetList {
fmt.Fprintln(w, entry.Plain)
}
return w.Flush()
} }
func removeComment(line string) string { func parseEntry(line string) (Entry, error) {
idx := strings.Index(line, "#") var entry Entry
if idx == -1 { parts := strings.Fields(line)
return line
}
return strings.TrimSpace(line[:idx])
}
func parseDomain(domain string, entry *Entry) error { // Parse type and value
kv := strings.Split(domain, ":") rawTypeVal := parts[0]
kv := strings.Split(rawTypeVal, ":")
if len(kv) == 1 { if len(kv) == 1 {
entry.Type = RuleTypeDomain entry.Type = RuleTypeDomain // Default type
entry.Value = strings.ToLower(kv[0]) entry.Value = strings.ToLower(rawTypeVal)
return nil } else if len(kv) == 2 {
}
if len(kv) == 2 {
entry.Type = strings.ToLower(kv[0]) entry.Type = strings.ToLower(kv[0])
if entry.Type == RuleTypeRegexp {
if strings.EqualFold(entry.Type, RuleTypeRegexp) {
entry.Value = kv[1] entry.Value = kv[1]
} else { } else {
entry.Value = strings.ToLower(kv[1]) entry.Value = strings.ToLower(kv[1])
} }
} else {
return nil return entry, fmt.Errorf("invalid format: %s", line)
} }
// Check type and value
return fmt.Errorf("invalid format: %s", domain) if !TypeChecker.MatchString(entry.Type) {
} return entry, fmt.Errorf("invalid type: %s", entry.Type)
func parseAttribute(attr string) (*router.Domain_Attribute, error) {
var attribute router.Domain_Attribute
if len(attr) == 0 || attr[0] != '@' {
return &attribute, fmt.Errorf("invalid attribute: %s", attr)
} }
if entry.Type == RuleTypeRegexp {
attribute.Key = strings.ToLower(attr[1:]) // Trim attribute prefix `@` character if _, err := regexp.Compile(entry.Value); err != nil {
attribute.TypedValue = &router.Domain_Attribute_BoolValue{BoolValue: true} return entry, fmt.Errorf("invalid regexp: %s", entry.Value)
return &attribute, nil
}
func parseEntry(line string) (Entry, error) {
line = strings.TrimSpace(line)
parts := strings.Split(line, " ")
var entry Entry
if len(parts) == 0 {
return entry, fmt.Errorf("empty entry")
}
if err := parseDomain(parts[0], &entry); err != nil {
return entry, err
}
for i := 1; i < len(parts); i++ {
attr, err := parseAttribute(parts[i])
if err != nil {
return entry, err
} }
entry.Attrs = append(entry.Attrs, attr) } else if !ValueChecker.MatchString(entry.Value) {
return entry, fmt.Errorf("invalid value: %s", entry.Value)
}
// Parse/Check attributes and affiliations
for _, part := range parts[1:] {
if strings.HasPrefix(part, "@") {
attr := strings.ToLower(part[1:]) // Trim attribute prefix `@` character
if !AttrChecker.MatchString(attr) {
return entry, fmt.Errorf("invalid attribute key: %s", attr)
}
entry.Attrs = append(entry.Attrs, attr)
} else if strings.HasPrefix(part, "&") {
aff := strings.ToUpper(part[1:]) // Trim affiliation prefix `&` character
if !SiteChecker.MatchString(aff) {
return entry, fmt.Errorf("invalid affiliation key: %s", aff)
}
entry.Affs = append(entry.Affs, aff)
} else {
return entry, fmt.Errorf("invalid attribute/affiliation: %s", part)
}
}
// Sort attributes
slices.Sort(entry.Attrs)
// Formated plain entry: type:domain.tld:@attr1,@attr2
entry.Plain = entry.Type + ":" + entry.Value
if len(entry.Attrs) != 0 {
entry.Plain = entry.Plain + ":@" + strings.Join(entry.Attrs, ",@")
} }
return entry, nil return entry, nil
} }
func Load(path string) (*List, error) { func loadData(path string) error {
file, err := os.Open(path) file, err := os.Open(path)
if err != nil { if err != nil {
return nil, err return err
} }
defer file.Close() defer file.Close()
list := &List{ listName := strings.ToUpper(filepath.Base(path))
Name: strings.ToUpper(filepath.Base(path)), if !SiteChecker.MatchString(listName) {
return fmt.Errorf("invalid list name: %s", listName)
} }
scanner := bufio.NewScanner(file) scanner := bufio.NewScanner(file)
lineIdx := 0
for scanner.Scan() { for scanner.Scan() {
line := strings.TrimSpace(scanner.Text()) line := scanner.Text()
line = removeComment(line) lineIdx++
if len(line) == 0 { // Remove comments
if idx := strings.Index(line, "#"); idx != -1 {
line = line[:idx]
}
line = strings.TrimSpace(line)
if line == "" {
continue continue
} }
entry, err := parseEntry(line) entry, err := parseEntry(line)
if err != nil { if err != nil {
return nil, err return fmt.Errorf("error in %s at line %d: %v", path, lineIdx, err)
} }
list.Entry = append(list.Entry, entry) refMap[listName] = append(refMap[listName], &entry)
} }
return nil
return list, nil
} }
func isMatchAttr(Attrs []*router.Domain_Attribute, includeKey string) bool { func parseList(refName string, refList []*Entry) error {
isMatch := false pl, _ := plMap[refName]
mustMatch := true if pl == nil {
matchName := includeKey pl = &ParsedList{Name: refName}
if strings.HasPrefix(includeKey, "!") { plMap[refName] = pl
isMatch = true
mustMatch = false
matchName = strings.TrimLeft(includeKey, "!")
} }
for _, entry := range refList {
for _, Attr := range Attrs { if entry.Type == RuleTypeInclude {
attrName := Attr.Key if len(entry.Affs) != 0 {
if mustMatch { return fmt.Errorf("affiliation is not allowed for include:%s", entry.Value)
if matchName == attrName {
isMatch = true
break
} }
} else { inc := &Inclusion{Source: strings.ToUpper(entry.Value)}
if matchName == attrName { for _, attr := range entry.Attrs {
isMatch = false if strings.HasPrefix(attr, "-") {
break inc.BanAttrs = append(inc.BanAttrs, attr[1:]) // Trim attribute prefix `-` character
}
}
}
return isMatch
}
func createIncludeAttrEntrys(list *List, matchAttr *router.Domain_Attribute) []Entry {
newEntryList := make([]Entry, 0, len(list.Entry))
matchName := matchAttr.Key
for _, entry := range list.Entry {
matched := isMatchAttr(entry.Attrs, matchName)
if matched {
newEntryList = append(newEntryList, entry)
}
}
return newEntryList
}
func ParseList(list *List, ref map[string]*List) (*ParsedList, error) {
pl := &ParsedList{
Name: list.Name,
Inclusion: make(map[string]bool),
}
entryList := list.Entry
for {
newEntryList := make([]Entry, 0, len(entryList))
hasInclude := false
for _, entry := range entryList {
if entry.Type == RuleTypeInclude {
refName := strings.ToUpper(entry.Value)
if entry.Attrs != nil {
for _, attr := range entry.Attrs {
InclusionName := strings.ToUpper(refName + "@" + attr.Key)
if pl.Inclusion[InclusionName] {
continue
}
pl.Inclusion[InclusionName] = true
refList := ref[refName]
if refList == nil {
return nil, fmt.Errorf("list not found: %s", entry.Value)
}
attrEntrys := createIncludeAttrEntrys(refList, attr)
if len(attrEntrys) != 0 {
newEntryList = append(newEntryList, attrEntrys...)
}
}
} else { } else {
InclusionName := refName inc.MustAttrs = append(inc.MustAttrs, attr)
if pl.Inclusion[InclusionName] {
continue
}
pl.Inclusion[InclusionName] = true
refList := ref[refName]
if refList == nil {
return nil, fmt.Errorf("list not found: %s", entry.Value)
}
newEntryList = append(newEntryList, refList.Entry...)
} }
hasInclude = true
} else {
newEntryList = append(newEntryList, entry)
} }
} pl.Inclusions = append(pl.Inclusions, inc)
entryList = newEntryList } else {
if !hasInclude { for _, aff := range entry.Affs {
break apl, _ := plMap[aff]
if apl == nil {
apl = &ParsedList{Name: aff}
plMap[aff] = apl
}
apl.Entries = append(apl.Entries, entry)
}
pl.Entries = append(pl.Entries, entry)
} }
} }
pl.Entry = entryList return nil
}
return pl, nil func polishList(roughMap *map[string]*Entry) []*Entry {
finalList := make([]*Entry, 0, len(*roughMap))
queuingList := make([]*Entry, 0, len(*roughMap)) // Domain/full entries without attr
domainsMap := make(map[string]bool)
for _, entry := range *roughMap {
switch entry.Type { // Bypass regexp, keyword and "full/domain with attr"
case RuleTypeRegexp:
finalList = append(finalList, entry)
case RuleTypeKeyword:
finalList = append(finalList, entry)
case RuleTypeDomain:
domainsMap[entry.Value] = true
if len(entry.Attrs) != 0 {
finalList = append(finalList, entry)
} else {
queuingList = append(queuingList, entry)
}
case RuleTypeFullDomain:
if len(entry.Attrs) != 0 {
finalList = append(finalList, entry)
} else {
queuingList = append(queuingList, entry)
}
}
}
// Remove redundant subdomains for full/domain without attr
for _, qentry := range queuingList {
isRedundant := false
pd := qentry.Value // Parent domain
for {
idx := strings.Index(pd, ".")
if idx == -1 { break }
pd = pd[idx+1:] // Go for next parent
if !strings.Contains(pd, ".") { break } // Not allow tld to be a parent
if domainsMap[pd] {
isRedundant = true
break
}
}
if !isRedundant {
finalList = append(finalList, qentry)
}
}
// Sort final entries
slices.SortFunc(finalList, func(a, b *Entry) int {
return strings.Compare(a.Plain, b.Plain)
})
return finalList
}
func resolveList(pl *ParsedList) error {
if _, pldone := finalMap[pl.Name]; pldone { return nil }
if cirIncMap[pl.Name] {
return fmt.Errorf("circular inclusion in: %s", pl.Name)
}
cirIncMap[pl.Name] = true
defer delete(cirIncMap, pl.Name)
isMatchAttrFilters := func(entry *Entry, incFilter *Inclusion) bool {
if len(incFilter.MustAttrs) == 0 && len(incFilter.BanAttrs) == 0 { return true }
if len(entry.Attrs) == 0 { return len(incFilter.MustAttrs) == 0 }
for _, m := range incFilter.MustAttrs {
if !slices.Contains(entry.Attrs, m) { return false }
}
for _, b := range incFilter.BanAttrs {
if slices.Contains(entry.Attrs, b) { return false }
}
return true
}
roughMap := make(map[string]*Entry) // Avoid basic duplicates
for _, dentry := range pl.Entries { // Add direct entries
roughMap[dentry.Plain] = dentry
}
for _, inc := range pl.Inclusions {
incPl, exist := plMap[inc.Source]
if !exist {
return fmt.Errorf("list '%s' includes a non-existent list: '%s'", pl.Name, inc.Source)
}
if err := resolveList(incPl); err != nil {
return err
}
for _, ientry := range finalMap[inc.Source] {
if isMatchAttrFilters(ientry, inc) { // Add included entries
roughMap[ientry.Plain] = ientry
}
}
}
finalMap[pl.Name] = polishList(&roughMap)
return nil
} }
func main() { func main() {
@@ -317,7 +338,7 @@ func main() {
dir := *dataPath dir := *dataPath
fmt.Println("Use domain lists in", dir) fmt.Println("Use domain lists in", dir)
ref := make(map[string]*List) // Generate refMap
err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error { err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
if err != nil { if err != nil {
return err return err
@@ -325,18 +346,32 @@ func main() {
if info.IsDir() { if info.IsDir() {
return nil return nil
} }
list, err := Load(path) if err := loadData(path); err != nil {
if err != nil {
return err return err
} }
ref[list.Name] = list
return nil return nil
}) })
if err != nil { if err != nil {
fmt.Println("Failed:", err) fmt.Println("Failed to loadData:", err)
os.Exit(1) os.Exit(1)
} }
// Generate plMap
for refName, refList := range refMap {
if err := parseList(refName, refList); err != nil {
fmt.Println("Failed to parseList:", err)
os.Exit(1)
}
}
// Generate finalMap
for _, pl := range plMap {
if err := resolveList(pl); err != nil {
fmt.Println("Failed to resolveList:", err)
os.Exit(1)
}
}
// Create output directory if not exist // Create output directory if not exist
if _, err := os.Stat(*outputDir); os.IsNotExist(err) { if _, err := os.Stat(*outputDir); os.IsNotExist(err) {
if mkErr := os.MkdirAll(*outputDir, 0755); mkErr != nil { if mkErr := os.MkdirAll(*outputDir, 0755); mkErr != nil {
@@ -345,55 +380,40 @@ func main() {
} }
} }
protoList := new(router.GeoSiteList) // Export plaintext list
var existList []string if *exportLists != "" {
for refName, list := range ref { exportedListSlice := strings.Split(*exportLists, ",")
pl, err := ParseList(list, ref) for _, exportedList := range exportedListSlice {
if err != nil { if err := writePlainList(exportedList); err != nil {
fmt.Println("Failed:", err) fmt.Println("Failed to write list:", err)
os.Exit(1) continue
}
fmt.Printf("list: '%s' has been generated successfully.\n", exportedList)
} }
site, err := pl.toProto() }
// Generate dat file
protoList := new(router.GeoSiteList)
for siteName, siteEntries := range finalMap {
site, err := makeProtoList(siteName, siteEntries)
if err != nil { if err != nil {
fmt.Println("Failed:", err) fmt.Println("Failed:", err)
os.Exit(1) os.Exit(1)
} }
protoList.Entry = append(protoList.Entry, site) protoList.Entry = append(protoList.Entry, site)
// Flatten and export plaintext list
if *exportLists != "" {
if existList != nil {
exportPlainTextList(existList, refName, pl)
} else {
exportedListSlice := strings.Split(*exportLists, ",")
for _, exportedListName := range exportedListSlice {
fileName := filepath.Join(dir, exportedListName)
_, err := os.Stat(fileName)
if err == nil || os.IsExist(err) {
existList = append(existList, exportedListName)
} else {
fmt.Printf("'%s' list does not exist in '%s' directory.\n", exportedListName, dir)
}
}
if existList != nil {
exportPlainTextList(existList, refName, pl)
}
}
}
} }
// Sort protoList so the marshaled list is reproducible // Sort protoList so the marshaled list is reproducible
sort.SliceStable(protoList.Entry, func(i, j int) bool { slices.SortFunc(protoList.Entry, func(a, b *router.GeoSite) int {
return protoList.Entry[i].CountryCode < protoList.Entry[j].CountryCode return strings.Compare(a.CountryCode, b.CountryCode)
}) })
protoBytes, err := proto.Marshal(protoList) protoBytes, err := proto.Marshal(protoList)
if err != nil { if err != nil {
fmt.Println("Failed:", err) fmt.Println("Failed to marshal:", err)
os.Exit(1) os.Exit(1)
} }
if err := os.WriteFile(filepath.Join(*outputDir, *outputName), protoBytes, 0644); err != nil { if err := os.WriteFile(filepath.Join(*outputDir, *outputName), protoBytes, 0644); err != nil {
fmt.Println("Failed:", err) fmt.Println("Failed to write output:", err)
os.Exit(1) os.Exit(1)
} else { } else {
fmt.Println(*outputName, "has been generated successfully.") fmt.Println(*outputName, "has been generated successfully.")