New routers supported
[tomato.git] / release / src / router / www / advanced-tor.asp
blob90010168ddb144e4082de73a847f9aee3780f550
1 <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0//EN'>
2 <!--
3 Tomato GUI
4 Copyright (C) 2007-2011 Shibby
5 http://openlinksys.info
6 For use with Tomato Firmware only.
7 No part of this file may be used without permission.
8 -->
9 <html>
10 <head>
11 <meta http-equiv='content-type' content='text/html;charset=utf-8'>
12 <meta name='robots' content='noindex,nofollow'>
13 <title>[<% ident(); %>] Advanced: TOR Project</title>
14 <link rel='stylesheet' type='text/css' href='tomato.css'>
15 <link rel='stylesheet' type='text/css' href='color.css'>
16 <script type='text/javascript' src='tomato.js'></script>
17 <style type='text/css'>
18 textarea {
19 width: 98%;
20 height: 15em;
22 </style>
23 <script type='text/javascript'>
24 // <% nvram("tor_enable,tor_socksport,tor_transport,tor_dnsport,tor_datadir,tor_users,tor_custom,tor_iface,lan_ifname,lan1_ifname,lan2_ifname,lan3_ifname"); %>
26 function verifyFields(focused, quiet)
28 var ok = 1;
30 var a = E('_f_tor_enable').checked;
31 var o = (E('_tor_iface').value == 'custom');
33 E('_tor_socksport').disabled = !a;
34 E('_tor_transport').disabled = !a;
35 E('_tor_dnsport').disabled = !a;
36 E('_tor_datadir').disabled = !a;
37 E('_tor_iface').disabled = !a;
38 E('_tor_custom').disabled = !a;
40 elem.display('_tor_users', o && a);
42 var bridge = E('_tor_iface');
43 if(nvram.lan_ifname.length < 1)
44 bridge.options[0].disabled=true;
45 if(nvram.lan1_ifname.length < 1)
46 bridge.options[1].disabled=true;
47 if(nvram.lan2_ifname.length < 1)
48 bridge.options[2].disabled=true;
49 if(nvram.lan3_ifname.length < 1)
50 bridge.options[3].disabled=true;
52 var s = E('_tor_custom');
54 if (s.value.search(/SocksPort/) == 0) {
55 ferror.set(s, 'Cannot set "SocksPort" option here. You can set it in Tomato GUI', quiet);
56 ok = 0; }
58 if (s.value.search(/SocksBindAddress/) == 0) {
59 ferror.set(s, 'Cannot set "SocksBindAddress" option here.', quiet);
60 ok = 0; }
62 if (s.value.search(/AllowUnverifiedNodes/) == 0) {
63 ferror.set(s, 'Cannot set "AllowUnverifiedNodes" option here.', quiet);
64 ok = 0; }
66 if (s.value.search(/Log/) == 0) {
67 ferror.set(s, 'Cannot set "Log" option here.', quiet);
68 ok = 0; }
70 if (s.value.search(/DataDirectory/) == 0) {
71 ferror.set(s, 'Cannot set "DataDirectory" option here. You can set it in Tomato GUI', quiet);
72 ok = 0; }
74 if (s.value.search(/TransPort/) == 0) {
75 ferror.set(s, 'Cannot set "TransPort" option here. You can set it in Tomato GUI', quiet);
76 ok = 0; }
78 if (s.value.search(/TransListenAddress/) == 0) {
79 ferror.set(s, 'Cannot set "TransListenAddress" option here.', quiet);
80 ok = 0; }
82 if (s.value.search(/DNSPort/) == 0) {
83 ferror.set(s, 'Cannot set "DNSPort" option here. You can set it in Tomato GUI', quiet);
84 ok = 0; }
86 if (s.value.search(/DNSListenAddress/) == 0) {
87 ferror.set(s, 'Cannot set "DNSListenAddress" option here.', quiet);
88 ok = 0; }
90 if (s.value.search(/User/) == 0) {
91 ferror.set(s, 'Cannot set "User" option here.', quiet);
92 ok = 0; }
94 return ok;
97 function save()
99 if (verifyFields(null, 0)==0) return;
100 var fom = E('_fom');
101 fom.tor_enable.value = E('_f_tor_enable').checked ? 1 : 0;
103 if (fom.tor_enable.value == 0) {
104 fom._service.value = 'tor-stop';
106 else {
107 fom._service.value = 'tor-restart,firewall-restart';
109 form.submit('_fom', 1);
112 function init()
115 </script>
116 </head>
118 <body onLoad="init()">
119 <table id='container' cellspacing=0>
120 <tr><td colspan=2 id='header'>
121 <div class='title'>Tomato</div>
122 <div class='version'>Version <% version(); %></div>
123 </td></tr>
124 <tr id='body'><td id='navi'><script type='text/javascript'>navi()</script></td>
125 <td id='content'>
126 <div id='ident'><% ident(); %></div>
127 <div class='section-title'>TOR Settings</div>
128 <div class='section' id='config-section'>
129 <form id='_fom' method='post' action='tomato.cgi'>
130 <input type='hidden' name='_nextpage' value='advanced-tor.asp'>
131 <input type='hidden' name='_service' value='tor-restart'>
132 <input type='hidden' name='tor_enable'>
134 <script type='text/javascript'>
135 createFieldTable('', [
136 { title: 'Enable TOR', name: 'f_tor_enable', type: 'checkbox', value: nvram.tor_enable == '1' },
137 null,
138 { title: 'Socks Port', name: 'tor_socksport', type: 'text', maxlen: 5, size: 7, value: fixPort(nvram.tor_socksport, 9050) },
139 { title: 'Trans Port', name: 'tor_transport', type: 'text', maxlen: 5, size: 7, value: fixPort(nvram.tor_transport, 9040) },
140 { title: 'DNS Port', name: 'tor_dnsport', type: 'text', maxlen: 5, size: 7, value: fixPort(nvram.tor_dnsport, 9053) },
141 { title: 'Data Directory', name: 'tor_datadir', type: 'text', maxlen: 24, size: 28, value: nvram.tor_datadir },
142 null,
143 { title: 'Redirect all users from', multi: [
144 { name: 'tor_iface', type: 'select', options: [
145 ['br0','LAN (br0)'],
146 ['br1','LAN1 (br1)'],
147 ['br2','LAN2 (br2)'],
148 ['br3','LAN3 (br3)'],
149 ['custom','Only selected IP`s']
150 ], value: nvram.tor_iface },
151 { name: 'tor_users', type: 'text', maxlen: 512, size: 64, value: nvram.tor_users } ] },
152 null,
153 { title: 'Custom Configuration', name: 'tor_custom', type: 'textarea', value: nvram.tor_custom }
155 </script>
156 </div>
157 <div class='section-title'>Notes</div>
158 <div class='section'>
159 <ul>
160 <li><b>Enable TOR</b> - Be patient. Starting the TOR client can take from several seconds to several minutes.
161 <li><b>Only selected IP`s</b> - ex: 1.2.3.4,1.1.0/24,1.2.3.1-1.2.3.4
162 <li>•Only connections to destination port 80 are redirected to TOR.
163 <li>•Caution! - If your router only has 32MB of RAM, you'll have to use swap.
164 </ul>
165 </div>
166 </form>
167 </div>
168 </td></tr>
169 <tr><td id='footer' colspan=2>
170 <form>
171 <span id='footer-msg'></span>
172 <input type='button' value='Save' id='save-button' onclick='save()'>
173 <input type='button' value='Cancel' id='cancel-button' onclick='javascript:reloadPage();'>
174 </form>
175 </div>
176 </td></tr>
177 </table>
178 <script type='text/javascript'>verifyFields(null, 1);</script>
179 </body>
180 </html>