[READ-ONLY] Mirror of https://github.com/andrioid/ublproxy. andrioid.github.io/ublproxy
adblock adblock-plus-list adblocker privacy-tools proxy-server self-hosted

Index rules by domain for fast lookup in ShouldBlockRequest master

Partition domain-anchored rules (||domain...) into map[string][]*Rule keyed by domain suffix. At match time, walk up the hostname hierarchy and only check rules for matching domains instead of scanning all rules. Same approach for exceptions. Pre-lowercase URL and context once per request to eliminate redundant strings.ToLower calls in each rule match.


+109 -33
2 changed files