Compare commits

...

18 Commits

Author SHA1 Message Date
Loyalsoldier
4d45b17cd8 Chore: refine code (#3067) 2025-12-17 00:45:09 +08:00
Loyalsoldier
d8bd29ce92 Fix: incorrect lowercase for regexp rules (#3066) 2025-12-17 00:17:43 +08:00
Loyalsoldier
72eb885658 Refine: extract rule type (#3065) 2025-12-17 00:10:33 +08:00
风扇滑翔翼
93bfcfd142 Feat: check regexp before build (#3064)
Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
2025-12-16 23:40:25 +08:00
DeepChirp
cbe19f0562 picacg-ads: split from picacg 2025-12-16 21:42:59 +08:00
DeepChirp
ea99bef4a2 google-ads: comment out problematic rule 2025-12-16 21:42:59 +08:00
深鸣
9b01521761 ctyun: add new entry (#3059) 2025-12-16 21:24:37 +08:00
深鸣
8d50851b58 umeng-ads: add more domains (#3060) 2025-12-16 21:13:11 +08:00
sklimoff
16923730a4 Add wink and include it in category-ru (#3058) 2025-12-16 21:06:32 +08:00
Luo Chen
7e3137a0d1 Fix #3055 (#3056) 2025-12-16 09:54:53 +08:00
tooadstool
6b4c09860b Add Ookla Speedtest Central to the list (#3053)
* Add Ookla Speedtest Central to the list

* Update ookla-speedtest

---------

Co-authored-by: rootmelo92118 <32770959+rootmelo92118@users.noreply.github.com>
2025-12-15 22:40:47 +08:00
Jiew-KueJwiaeng
6a11042b92 Update 18comic & picacg (#2695)
* Update 18comic

* Update picacg

* Update 18comic

---------

Co-authored-by: rootmelo92118 <32770959+rootmelo92118@users.noreply.github.com>
2025-12-15 22:38:15 +08:00
dependabot[bot]
5a2d4ca56a Chore: bump actions/upload-artifact from 5 to 6 (#3051)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-15 12:54:55 +08:00
深鸣
22997b1833 category-education-cn: add neea.cn (#3050)
[skip ci]
2025-12-14 23:38:53 +08:00
Nomad Chen
182647ca79 category-ai-!cn: add kiro.dev (#3048) 2025-12-13 17:35:46 +08:00
深鸣
c40fdf359e Add more ad domains (#3047)
* Add more ad domains

* Rename msn-ads to microsoft-ads

---------

Co-authored-by: MkQtS <81752398+MkQtS@users.noreply.github.com>
2025-12-13 15:20:31 +08:00
深鸣
bc788dad86 Add some game-related domains (#3045)
ref: <https://zh.wikipedia.org/wiki/WikiProject:%E7%94%B5%E5%AD%90%E6%B8%B8%E6%88%8F/%E6%9D%A5%E6%BA%90%E8%80%83%E9%87%8F>

Co-authored-by: MkQtS <81752398+MkQtS@users.noreply.github.com>
2025-12-12 19:21:05 +08:00
深鸣
eea5617a98 baishancloud: add new entry (#3046) 2025-12-12 18:15:31 +08:00
34 changed files with 358 additions and 43 deletions

View File

@@ -34,7 +34,7 @@ jobs:
mv dlc.dat TEST-${{ github.run_number }}-dlc.dat mv dlc.dat TEST-${{ github.run_number }}-dlc.dat
- name: Upload TEST-${{ github.run_number }}-dlc.dat - name: Upload TEST-${{ github.run_number }}-dlc.dat
uses: actions/upload-artifact@v5 uses: actions/upload-artifact@v6
with: with:
name: TEST-${{ github.run_number }}-dlc.dat name: TEST-${{ github.run_number }}-dlc.dat
path: TEST-${{ github.run_number }}-dlc.dat path: TEST-${{ github.run_number }}-dlc.dat

View File

@@ -5,11 +5,47 @@
18comic.company 18comic.company
18comic.org 18comic.org
18comic.vip 18comic.vip
asjmapihost.cc
cdnblackmyth.club
cdnmhws.cc
cdnmhwscc.vip
cdnuc.vip
cdnxxx-proxy.co
cdnxxx-proxy.xyz
jm-comic2.cc
jm18c-bbm.cc
jm18c-bbm.net
jm18c-uoi.net
jm365.work
jm365.xyz
jmapibranch1.cc
jmapibranch2.cc
jmapibranch3.cc
jmapinode.biz
jmapinode.vip
jmapinode.xyz
jmapinode1.top
jmapinode2.top
jmapinode3.top
jmapinodeudzn.net
jmapinodeudzn.xyz
jmapiproxy1.cc
jmapiproxy1.monster
jmapiproxy2.cc
jmapiproxy3.cc
jmapiproxy4.cc
jmapiproxyxxx.vip
jmcomic.group
jmcomic.ltd jmcomic.ltd
jmcomic.me jmcomic.me
jmcomic.mobi jmcomic.mobi
jmcomic.moe jmcomic.moe
jmcomic.rocks
jmcomic-fb.vip
jmcomic-zzz.one
jmcomic-zzz.org
jmcomic1.city jmcomic1.city
jmcomic1.me jmcomic1.me
jmcomic1.mobi jmcomic1.mobi
jmcomic1.rocks
jmcomic2.moe jmcomic2.moe

1
data/9game Normal file
View File

@@ -0,0 +1 @@
9game.cn

View File

@@ -10,6 +10,7 @@ taobao
# All .tmall domains # All .tmall domains
tmall tmall
include:9game
include:alibaba-ads include:alibaba-ads
include:alibabacloud include:alibabacloud
include:aliyun include:aliyun
@@ -25,7 +26,6 @@ include:youku
25pp.com 25pp.com
56che.com 56che.com
95095.com 95095.com
9game.cn
ali-health.com ali-health.com
aliapp.org aliapp.org
alibaba-inc.com alibaba-inc.com

View File

@@ -1,3 +1,4 @@
include:amap-ads
include:youku-ads include:youku-ads
a.alimama.cn @ads a.alimama.cn @ads
@@ -10,7 +11,6 @@ adash.man.aliyuncs.com @ads
adashbc.m.taobao.com @ads adashbc.m.taobao.com @ads
adashbc.ut.taobao.com @ads adashbc.ut.taobao.com @ads
adashx.m.taobao.com @ads adashx.m.taobao.com @ads
adashx.ut.amap.com @ads
adashx.ut.ele.me @ads adashx.ut.ele.me @ads
adashx4ae.ut.taobao.com @ads adashx4ae.ut.taobao.com @ads
adashx4yt.m.taobao.com @ads adashx4yt.m.taobao.com @ads
@@ -38,7 +38,6 @@ retcode.taobao.com @ads
tce.alicdn.com @ads tce.alicdn.com @ads
tns.simba.taobao.com @ads tns.simba.taobao.com @ads
track.lc.quark.cn @ads track.lc.quark.cn @ads
v6-adashx.ut.amap.com @ads
v6-adashx.ut.cainiao.com @ads v6-adashx.ut.cainiao.com @ads
v6-adashx.ut.ele.me @ads v6-adashx.ut.ele.me @ads
v6-adashx.ut.taobao.com @ads v6-adashx.ut.taobao.com @ads

View File

@@ -1,3 +1,5 @@
include:amap-ads
a-map.cn a-map.cn
a-map.co a-map.co
a-map.link a-map.link

5
data/amap-ads Normal file
View File

@@ -0,0 +1,5 @@
adashx.ut.amap.com @ads
dualstack-logs.amap.com @ads
logs.amap.com @ads
optimus-ads.amap.com @ads
v6-adashx.ut.amap.com @ads

3
data/baishancloud Normal file
View File

@@ -0,0 +1,3 @@
bsclink.cn
qingcdn.com
trpcdn.net

View File

@@ -30,6 +30,7 @@ include:kuaishou-ads
include:kugou-ads include:kugou-ads
include:letv-ads include:letv-ads
include:meta-ads include:meta-ads
include:microsoft-ads
include:mopub-ads include:mopub-ads
include:mxplayer-ads include:mxplayer-ads
include:netease-ads include:netease-ads
@@ -37,6 +38,7 @@ include:newrelic-ads
include:ogury-ads include:ogury-ads
include:ookla-speedtest-ads include:ookla-speedtest-ads
include:openx-ads include:openx-ads
include:picacg-ads
include:pocoiq-ads include:pocoiq-ads
include:pubmatic-ads include:pubmatic-ads
include:qihoo360-ads include:qihoo360-ads
@@ -57,7 +59,7 @@ include:xhamster-ads
include:xiaomi-ads include:xiaomi-ads
include:ximalaya-ads include:ximalaya-ads
include:yahoo-ads include:yahoo-ads
include:youku-ads include:zhihu-ads
# Other domains for ads serving # Other domains for ads serving
51.la 51.la

View File

@@ -31,6 +31,7 @@ diabrowser.com
dify.ai dify.ai
duck.ai duck.ai
gateway.ai.cloudflare.com gateway.ai.cloudflare.com
kiro.dev
meta.ai meta.ai
mistral.ai mistral.ai
openart.ai openart.ai

View File

@@ -53,6 +53,11 @@ qgzb.net
zbbm.gov.cn zbbm.gov.cn
zbbm.net zbbm.net
# 中国考试教育网
# 京ICP备05064772号
neea.cn
# neea.edu.cn
# 云校 # 云校
91yunxiao.com 91yunxiao.com
# 爱云校/好分数 # 爱云校/好分数

View File

@@ -83,6 +83,7 @@ egta.com
fireside.fm fireside.fm
internationalsaimoe.com internationalsaimoe.com
joox.com joox.com
kpacg.com
linetv.tw linetv.tw
megaphone.fm megaphone.fm
mikanani.me mikanani.me
@@ -100,3 +101,71 @@ yande.re
amp-api.podcast.apple.com amp-api.podcast.apple.com
bag.itunes.apple.com bag.itunes.apple.com
bookeeper.itunes.apple.com bookeeper.itunes.apple.com
# Entertainment oriented media
## 4Gamer.net
4gamer.net
## 4Gamers
4gamers.com.tw
## 秋葉原綜研
akiba-souken.com
## Appget
appget.com
## AppMedia
appmedia.jp
## Automaton
automaton-media.com
## 电faminicogamer
denfaminicogamer.jp
## ASCII Media Works
dengekionline.com
## E-ROAD
eroge-road.com
## ファミ通
famitsu.com
## 遊戲基地
gamebase.com.tw
## gamebiz
gamebiz.jp
## IID, Inc.
gamebusiness.jp
gamespark.jp
inside-games.jp
## GameMeca
gamemeca.com
## Gameover有機網
gameover.com.hk
## Gamer
gamer.ne.jp
onlinegamer.jp
## Great Game
greatgame.asia
## HobbiGame
hobbigame.com
## IGN
ign.com
ignimg.com
## Made with Unity
madewithunity.jp
## Media Clip
mediaclip.jp
## 電脳世界のひみつ基地
maedahiroyuki.com
## MANTANWEB
mantan-web.jp
## Moepedia
moepedia.net
## QooApp
qoo-app.com
## Real Sound
realsound.jp
## Saiga NAK
saiganak.com
## The Games Daily
tgdaily.co.kr
## Thisisgame
thisisgame.com
## Wanuxi
wanuxi.com
## よろず〜
yorozoonews.jp

View File

@@ -46,12 +46,8 @@ yeshen.com
# 17K小说 # 17K小说
17k.com 17k.com
# 3DM游戏网
3dmgame.com
# https://github.com/supzhang/epg # https://github.com/supzhang/epg
51zmt.top 51zmt.top
# 游侠网
ali213.net
# 暴风影音 # 暴风影音
baofeng.com baofeng.com
baofeng.net baofeng.net
@@ -109,3 +105,47 @@ zhanqi.tv
zhulang.com zhulang.com
# 纵横小说 # 纵横小说
zongheng.com zongheng.com
# 娱乐资讯媒体
include:tgbus
include:vgtime
## 17173网
17173.com
## 18183网
18183.com
## 3DM游戏网
3dmgame.com
## 游侠网
ali213.net
## 竞核
cgames.com
## 触乐
chuapp.com
## DataEye
dataeye.com
## GameDiary
gamediary.cn
## GameLook
gamelook.com.cn
## GameRes游资网
gameres.com
## 游戏价值论
gamewower.com
## 机核
gcores.com
## IGN中国
ign.com.cn
## 手游那点事
nadianshi.com
## 游戏日报
news.yxrb.net
## 游戏机实用技术
ucg.cn
## 游戏茶馆
youxichaguan.com
## 游戏葡萄
youxiputao.com
## 游研社
yystv.cn

View File

@@ -1,4 +1,5 @@
include:4399 include:4399
include:9game
include:bilibili-game include:bilibili-game
include:bluepoch-games include:bluepoch-games
include:cowlevel include:cowlevel
@@ -6,13 +7,13 @@ include:herogame
include:kurogames include:kurogames
include:mihoyo-cn include:mihoyo-cn
include:tencent-games include:tencent-games
include:tgbus
include:tiancity include:tiancity
include:vgtime
include:vrzwk include:vrzwk
include:xd include:xd
include:yokaverse include:yokaverse
# 北京奇客创想科技有限公司
7k7k.com
# 刀锋盒子 皖B2-20190103-4 # 刀锋盒子 皖B2-20190103-4
9xgame.com 9xgame.com
# 《异象回声》游戏官网 沪ICP备2023010411号-1 # 《异象回声》游戏官网 沪ICP备2023010411号-1

View File

@@ -1,3 +1,4 @@
# Entertainment(games) oriented media should be added in category-entertainment[-cn]
include:category-tech-media include:category-tech-media
include:6park include:6park
@@ -90,10 +91,12 @@ chinaeconomicreview.com
cmmedia.com.tw cmmedia.com.tw
cna.com.tw cna.com.tw
cnyes.com cnyes.com
cool3c.com
coolloud.org.tw coolloud.org.tw
cup.com.hk cup.com.hk
cw.com.tw cw.com.tw
d100.net d100.net
donga.com
ebc.net.tw ebc.net.tw
ettoday.net ettoday.net
eventsinfocus.org eventsinfocus.org
@@ -101,6 +104,7 @@ factwire.org
fortuneinsight.com fortuneinsight.com
freebeacon.com freebeacon.com
gbnews.uk gbnews.uk
getnews.jp
hk01.com hk01.com
hkcitizenmedia.com hkcitizenmedia.com
hkcnews.com hkcnews.com
@@ -109,11 +113,13 @@ hkgpao.com
hongkongfp.com hongkongfp.com
inmediahk.net inmediahk.net
inside.com.tw inside.com.tw
itmedia.co.jp
jfengtime.com jfengtime.com
landofhope.tv landofhope.tv
limedia.tw limedia.tw
localpresshk.com localpresshk.com
ltsports.com.tw ltsports.com.tw
macaodaily.com
mdnkids.com mdnkids.com
mirrormedia.com.tw mirrormedia.com.tw
mirrormedia.mg mirrormedia.mg
@@ -157,6 +163,7 @@ upmedia.mg
vjmedia.com.hk vjmedia.com.hk
warroom.org warroom.org
washingtonpost.com washingtonpost.com
watch.impress.co.jp
wealth.com.tw wealth.com.tw
weiyuksj.com weiyuksj.com
wenzhao.ca wenzhao.ca

View File

@@ -70,8 +70,6 @@ dzwww.com
expreview.com expreview.com
# FreeBuf 网络安全行业门户 # FreeBuf 网络安全行业门户
freebuf.com freebuf.com
# 机核
gcores.com
# 极客公园 # 极客公园
geekpark.net geekpark.net
# 光明网 # 光明网
@@ -88,6 +86,8 @@ huanqiucdn.cn
# 虎嗅 # 虎嗅
huxiu.com huxiu.com
huxiucdn.com huxiucdn.com
# 电脑报
icpcw.com
# 中国IDC圈 # 中国IDC圈
idcquan.com idcquan.com
# 艾瑞咨询 # 艾瑞咨询
@@ -115,6 +115,8 @@ kksmg.com
statickksmg.com statickksmg.com
# 晚点 # 晚点
latepost.com latepost.com
# 快科技
mydrivers.com
# 南岳新闻网 # 南岳新闻网
nanyuenews.com nanyuenews.com
# 每日经济新闻报社 # 每日经济新闻报社
@@ -174,6 +176,8 @@ thsi.cn
ths123.com ths123.com
# 人人都是产品经理 # 人人都是产品经理
woshipm.com woshipm.com
# 新快报
xkb.com.cn
# 第一财经 # 第一财经
yicai.com yicai.com
# ZEALER # ZEALER

View File

@@ -23,5 +23,6 @@ include:mailru-group
include:okko include:okko
include:ozon include:ozon
include:rutube include:rutube
include:wink
include:x5 include:x5
include:yandex include:yandex

69
data/ctyun Normal file
View File

@@ -0,0 +1,69 @@
# 天翼云
# 京ICP备2021034386号
ctadns.cn
bjctyiptv.cn
cqctyiptv.cn
ctacdn.cn
ctaigw.cn
ctbcdn.com
ctcdn.cn
ctcdn.com.cn
ctcdnov.net
ctcloudzos.cn
ctcns.cn
ctdcdn.com
ctdns.cn
ctdns.com.cn
ctdns.net
ctecdn.cn
ctecx.cn
ctgcdn.com
cthcdn.cn
cthcdn.com
cthcdn.net
ctlcdn.cn
ctlcdn.com
ctlcdn.net
ctmcdn.cn
ctovcdn.com
ctrender.com
ctwcdn.cn
ctxcdn.cn
ctxcdn.com
ctxcdn.net
ctxirang.cn
ctxirang.com
ctycdn.cn
ctycdn.net
ctycdn.net.cn
ctydoh.cn
ctyecx.cn
ctyiptv.cn
ctyun.cn
ctyun.com.cn
ctyuncdn.cn
ctyuncs.cn
ctyuninner.com
ctyunmds.cn
ctyunwaf.cn
ctyunwaf.com
ctyunwaf1.com
ctyunwaf3.cn
ctyunxs.cn
ctyunzos.cn
ctzcdn.cn
ctzcdn.com
edgecloudx.cn
faasapp.cn
faasdev.cn
fjctyiptv.cn
gdctyiptv.cn
gsctyiptv.cn
gsjtyiptv.cn
gzctyiptv.cn
jsctyiptv.cn
modelers.cn
scctyiptv.cn
snctyiptv.cn
ynctyiptv.cn
ynjtyiptv.cn

View File

@@ -31,6 +31,8 @@ include:typenetwork
include:typography include:typography
include:webtype include:webtype
bunka.go.jp
# Automobile # Automobile
include:bmw include:bmw
include:bridgestone include:bridgestone

View File

@@ -51,8 +51,10 @@ lufaxcdn.com
# CDN or SDWAN # CDN or SDWAN
include:aws-cn include:aws-cn
include:baishancloud
include:bootcdn include:bootcdn
include:cloudflare-cn include:cloudflare-cn
include:ctyun
include:dwion include:dwion
include:maocloud include:maocloud
include:qingcloud include:qingcloud
@@ -509,12 +511,10 @@ ycrx360.com
1637.com 1637.com
16888.com 16888.com
16rd.com 16rd.com
17173.com
178linux.com 178linux.com
17989.com 17989.com
17cdn.com 17cdn.com
17house.com 17house.com
18183.com
1905.com 1905.com
19yxw.com 19yxw.com
1nongjing.com 1nongjing.com
@@ -595,7 +595,6 @@ ycrx360.com
7230.com 7230.com
72byte.com 72byte.com
7down.com 7down.com
7k7k.com
7po.com 7po.com
7x24cc.com 7x24cc.com
7xdown.com 7xdown.com
@@ -1101,7 +1100,6 @@ mumayi.com
muomou.com muomou.com
muzhiwan.com muzhiwan.com
mydown.com mydown.com
mydrivers.com
myshow360.net myshow360.net
myyx618.com myyx618.com
myzaker.com myzaker.com

View File

@@ -49,6 +49,7 @@ partnerad.l.google.com @ads
urchin.com @ads urchin.com @ads
full:analytics.google.com @ads full:analytics.google.com @ads
full:fundingchoicesmessages.google.com @ads # https://github.com/AdguardTeam/FiltersRegistry/pull/1154
# full:fundingchoicesmessages.google.com @ads
regexp:^adservice\.google\.([a-z]{2}|com?)(\.[a-z]{2})?$ @ads regexp:^adservice\.google\.([a-z]{2}|com?)(\.[a-z]{2})?$ @ads

View File

@@ -1,6 +1,7 @@
include:azure include:azure
include:bing include:bing
include:github include:github
include:microsoft-ads
include:microsoft-dev include:microsoft-dev
include:microsoft-pki include:microsoft-pki
include:msn include:msn
@@ -83,7 +84,6 @@ c-msedge.net
centralvalidation.com centralvalidation.com
ch9.ms ch9.ms
charticulator.com charticulator.com
clarity.ms @ads
cloudapp.net cloudapp.net
cloudappsecurity.com cloudappsecurity.com
cortanaanalytics.com cortanaanalytics.com
@@ -147,7 +147,6 @@ microsoft-sbs-domains.com
microsoft-smb.cn @cn microsoft-smb.cn @cn
microsoft365.com microsoft365.com
microsoftaccountguard.com microsoftaccountguard.com
microsoftads.com @ads
microsoftadvertising.com microsoftadvertising.com
microsoftadvertisingregionalawards.com microsoftadvertisingregionalawards.com
microsoftaffiliates.com microsoftaffiliates.com
@@ -189,7 +188,6 @@ morphcharts.com
mpnevolution.com mpnevolution.com
ms-studiosmedia.com ms-studiosmedia.com
ms365surfaceoffer.com ms365surfaceoffer.com
msads.net @ads
msauth.cn @cn msauth.cn @cn
msauth.net msauth.net
msauthimages.cn @cn msauthimages.cn @cn
@@ -216,7 +214,6 @@ msra.cn @cn
msturing.org msturing.org
msudalosti.com msudalosti.com
mymicrosoft.com mymicrosoft.com
nelreports.net @ads
nextechafrica.net nextechafrica.net
nxta.org nxta.org
o365cn.com @cn o365cn.com @cn

6
data/microsoft-ads Normal file
View File

@@ -0,0 +1,6 @@
browser.events.data.msn.cn @ads
browser.events.data.msn.com @ads
clarity.ms @ads
microsoftads.com @ads
msads.net @ads
nelreports.net @ads

View File

@@ -1,2 +1,4 @@
include:hoyoverse include:hoyoverse
include:mihoyo-cn include:mihoyo-cn
include:mihoyo-ads

2
data/mihoyo-ads Normal file
View File

@@ -0,0 +1,2 @@
log-upload-os.hoyoverse.com @ads
log-upload.mihoyo.com @ads

View File

@@ -13,3 +13,6 @@ webtest.net
full:www.speedtest.net.cdn.cloudflare.net full:www.speedtest.net.cdn.cloudflare.net
include:ookla-speedtest-ads include:ookla-speedtest-ads
# SpeedTest Node
ookla-speedtest-central.hgconair.hgc.com.hk # HGC Global Communications 香港環電

View File

@@ -1,3 +1,5 @@
include:picacg-ads
bikaa.xyz bikaa.xyz
bikac.xyz bikac.xyz
bikaios.xyz bikaios.xyz
@@ -8,3 +10,7 @@ picacn.xyz
picacomic.com picacomic.com
picacomic.xyz picacomic.xyz
wikawika.xyz wikawika.xyz
# Image Resource Domain like `img.diwodiwo.xyz` `s3.diwodiwo.xyz` `storage.diwodiwo.xyz` `storage-b.diwodiwo.xyz`
diwodiwo.xyz

2
data/picacg-ads Normal file
View File

@@ -0,0 +1,2 @@
full:ad-channel.diwodiwo.xyz @ads
full:ad-display.diwodiwo.xyz @ads

View File

@@ -19,6 +19,7 @@ adsview.qq.com @ads
adsview2.qq.com @ads adsview2.qq.com @ads
adv.app.qq.com @ads adv.app.qq.com @ads
adver.qq.com @ads adver.qq.com @ads
badjs.weixinbridge.com @ads
beacon.cdn.qq.com @ads beacon.cdn.qq.com @ads
beacon.qq.com @ads beacon.qq.com @ads
beaconcdn.qq.com @ads beaconcdn.qq.com @ads

View File

@@ -1,5 +1,25 @@
aaid.umeng.com @ads
alog.umeng.com @ads alog.umeng.com @ads
alog.umengcloud.com @ads alog.umengcloud.com @ads
alogs.umeng.com @ads
alogus.umeng.com @ads
ar.umeng.com @ads
aspect-upush.umeng.com @ads
audid.umeng.com @ads
ccs.umeng.com @ads
cnlogs.umeng.com @ads
cnlogs.umengcloud.com @ads
# https://github.com/TG-Twilight/AWAvenue-Ads-Rule/issues/185
# errlog.umeng.com @ads
# errnewlog.umeng.com @ads
new-aaid.umeng.com @ads
new-aaid.umeng.com.gds.alibabadns.com @ads
oc.umeng.com @ads
plbslog.umeng.com @ads
resolve.umeng.com @ads
ulogs.umeng.com @ads
ulogs.umengcloud.com @ads
utoken.umeng.com @ads
# CNZZ # CNZZ
w.cnzz.com @ads w.cnzz.com @ads

3
data/wink Normal file
View File

@@ -0,0 +1,3 @@
ngenix.net
restream-media.net
wink.ru

View File

@@ -1,2 +1,4 @@
include:zhihu-ads
zhihu.com zhihu.com
zhimg.com zhimg.com

2
data/zhihu-ads Normal file
View File

@@ -0,0 +1,2 @@
crash2.zhihu.com @ads
zhihu-web-analytics.zhihu.com @ads

51
main.go
View File

@@ -2,11 +2,11 @@ package main
import ( import (
"bufio" "bufio"
"errors"
"flag" "flag"
"fmt" "fmt"
"os" "os"
"path/filepath" "path/filepath"
"regexp"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
@@ -22,6 +22,14 @@ var (
exportLists = flag.String("exportlists", "", "Lists to be flattened and exported in plaintext format, separated by ',' comma") exportLists = flag.String("exportlists", "", "Lists to be flattened and exported in plaintext format, separated by ',' comma")
) )
const (
RuleTypeDomain string = "domain"
RuleTypeFullDomain string = "full"
RuleTypeKeyword string = "keyword"
RuleTypeRegexp string = "regexp"
RuleTypeInclude string = "include"
)
type Entry struct { type Entry struct {
Type string Type string
Value string Value string
@@ -64,32 +72,41 @@ func (l *ParsedList) toProto() (*router.GeoSite, error) {
} }
for _, entry := range l.Entry { for _, entry := range l.Entry {
switch entry.Type { switch entry.Type {
case "domain": case RuleTypeDomain:
site.Domain = append(site.Domain, &router.Domain{ site.Domain = append(site.Domain, &router.Domain{
Type: router.Domain_RootDomain, Type: router.Domain_RootDomain,
Value: entry.Value, Value: entry.Value,
Attribute: entry.Attrs, Attribute: entry.Attrs,
}) })
case "regexp":
case RuleTypeRegexp:
// check regexp validity to avoid runtime error
_, 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{ site.Domain = append(site.Domain, &router.Domain{
Type: router.Domain_Regex, Type: router.Domain_Regex,
Value: entry.Value, Value: entry.Value,
Attribute: entry.Attrs, Attribute: entry.Attrs,
}) })
case "keyword":
case RuleTypeKeyword:
site.Domain = append(site.Domain, &router.Domain{ site.Domain = append(site.Domain, &router.Domain{
Type: router.Domain_Plain, Type: router.Domain_Plain,
Value: entry.Value, Value: entry.Value,
Attribute: entry.Attrs, Attribute: entry.Attrs,
}) })
case "full":
case RuleTypeFullDomain:
site.Domain = append(site.Domain, &router.Domain{ site.Domain = append(site.Domain, &router.Domain{
Type: router.Domain_Full, Type: router.Domain_Full,
Value: entry.Value, Value: entry.Value,
Attribute: entry.Attrs, Attribute: entry.Attrs,
}) })
default: default:
return nil, errors.New("unknown domain type: " + entry.Type) return nil, fmt.Errorf("unknown domain type: %s", entry.Type)
} }
} }
return site, nil return site, nil
@@ -118,24 +135,30 @@ func removeComment(line string) string {
func parseDomain(domain string, entry *Entry) error { func parseDomain(domain string, entry *Entry) error {
kv := strings.Split(domain, ":") kv := strings.Split(domain, ":")
if len(kv) == 1 { if len(kv) == 1 {
entry.Type = "domain" entry.Type = RuleTypeDomain
entry.Value = strings.ToLower(kv[0]) entry.Value = strings.ToLower(kv[0])
return nil return nil
} }
if len(kv) == 2 { if len(kv) == 2 {
entry.Type = strings.ToLower(kv[0]) entry.Type = strings.ToLower(kv[0])
if strings.EqualFold(entry.Type, RuleTypeRegexp) {
entry.Value = kv[1]
} else {
entry.Value = strings.ToLower(kv[1]) entry.Value = strings.ToLower(kv[1])
}
return nil return nil
} }
return errors.New("Invalid format: " + domain) return fmt.Errorf("invalid format: %s", domain)
} }
func parseAttribute(attr string) (*router.Domain_Attribute, error) { func parseAttribute(attr string) (*router.Domain_Attribute, error) {
var attribute router.Domain_Attribute var attribute router.Domain_Attribute
if len(attr) == 0 || attr[0] != '@' { if len(attr) == 0 || attr[0] != '@' {
return &attribute, errors.New("invalid attribute: " + attr) return &attribute, fmt.Errorf("invalid attribute: %s", attr)
} }
// Trim attribute prefix `@` character // Trim attribute prefix `@` character
@@ -148,7 +171,7 @@ func parseAttribute(attr string) (*router.Domain_Attribute, error) {
attribute.Key = strings.ToLower(parts[0]) attribute.Key = strings.ToLower(parts[0])
intv, err := strconv.Atoi(parts[1]) intv, err := strconv.Atoi(parts[1])
if err != nil { if err != nil {
return &attribute, errors.New("invalid attribute: " + attr + ": " + err.Error()) return &attribute, fmt.Errorf("invalid attribute: %s: %v", attr, err)
} }
attribute.TypedValue = &router.Domain_Attribute_IntValue{IntValue: int64(intv)} attribute.TypedValue = &router.Domain_Attribute_IntValue{IntValue: int64(intv)}
} }
@@ -161,7 +184,7 @@ func parseEntry(line string) (Entry, error) {
var entry Entry var entry Entry
if len(parts) == 0 { if len(parts) == 0 {
return entry, errors.New("empty entry") return entry, fmt.Errorf("empty entry")
} }
if err := parseDomain(parts[0], &entry); err != nil { if err := parseDomain(parts[0], &entry); err != nil {
@@ -255,7 +278,7 @@ func ParseList(list *List, ref map[string]*List) (*ParsedList, error) {
newEntryList := make([]Entry, 0, len(entryList)) newEntryList := make([]Entry, 0, len(entryList))
hasInclude := false hasInclude := false
for _, entry := range entryList { for _, entry := range entryList {
if entry.Type == "include" { if entry.Type == RuleTypeInclude {
refName := strings.ToUpper(entry.Value) refName := strings.ToUpper(entry.Value)
if entry.Attrs != nil { if entry.Attrs != nil {
for _, attr := range entry.Attrs { for _, attr := range entry.Attrs {
@@ -267,7 +290,7 @@ func ParseList(list *List, ref map[string]*List) (*ParsedList, error) {
refList := ref[refName] refList := ref[refName]
if refList == nil { if refList == nil {
return nil, errors.New(entry.Value + " not found.") return nil, fmt.Errorf("list not found: %s", entry.Value)
} }
attrEntrys := createIncludeAttrEntrys(refList, attr) attrEntrys := createIncludeAttrEntrys(refList, attr)
if len(attrEntrys) != 0 { if len(attrEntrys) != 0 {
@@ -282,7 +305,7 @@ func ParseList(list *List, ref map[string]*List) (*ParsedList, error) {
pl.Inclusion[InclusionName] = true pl.Inclusion[InclusionName] = true
refList := ref[refName] refList := ref[refName]
if refList == nil { if refList == nil {
return nil, errors.New(entry.Value + " not found.") return nil, fmt.Errorf("list not found: %s", entry.Value)
} }
newEntryList = append(newEntryList, refList.Entry...) newEntryList = append(newEntryList, refList.Entry...)
} }