MasterKia / PersianBlocker

سرانجام، یک لیست بهینه و گسترده برای مسدودسازی تبلیغ ها و ردیاب ها در سایت های پارسی زبان!
GNU Affero General Public License v3.0
324 stars 21 forks source link

Generate Ad list file to block on the server side #207

Open emranovin opened 9 months ago

emranovin commented 9 months ago

It'd be so nice if you could generate a file with the appropriate format for VPN servers so if the user didn't block them locally at least it blocked on the server side.

demarcush commented 9 months ago

@emranovin: You already can in two ways (that can be combined): Either use the HOSTS file and append it your server's /etc/hosts and configure your server (v2ray-core, xray-core, clash, etc.) to use localhost (127.0.0.1:53) as the DNS (or enable use-hosts -- if available -- and then use whatever DNS server you like). Or, use @chocolate4u geosite files and in the rule (routing) part of your server's configuration file, block them for outbound (similar procedure as here).

Nonetheless, these measures are futile as they rely on DNS filtering; A malicious application like TikTok can use DoH to bypass the filters and gain the IP address of the tracker/ad server and connect to it. And IP address filtering is not suitable for adblocking.

I only suggest you block Iran, China, Russia IPs at the server-side (so that gfw won't detect your IP as a proxy) and let the user decide whether they want to filter out advertisement or not. But, one could argue that as the aforementioned "malicious apps" are not common yet, you can rely on these measures for now.