supports hosts

This commit is contained in:
James Feng Cao 2023-03-20 22:31:36 +08:00
parent ddc9c8c16d
commit 4e8ff416e7
12 changed files with 47 additions and 38 deletions

View file

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="../style.css" type="text/css" />
<title>Blocking domain trees</title>
<title>Hosts files</title>
<script type="text/javascript">
function findLang(){
let href = location.href;
@ -40,7 +40,7 @@
<br />
<div class="container">
<h1 class="title">Blocking domain trees
<h1 class="title">Hosts files
<br>
<span class="subtitle"></span>
</h1>
@ -49,14 +49,17 @@
<li><a href="../tags/adblock">adblock</a> </li>
</ul>
<p><a href="file:///data/data/info.torapp.uweb/files/default.hosts">hosts</a> blocks whole domain trees including all descedant domains. The domains in the hosts file must be 2 or 3 segment domains, such as &quot;yahoo.com&quot; and &quot;finance.yahoo.com&quot;. If the length of the last 2 segments is less than 7, such as &quot;com.pl&quot;, then it is treated as one segment, so domains like &quot;xxx.xxx.com.pl&quot; are also valid in the hosts file.</p>
<p>The hosts files &quot;hosts&quot; and &quot;default.hosts&quot; take effect when the setting option &quot;using hosts&quot; is checked.</p>
<p>The file <a href="file:///data/data/info.torapp.uweb/files/hosts">&quot;hosts&quot;</a> defines IP addresses for domains. Each line has the following format:<br>
[IP address][single space][domain name]</p>
<p><a href="file:///data/data/info.torapp.uweb/files/default.hosts">&quot;default.hosts&quot;</a> blocks whole domain trees including all descedant domains. The domains in the hosts file must be 2 or 3 segment domains, such as &quot;yahoo.com&quot; and &quot;finance.yahoo.com&quot;. If the length of the last 2 segments is less than 7, such as &quot;com.pl&quot;, then it is treated as one segment, so domains like &quot;xxx.xxx.com.pl&quot; are also valid in the hosts file.</p>
<p>Each line of the hosts file has the following format:<br>
[rootDomain][space][regex for domain prefix before rootDomain][space][regex for the whole url without &quot;http(s)://&quot;]<br>
The first part [rootDomain] is required and the others are optional. regex is java-grammar regular expression. If the second regex is used, it is recommended to merge the first regex to the second one for performance.</p>
</div>
<p>Last Modified: 24 September 2022<br>
fix typos from torinfo.uweb to torapp.uweb<br>
<p>Last Modified: 20 March 2023<br>
supports hosts<br>
<pre></pre>
</p>