{"id":22141120,"url":"https://github.com/reiji007/adblock_rule_for_v2ray","last_synced_at":"2025-07-25T23:31:55.691Z","repository":{"id":253533358,"uuid":"843793458","full_name":"REIJI007/AdBlock_Rule_For_V2ray","owner":"REIJI007","description":"适用于V2ray（V2ray核心与Xray核心）的广告域名拦截adblock.dat二进制文件，每20分钟更新一次","archived":false,"fork":false,"pushed_at":"2024-11-25T21:19:20.000Z","size":70782,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-11-25T21:23:01.901Z","etag":null,"topics":["adblock","routing","rules","v2fly","v2ray","xray"],"latest_commit_sha":null,"homepage":"https://github.com/REIJI007/AdBlock_Rule_For_V2ray","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/REIJI007.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-CC-BY-NC-SA 4.0","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-17T12:43:18.000Z","updated_at":"2024-11-25T21:19:24.000Z","dependencies_parsed_at":"2024-10-28T09:27:58.074Z","dependency_job_id":"758356aa-8d39-440f-a350-46612eb59362","html_url":"https://github.com/REIJI007/AdBlock_Rule_For_V2ray","commit_stats":null,"previous_names":["reiji007/adblock_rule_for_v2ray"],"tags_count":5297,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/REIJI007%2FAdBlock_Rule_For_V2ray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/REIJI007%2FAdBlock_Rule_For_V2ray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/REIJI007%2FAdBlock_Rule_For_V2ray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/REIJI007%2FAdBlock_Rule_For_V2ray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/REIJI007","download_url":"https://codeload.github.com/REIJI007/AdBlock_Rule_For_V2ray/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227629048,"owners_count":17796054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adblock","routing","rules","v2fly","v2ray","xray"],"created_at":"2024-12-01T21:10:03.625Z","updated_at":"2024-12-01T21:10:06.775Z","avatar_url":"https://github.com/REIJI007.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GPL 3.0 license](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://github.com/REIJI007/AdBlock_Rule_For_V2ray/blob/main/LICENSE-GPL%203.0)\n[![CC BY-NC-SA 4.0 license](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg)](https://github.com/REIJI007/AdBlock_Rule_For_V2ray/blob/main/LICENSE-CC-BY-NC-SA%204.0)\n\u003c!-- 居中的大标题 --\u003e\n\u003ch1 align=\"center\" style=\"font-size: 70px; margin-bottom: 20px;\"\u003eAdBlock_Rule_For_V2ray\u003c/h1\u003e\n\n\u003c!-- 居中的副标题 --\u003e\n\u003ch2 align=\"center\" style=\"font-size: 30px; margin-bottom: 40px;\"\u003e适用于V2ray（V2ray核心与Xray核心）的广告域名拦截adblock.dat二进制文件，每20分钟更新一次\u003c/h2\u003e\n\n\u003c!-- 徽章（根据需要调整） --\u003e\n\u003cp align=\"center\" style=\"margin-bottom: 40px;\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/last%20commit-today-brightgreen\" alt=\"last commit\" style=\"margin-right: 10px;\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/forks/REIJI007/AdBlock_Rule_For_V2ray\" alt=\"forks\" style=\"margin-right: 10px;\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/REIJI007/AdBlock_Rule_For_V2ray\" alt=\"stars\" style=\"margin-right: 10px;\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/issues/REIJI007/AdBlock_Rule_For_V2ray\" alt=\"issues\" style=\"margin-right: 10px;\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/REIJI007/AdBlock_Rule_For_V2ray\" alt=\"license\" style=\"margin-right: 10px;\"\u003e\n\u003c/p\u003e\n\n**一、从多个广告过滤器中提取拦截域名条目，删除重复项，并将它们转换为兼容V2ray的dat二进制文件，其中列表的每个条目都写成了形如domain:example.com形式，一行仅一条规则。该列表可以用作V2ray的拦截域名路由文件，以阻止广告域名， powershell脚本和main.go转换程序每20分钟自动执行，并将生成的文件发布在release中.两个文件的下载地址分别如下，其中adblock_reject_domain.txt由powershell脚本生成，adblock.dat则是由main.go转换程序将adblock.txt转化得来的dat二进制文件，该文件仅有一个域名标签```ADBLOCK```**\n\u003cbr\u003e\n\u003cbr\u003e\n\n\u003ctable border=\"1\" style=\"border-collapse: collapse; width: 100%; font-family: Arial, sans-serif;\"\u003e\n  \u003ctr\u003e\n    \u003ctd colspan=\"2\" style=\"background-color: #f2f2f2; font-weight: bold; text-align: center; padding: 10px;\"\u003e订阅地址\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd style=\"padding: 8px;\"\u003eDAT\u003c/td\u003e\n    \u003ctd style=\"padding: 8px;\"\u003e\n      \u003cstrong\u003e\u003ca href=\"https://raw.githubusercontent.com/REIJI007/AdBlock_Rule_For_V2ray/main/adblock.dat\" style=\"color: #0066cc;\"\u003eGithub原始链接\u003c/a\u003e\u003c/strong\u003e | \n      \u003cstrong\u003e\u003ca href=\"https://www.adblock-v2ray-dat.reiji007.org\" style=\"color: #0066cc;\"\u003eCloudflare加速链接\u003c/a\u003e\u003c/strong\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd style=\"padding: 8px;\"\u003e拦截域名\u003c/td\u003e\n    \u003ctd style=\"padding: 8px;\"\u003e\n      \u003cstrong\u003e\u003ca href=\"https://raw.githubusercontent.com/REIJI007/AdBlock_Rule_For_V2ray/main/adblock_reject_domain.txt\" style=\"color: #0066cc;\"\u003eGithub原始链接\u003c/a\u003e\u003c/strong\u003e | \n      \u003cstrong\u003e\u003ca href=\"https://www.adblock-v2ray-reject-domain.reiji007.org\" style=\"color: #0066cc;\"\u003eCloudflare加速链接\u003c/a\u003e\u003c/strong\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\n\u003chr\u003e\n\n## 警告:本过滤器订阅有可能破坏某些网站的功能，也有可能封禁某些色情、赌博网站，使用前请斟酌考虑，如有误杀请积极向上游issue反馈，本仓库仅提供去重、筛选、合并功能\n\n\u003chr\u003e\n\n**二、可加入此powershell脚本处理的有```adblock plus语法广告过滤器```、```Host拦截列表```、```纯广告域名列表```、```Dnsmasq列表```，请自行酌情添加过滤器订阅URL至powershell脚本中进行处理，你可将该脚本代码复制到本地文本编辑器制作成.ps1后缀的文件运行在powershell上，注意修改生成的文本文件路径，最后在V2ray的json配置中加入被拦截域名，且V2ray配置字段写成类似于如下例子**\n\u003cbr\u003e\n\u003cbr\u003e\n*简而言之就是可以让你DIY出希望得到的拦截域名列表，缺点是此做法只适合本地定制使用，当然你也可以像本仓库一样部署到GitHub上面，见仁见智*\n\u003cbr\u003e\n\u003cbr\u003e\n\n**三、本仓库引用多个广告过滤器，从这些广告过滤器中提取了被拦截条目的域名，剔除了非拦截项并去重，最后做成adblock.dat二进制文件，虽无法做到面面俱到但能减少广告带来的困扰，请自行斟酌考虑使用。碍于V2ray的路由行为且秉持着尽可能不误杀的原则，本仓库采取域名后缀匹配策略，即匹配命中于拦截列表上的域名或其子域名时触发拦截，除此之外的情况给予放行，尽管这会有许多漏网之鱼的广告被放行**\n\u003cbr\u003e\n\u003cbr\u003e\n\n**四、关于本仓库使用方式：**\n\n  *使用方式一：下载releases中的adblock_reject_domain.txt文件，修改V2ray的json配置中的\"routing\"字段下的\"domain\"部分*\n  \n\u003chr\u003e\n\n\n```conf\n\n{\n \"outbounds\": \n   [\n     {\n       \"protocol\": \"blackhole\",\n       \"tag\": \"adblock\"          // 此outboundTag出站配合下面的域名拦截路由\n     }\n   ],\n \"routing\": \n   {\n     \"domainStrategy\": \"AsIs\",\n     \"rules\": \n     [\n       {\n         \"type\": \"field\",\n         \"domain\": \n         [\n             \"example.com1\",   // 在这里替换要拦截出站的广告域名,注意最后一个广告条目不用加逗号\n             \"example.com2\",\n             \"example.com3\"\n         ],\n         \"outboundTag\": \"adblock\"  // 匹配到的域名流量会被导流到名为adblock的outboundTag出站\n       }\n     ]\n   }\n}\n```\n\u003chr\u003e\n\n  *使用方式二：下载adblock.dat文件到V2ray同目录下，将下面对应格式的配置文件中\"outbounds\"字段和\"routing\"字段内容添加到你的json配置文件中，注意\"outbounds\"与\"routing\"之间的配合，注意去掉注释，\"tag\" 值需要保持一致*\n\u003chr\u003e\n\n\n```conf\n{\n    \"outbounds\": \n    [\n        {\n            \"protocol\": \"blackhole\",\n            \"tag\": \"adblock\"  // 此 outboundTag 出站配合下面的域名拦截路由\n        }\n    ],\n    \"routing\": \n    {\n        \"domainStrategy\": \"AsIs\",\n        \"rules\": \n        [\n            {\n                \"type\": \"field\",\n                \"domain\": \n                [\n                    \"ext:adblock.dat:adblock\"  // 引用 adblock.dat 文件中的 adblock 标签\n                ],\n                \"outboundTag\": \"adblock\"  // 匹配到的域名流量会被导流到名为 adblock 的 outboundTag 出站\n            }\n        ]\n    }\n}\n```\n\u003chr\u003e\n\n**五、关于本仓库的使用效果为什么没有普通广告过滤器效果好的疑问解答：**\n\u003cbr\u003e\n*因为普通的广告过滤器包含域名过滤（拦截广告域名）、路径过滤（例如拦截URL路径中包含/ads/的所有请求）、正则表达式过滤（例如拦截所有包含ads.js或ad.js的URL）、类型过滤（例如只拦截图片资源）、隐藏元素等等多因素作用下使得在广告拦截测试网站中可以取得高分。**但碍于V2ray的路由行为（可参考相关文档）**，本仓库仅提取了被拦截域名进行域名匹配过滤，换言之，本仓库就是一个“删减版”的广告过滤器（仅保留了域名匹配过滤功能，规则数在**15万**条左右），所以最终效果没有广告过滤器效果好*\n\u003cbr\u003e\n\u003cbr\u003e\n\n\n\n**六、本仓库引用的广告过滤规则来源请查看```Referencing rule sources.txt```（目前107个来源）。至于是否误杀域名完全取决于这些处于上游的广告过滤器的域名拦截行为，若不满意的话可按照第二条在本地使用powershell脚本进行DIY本地定制化拦截域名列表，亦或可以像本仓库一样DIY定制后部署到github上面，或者fork本仓库自行DIY**\n\n\n**七、特别鸣谢**\n\n\n\n1. [v2ray](https://github.com/v2fly/v2ray-core)\n2. [Adguard](https://github.com/AdguardTeam/AdGuardFilters)\n\n\n\n\n\n## LICENSE\n- [CC-BY-SA-4.0 License](https://github.com/REIJI007/AdBlock_Rule_For_V2ray/blob/main/LICENSE-CC-BY-NC-SA%204.0)\n- [GPL-3.0 License](https://github.com/REIJI007/AdBlock_Rule_For_V2ray/blob/main/LICENSE-GPL%203.0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freiji007%2Fadblock_rule_for_v2ray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freiji007%2Fadblock_rule_for_v2ray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freiji007%2Fadblock_rule_for_v2ray/lists"}