博文

目前显示的是标签为“matching”的博文

IP matching & URL matching

# IP matching Use case: 1. Visitor country detection. White/black list for internationalization/proxy. ------ - Use radix tree Data structure: [radix tree](https://en.wikipedia.org/wiki/Radix_tree)  IP to ASN: [pyasn](https://pypi.python.org/pypi/pyasn)  [ASN to Country](https://serverfault.com/questions/351123/need-to-find-users-of-asn-in-my-country) - Convert IP range into integer range and form a interval tree - Record every valid trail from IP range Make a valid path decision tree (Trie tree). - Use Accept-Language header ------ # URL matching Use case: 1. AD blocking. 1. Smart routing/proxing. ## TODO Read [ublock](https://github.com/gorhill/uBlock) source code.  [Adblock Plus matching algorithms](https://adblockplus.org/blog/investigating-filter-matching-algorithms)  posted 2006, last reply 2010.  ABP [a simpler algorithm with even better performance characteristics](https://adblockplus.org/development-builds/faster-filter-matchin...