This commit is contained in:
Ilya Ig. Petrov 2015-12-23 13:51:22 +05:00
commit d511272642
2 changed files with 15 additions and 12 deletions

View File

@ -1,11 +1,11 @@
# Anti-censorship Solution for Russia on PAC-scripts # Russian Anti-Censorship on PAC-Scripts
This repo contains my efforts to fight censorhip in Russia. This repo contains:
* Chrome Extension to bypass censorship in Russia:
## Chrome Extension [WebStore](https://chrome.google.com/webstore/detail/npgcnondjocldhldegnakemclmfkngch)
[WebStore](https://chrome.google.com/webstore/developer/edit/npgcnondjocldhldegnakemclmfkngch)
| [Sources](https://github.com/ilyaigpetrov/anti-censorship-russia/tree/master/extensions/chromium/minimalistic-pac-setter) | [Sources](https://github.com/ilyaigpetrov/anti-censorship-russia/tree/master/extensions/chromium/minimalistic-pac-setter)
* PAC-scripts performance analyses
* PAC-script generator based on https://github.com/zapret-info/z-i
## Why I do This ## Why I do This
@ -13,7 +13,7 @@ I believe __information mustn't be blocked based on political or other subjectiv
My maxim is _"Your freedom ends when it starts to confine the freedom of others"_. My maxim is _"Your freedom ends when it starts to confine the freedom of others"_.
[See my arguments against censorship (ru)](https://gist.github.com/ilyaigpetrov/9452b93ef3d7dd3d8cc2) See [my other arguments against censorship (ru)](https://gist.github.com/ilyaigpetrov/9452b93ef3d7dd3d8cc2)
Looking at how Russian government [distorts TV](https://therussianreader.wordpress.com/2015/11/22/russian-truckers-strike-dagestan/) and blocks [critics of Putin](http://www.reuters.com/article/2014/03/13/us-russia-internet-idUSBREA2C21L20140313), Looking at how Russian government [distorts TV](https://therussianreader.wordpress.com/2015/11/22/russian-truckers-strike-dagestan/) and blocks [critics of Putin](http://www.reuters.com/article/2014/03/13/us-russia-internet-idUSBREA2C21L20140313),
I decided to write an anti-censorship extension for Chromium before they strike me first. I decided to write an anti-censorship extension for Chromium before they strike me first.

View File

@ -1,5 +1,7 @@
## PAC-Script Performance Analysis ## PAC-Script Performance Analysis
__Warning:__ this experimentation wasn't implemented in the extension yet.
Somewhere in PAC-script you may want: Somewhere in PAC-script you may want:
```javascript ```javascript
@ -14,12 +16,13 @@ The naive solution is to keep array of blocked ips and check if the host resolve
You may do it with `indexOf`, binary search, etc. You may do it with `indexOf`, binary search, etc.
The shortcoming of every ip solution is that __some providers resolve blocked hosts to wrong ips__, so we eventually need list of hosts. The shortcoming of every ip solution is that __some providers resolve blocked hosts to wrong ips__, so we eventually need list of hosts.
I have tested different solutions, and depicted [results](./benchmark/Output.txt) in the following chart: I have tested different [solutions](https://github.com/ilyaigpetrov/anti-censorship-russia/tree/master/pac-generator/src), and depicted [results](./benchmark/Output.txt) in the following chart:
![Host Lookup Chart: Time-Memory, Hits-Misses](./chart/host-lookup-chart.png) ![Host Lookup Chart: Time-Memory, Hits-Misses](./chart/host-lookup-chart.png)
* __IPs indexOf__ Blocked IP is searched by `indexOf` * __IPs indexOf__ Blocked IP is searched by `indexOf`
* __IPs binary__ Blocked IP is searched by binary search. For some reason miss time slightly increased. * __IPs binary__ Blocked IP is searched by binary search. For some reason miss time slightly increased.
* __IPs switch__ Simply `switch(Blocked_IP) { case1: ... caseN: return true }`. Works even better than binary search. Magic. * __IPs switch__ Simply `switch(Blocked_IP) { case1: ... caseN: return true }`. Works even better than binary search. Magic.
* __Hosts switch__ Radix trie built on `switch`. Comparable to __IPs switch__. * __Hosts switch__ Radix trie built on `switch`. Comparable to __IPs switch__.
* __Hosts reversed binary__ binary search on hosts, but hosts are kept in reversed form: _"gro.evichra"_ instead of _"archive.org"_. It shouldn't really affect anything, but it does, maybe because I also use `dnsDomainIs` instead of `===`.