mirror of
https://github.com/anticensority/runet-censorship-bypass.git
synced 2024-11-24 02:13:43 +03:00
Update README.md
This commit is contained in:
parent
91b92d6e29
commit
2beb9215ae
20
README.md
20
README.md
|
@ -15,24 +15,22 @@ Looking at how Russian government [distorts TV](https://therussianreader.wordpre
|
||||||
|
|
||||||
I believe the freedom of information is a virtue and important __information mustn't be blocked based on political or other subjective views__.
|
I believe the freedom of information is a virtue and important __information mustn't be blocked based on political or other subjective views__.
|
||||||
|
|
||||||
## Task Technical Formulation
|
## Technical Titbits
|
||||||
|
|
||||||
You have a list of blocked domains.
|
```javascript
|
||||||
Per each outcoming request you have to check whether host is a subdomain of the blocked domains.
|
if (Is_subdomain_of( host, blocked_hosts ))
|
||||||
If host is blocked, you have serve it via proxy.
|
return 'use proxy';
|
||||||
|
```
|
||||||
|
|
||||||
[PAC (proxy auto-config)](https://en.wikipedia.org/wiki/Proxy_auto-config) is executed on each request.
|
You have to make `Is_subdomain_of` very fast.
|
||||||
If it returns `PROXY address` to the browser then proxy is used, otherwise it returns `DIRECT`.
|
This check is executed on each request. You should watch memeory consumption too.
|
||||||
|
|
||||||
## `Is_subdomain_of( host, blocked_hosts )`
|
|
||||||
|
|
||||||
You have check `host belongs to subdomains of the blocked hosts` very fast.
|
|
||||||
This check is executed on each request. You should watch memeory consumption also.
|
|
||||||
|
|
||||||
The naive solution is to keep array of blocked ips and check if the host resolves to one of the ips.
|
The naive solution is to keep array of blocked ips and check if the host resolves to one of the ips.
|
||||||
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:
|
||||||
|
|
||||||
![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 search by `indexOf`
|
* __IPs indexOf__ – Blocked IP is search by `indexOf`
|
||||||
|
|
Loading…
Reference in New Issue
Block a user