tor_extend 1.0.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Change.log +8 -6
- data/ReadME.txt +68 -9
- data/doc/ReadME_txt.html +100 -12
- data/doc/Tor.html +5 -0
- data/doc/Tor/Bridge.html +4 -0
- data/doc/Tor/CachedDesc.html +10 -6
- data/doc/Tor/Circuit.html +791 -0
- data/doc/Tor/Constants.html +10 -0
- data/doc/Tor/LongCircuit.html +474 -0
- data/doc/Tor/Router.html +4 -0
- data/doc/Tor/StatsObj.html +4 -0
- data/doc/Tor/TController.html +85 -33
- data/doc/created.rid +7 -6
- data/doc/index.html +4 -0
- data/doc/js/search_index.js +1 -1
- data/doc/lib/circuits_rb.html +97 -0
- data/doc/lib/constants_rb.html +4 -0
- data/doc/lib/httpmod_rb.html +4 -0
- data/doc/lib/tcontroller_rb.html +4 -0
- data/doc/lib/tor_extend_rb.html +4 -0
- data/doc/lib/tstats_rb.html +4 -0
- data/doc/table_of_contents.html +50 -0
- data/lib/circuits.rb +370 -0
- data/lib/constants.rb +4 -0
- data/lib/tcontroller.rb +30 -10
- data/lib/tor_extend.rb +4 -0
- data/tor_extend.gemspec +17 -4
- metadata +42 -14
data/doc/Tor/Constants.html
CHANGED
@@ -83,8 +83,12 @@
|
|
83
83
|
|
84
84
|
<li><a href="../Tor/CachedDesc.html">Tor::CachedDesc</a>
|
85
85
|
|
86
|
+
<li><a href="../Tor/Circuit.html">Tor::Circuit</a>
|
87
|
+
|
86
88
|
<li><a href="../Tor/Constants.html">Tor::Constants</a>
|
87
89
|
|
90
|
+
<li><a href="../Tor/LongCircuit.html">Tor::LongCircuit</a>
|
91
|
+
|
88
92
|
<li><a href="../Tor/Router.html">Tor::Router</a>
|
89
93
|
|
90
94
|
<li><a href="../Tor/StatsObj.html">Tor::StatsObj</a>
|
@@ -157,6 +161,12 @@ href="TController.html#method-i-extendcir_slowly">Tor::TController#extendcir_slo
|
|
157
161
|
waits between each extension.</p>
|
158
162
|
|
159
163
|
|
164
|
+
<dt id="PERIODIC_TIMER">PERIODIC_TIMER
|
165
|
+
|
166
|
+
<dd class="description"><p>This determines how frequent the circuits that make up long circuits will
|
167
|
+
be checked and reattached.</p>
|
168
|
+
|
169
|
+
|
160
170
|
<dt id="WORLDTOUR">WORLDTOUR
|
161
171
|
|
162
172
|
<dd class="description"><p>This determines where the tour goes to and which placemark ballons come up
|
@@ -0,0 +1,474 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>Class: Tor::LongCircuit</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "../";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="../index.html">Home</a>
|
28
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
<div id="file-metadata">
|
47
|
+
<nav id="file-list-section" class="section">
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
49
|
+
<ul>
|
50
|
+
<li>lib/circuits.rb
|
51
|
+
</ul>
|
52
|
+
</nav>
|
53
|
+
|
54
|
+
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
<nav id="parent-class-section" class="section">
|
60
|
+
<h3 class="section-header">Parent</h3>
|
61
|
+
|
62
|
+
<p class="link">Object
|
63
|
+
|
64
|
+
</nav>
|
65
|
+
|
66
|
+
|
67
|
+
<!-- Method Quickref -->
|
68
|
+
<nav id="method-list-section" class="section">
|
69
|
+
<h3 class="section-header">Methods</h3>
|
70
|
+
|
71
|
+
<ul class="link-list">
|
72
|
+
|
73
|
+
<li><a href="#method-c-new">::new</a>
|
74
|
+
|
75
|
+
<li><a href="#method-i-attach_streams">#attach_streams</a>
|
76
|
+
|
77
|
+
<li><a href="#method-i-built-3F">#built?</a>
|
78
|
+
|
79
|
+
<li><a href="#method-i-circuit">#circuit</a>
|
80
|
+
|
81
|
+
<li><a href="#method-i-cirnum">#cirnum</a>
|
82
|
+
|
83
|
+
<li><a href="#method-i-close_apps">#close_apps</a>
|
84
|
+
|
85
|
+
<li><a href="#method-i-extend">#extend</a>
|
86
|
+
|
87
|
+
</ul>
|
88
|
+
</nav>
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
<div id="project-metadata">
|
93
|
+
<nav id="fileindex-section" class="section project-section">
|
94
|
+
<h3 class="section-header">Pages</h3>
|
95
|
+
|
96
|
+
<ul>
|
97
|
+
|
98
|
+
<li class="file"><a href="../ReadME_txt.html">ReadME</a>
|
99
|
+
|
100
|
+
</ul>
|
101
|
+
</nav>
|
102
|
+
|
103
|
+
<nav id="classindex-section" class="section project-section">
|
104
|
+
<h3 class="section-header">Class and Module Index</h3>
|
105
|
+
|
106
|
+
<ul class="link-list">
|
107
|
+
|
108
|
+
<li><a href="../Tor.html">Tor</a>
|
109
|
+
|
110
|
+
<li><a href="../Tor/Bridge.html">Tor::Bridge</a>
|
111
|
+
|
112
|
+
<li><a href="../Tor/CachedDesc.html">Tor::CachedDesc</a>
|
113
|
+
|
114
|
+
<li><a href="../Tor/Circuit.html">Tor::Circuit</a>
|
115
|
+
|
116
|
+
<li><a href="../Tor/Constants.html">Tor::Constants</a>
|
117
|
+
|
118
|
+
<li><a href="../Tor/LongCircuit.html">Tor::LongCircuit</a>
|
119
|
+
|
120
|
+
<li><a href="../Tor/Router.html">Tor::Router</a>
|
121
|
+
|
122
|
+
<li><a href="../Tor/StatsObj.html">Tor::StatsObj</a>
|
123
|
+
|
124
|
+
<li><a href="../Tor/TController.html">Tor::TController</a>
|
125
|
+
|
126
|
+
</ul>
|
127
|
+
</nav>
|
128
|
+
|
129
|
+
</div>
|
130
|
+
</nav>
|
131
|
+
|
132
|
+
<div id="documentation">
|
133
|
+
<h1 class="class">class Tor::LongCircuit</h1>
|
134
|
+
|
135
|
+
<div id="description" class="description">
|
136
|
+
|
137
|
+
<p>This creates a Long circuit comprising of multiple sub-circuits. Methods
|
138
|
+
include <a href="LongCircuit.html#method-i-built-3F">#built?</a>, <a
|
139
|
+
href="LongCircuit.html#method-i-extend">#extend</a>,<a
|
140
|
+
href="LongCircuit.html">LongCircuit</a>..<a
|
141
|
+
href="LongCircuit.html#method-i-attach_streams">#attach_streams</a>,</p>
|
142
|
+
|
143
|
+
</div><!-- description -->
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
<!-- Methods -->
|
158
|
+
|
159
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
160
|
+
<h3 class="section-header">Public Class Methods</h3>
|
161
|
+
|
162
|
+
|
163
|
+
<div id="method-c-new" class="method-detail ">
|
164
|
+
|
165
|
+
<div class="method-heading">
|
166
|
+
<span class="method-name">new</span><span
|
167
|
+
class="method-args">( tcontrolarray=[], circuitarray=[], proxyconfig )</span>
|
168
|
+
<span class="method-click-advice">click to toggle source</span>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
|
174
|
+
<p>Creates an instance of <a href="LongCircuit.html">Tor::LongCircuit</a> and
|
175
|
+
initialises the attributes of the instance including the cirnum, @built and
|
176
|
+
@circuitarray containing an sub-circuits that are instances of <a
|
177
|
+
href="Circuit.html">Tor::Circuit</a></p>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
<div class="method-source-code" id="new-source">
|
182
|
+
<pre><span class="ruby-comment"># File lib/circuits.rb, line 253</span>
|
183
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>( <span class="ruby-identifier">tcontrolarray</span>=[], <span class="ruby-identifier">circuitarray</span>=[], <span class="ruby-identifier">proxyconfig</span> )
|
184
|
+
<span class="ruby-comment"># Would it be better to get proxyconfig from mytor.getconf("SocksPort") </span>
|
185
|
+
<span class="ruby-ivar">@built</span> = <span class="ruby-keyword">false</span>
|
186
|
+
<span class="ruby-ivar">@cirnum</span> = <span class="ruby-value">0</span>
|
187
|
+
<span class="ruby-ivar">@circuitarray</span> = []
|
188
|
+
<span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>; <span class="ruby-identifier">j</span> = <span class="ruby-value">2</span>; <span class="ruby-identifier">k</span>=<span class="ruby-value">0</span>
|
189
|
+
<span class="ruby-keyword">while</span> <span class="ruby-identifier">i</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">circuitarray</span>.<span class="ruby-identifier">count</span>
|
190
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">tcontrolarray</span>[<span class="ruby-identifier">k</span>]
|
191
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
192
|
+
<span class="ruby-ivar">@circuitarray</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Circuit</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">tcontrolarray</span>[<span class="ruby-identifier">k</span>], <span class="ruby-identifier">circuitarray</span>[ <span class="ruby-identifier">i</span><span class="ruby-operator">..</span><span class="ruby-identifier">j</span> ] , <span class="ruby-keyword">nil</span> )
|
193
|
+
<span class="ruby-keyword">else</span>
|
194
|
+
<span class="ruby-ivar">@circuitarray</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Circuit</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">tcontrolarray</span>[<span class="ruby-identifier">k</span>], <span class="ruby-identifier">circuitarray</span>[ <span class="ruby-identifier">i</span><span class="ruby-operator">..</span><span class="ruby-identifier">j</span> ] , <span class="ruby-identifier">proxyconfig</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">k</span> )
|
195
|
+
<span class="ruby-keyword">end</span>
|
196
|
+
<span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span><span class="ruby-value">3</span>
|
197
|
+
<span class="ruby-identifier">j</span> <span class="ruby-operator">+=</span><span class="ruby-value">3</span>
|
198
|
+
<span class="ruby-identifier">k</span> <span class="ruby-operator">+=</span><span class="ruby-value">1</span>
|
199
|
+
<span class="ruby-keyword">end</span>
|
200
|
+
<span class="ruby-keyword">end</span>
|
201
|
+
<span class="ruby-keyword">end</span></pre>
|
202
|
+
</div><!-- new-source -->
|
203
|
+
|
204
|
+
</div>
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
</div><!-- new-method -->
|
210
|
+
|
211
|
+
|
212
|
+
</section><!-- public-class-method-details -->
|
213
|
+
|
214
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
215
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
216
|
+
|
217
|
+
|
218
|
+
<div id="method-i-attach_streams" class="method-detail ">
|
219
|
+
|
220
|
+
<div class="method-heading">
|
221
|
+
<span class="method-name">attach_streams</span><span
|
222
|
+
class="method-args">()</span>
|
223
|
+
<span class="method-click-advice">click to toggle source</span>
|
224
|
+
</div>
|
225
|
+
|
226
|
+
|
227
|
+
<div class="method-description">
|
228
|
+
|
229
|
+
<p>This tries to attach all streams to to a single pre-established circuit.</p>
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
<div class="method-source-code" id="attach_streams-source">
|
234
|
+
<pre><span class="ruby-comment"># File lib/circuits.rb, line 274</span>
|
235
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">attach_streams</span>
|
236
|
+
<span class="ruby-comment"># fork_reactor runs the reactor in a new thread thus allowing other methods to e run. Should I store the pid? When do I close the pid?</span>
|
237
|
+
<span class="ruby-comment"># EM.fork_reactor{</span>
|
238
|
+
<span class="ruby-constant">EM</span>.<span class="ruby-identifier">run</span> {
|
239
|
+
<span class="ruby-comment"># @counter = 0 if not defined?(@seun) # To count how many times an event has been triggered</span>
|
240
|
+
<span class="ruby-ivar">@timer</span>=<span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@circuitarray</span>.<span class="ruby-identifier">count</span>)
|
241
|
+
<span class="ruby-value">0</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-ivar">@circuitarray</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">z</span><span class="ruby-operator">|</span>
|
242
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span> <span class="ruby-ivar">@circuitarray</span>[<span class="ruby-identifier">z</span>].<span class="ruby-identifier">launched?</span>
|
243
|
+
<span class="ruby-ivar">@circuitarray</span>[<span class="ruby-identifier">z</span>].<span class="ruby-identifier">launch</span>
|
244
|
+
<span class="ruby-keyword">end</span>
|
245
|
+
|
246
|
+
<span class="ruby-comment"># Periodic timer to fire an event, in this case launch/attach sub circuits. If a custom value (Tor::PERIODIC_TIMER) is defined, use it instead </span>
|
247
|
+
<span class="ruby-identifier">timer</span> = (<span class="ruby-keyword">defined?</span> <span class="ruby-constant">Tor</span><span class="ruby-operator">::</span><span class="ruby-constant">PERIODIC_TIMER</span>) <span class="ruby-operator">?</span> <span class="ruby-constant">Tor</span><span class="ruby-operator">::</span><span class="ruby-constant">PERIODIC_TIMER</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Tor</span><span class="ruby-operator">::</span><span class="ruby-constant">Constants</span><span class="ruby-operator">::</span><span class="ruby-constant">PERIODIC_TIMER</span>
|
248
|
+
|
249
|
+
<span class="ruby-comment"># Keep checking if any of the subcircuits has been closed using the timer duration</span>
|
250
|
+
<span class="ruby-ivar">@timer</span>[<span class="ruby-identifier">z</span>] = <span class="ruby-constant">EventMachine</span><span class="ruby-operator">::</span><span class="ruby-constant">PeriodicTimer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">timer</span>) <span class="ruby-keyword">do</span>
|
251
|
+
<span class="ruby-ivar">@timer</span>[<span class="ruby-identifier">z</span>].<span class="ruby-identifier">cancel</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@circuitarray</span>[<span class="ruby-identifier">z</span>].<span class="ruby-identifier">closed?</span>
|
252
|
+
<span class="ruby-comment"># puts "Counter = #{@counter+=1}\n"</span>
|
253
|
+
<span class="ruby-ivar">@circuitarray</span>[<span class="ruby-identifier">z</span>].<span class="ruby-identifier">start</span>
|
254
|
+
<span class="ruby-keyword">end</span>
|
255
|
+
}
|
256
|
+
}
|
257
|
+
|
258
|
+
<span class="ruby-identifier">y</span> = ( <span class="ruby-identifier">built?</span> ).<span class="ruby-identifier">index</span>(<span class="ruby-keyword">false</span>)
|
259
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"#{y} - #{built?}\n"</span>
|
260
|
+
<span class="ruby-identifier">extend</span> <span class="ruby-identifier">y</span>
|
261
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>
|
262
|
+
<span class="ruby-keyword">end</span></pre>
|
263
|
+
</div><!-- attach_streams-source -->
|
264
|
+
|
265
|
+
</div>
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
</div><!-- attach_streams-method -->
|
271
|
+
|
272
|
+
|
273
|
+
<div id="method-i-built-3F" class="method-detail ">
|
274
|
+
|
275
|
+
<div class="method-heading">
|
276
|
+
<span class="method-name">built?</span><span
|
277
|
+
class="method-args">()</span>
|
278
|
+
<span class="method-click-advice">click to toggle source</span>
|
279
|
+
</div>
|
280
|
+
|
281
|
+
|
282
|
+
<div class="method-description">
|
283
|
+
|
284
|
+
<p>Checks if the subcircuits have been built.</p>
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
<div class="method-source-code" id="built-3F-source">
|
289
|
+
<pre><span class="ruby-comment"># File lib/circuits.rb, line 309</span>
|
290
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">built?</span>
|
291
|
+
<span class="ruby-ivar">@built</span> = <span class="ruby-keyword">true</span>
|
292
|
+
<span class="ruby-identifier">truth_table</span> = <span class="ruby-ivar">@circuitarray</span>.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">each_circuit</span><span class="ruby-operator">|</span> <span class="ruby-identifier">each_circuit</span>.<span class="ruby-identifier">built?</span> } <span class="ruby-comment"># To know where the circuit is failing</span>
|
293
|
+
<span class="ruby-identifier">truth_table</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">truth_value</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@built</span> = <span class="ruby-ivar">@built</span> & <span class="ruby-identifier">truth_value</span> }
|
294
|
+
<span class="ruby-identifier">truth_table</span>
|
295
|
+
<span class="ruby-keyword">end</span></pre>
|
296
|
+
</div><!-- built-3F-source -->
|
297
|
+
|
298
|
+
</div>
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
</div><!-- built-3F-method -->
|
304
|
+
|
305
|
+
|
306
|
+
<div id="method-i-circuit" class="method-detail ">
|
307
|
+
|
308
|
+
<div class="method-heading">
|
309
|
+
<span class="method-name">circuit</span><span
|
310
|
+
class="method-args">()</span>
|
311
|
+
<span class="method-click-advice">click to toggle source</span>
|
312
|
+
</div>
|
313
|
+
|
314
|
+
|
315
|
+
<div class="method-description">
|
316
|
+
|
317
|
+
<p>Returns the array of <a href="Circuit.html">Tor::Circuit</a> instances that
|
318
|
+
make up the <a href="LongCircuit.html">LongCircuit</a> instance.</p>
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
<div class="method-source-code" id="circuit-source">
|
323
|
+
<pre><span class="ruby-comment"># File lib/circuits.rb, line 324</span>
|
324
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">circuit</span>
|
325
|
+
<span class="ruby-ivar">@circuitarray</span>
|
326
|
+
<span class="ruby-keyword">end</span></pre>
|
327
|
+
</div><!-- circuit-source -->
|
328
|
+
|
329
|
+
</div>
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
</div><!-- circuit-method -->
|
335
|
+
|
336
|
+
|
337
|
+
<div id="method-i-cirnum" class="method-detail ">
|
338
|
+
|
339
|
+
<div class="method-heading">
|
340
|
+
<span class="method-name">cirnum</span><span
|
341
|
+
class="method-args">()</span>
|
342
|
+
<span class="method-click-advice">click to toggle source</span>
|
343
|
+
</div>
|
344
|
+
|
345
|
+
|
346
|
+
<div class="method-description">
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
<div class="method-source-code" id="cirnum-source">
|
353
|
+
<pre><span class="ruby-comment"># File lib/circuits.rb, line 304</span>
|
354
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">cirnum</span>
|
355
|
+
<span class="ruby-ivar">@circuitarray</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">cirnum</span>
|
356
|
+
<span class="ruby-keyword">end</span></pre>
|
357
|
+
</div><!-- cirnum-source -->
|
358
|
+
|
359
|
+
</div>
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
</div><!-- cirnum-method -->
|
365
|
+
|
366
|
+
|
367
|
+
<div id="method-i-close_apps" class="method-detail ">
|
368
|
+
|
369
|
+
<div class="method-heading">
|
370
|
+
<span class="method-name">close_apps</span><span
|
371
|
+
class="method-args">()</span>
|
372
|
+
<span class="method-click-advice">click to toggle source</span>
|
373
|
+
</div>
|
374
|
+
|
375
|
+
|
376
|
+
<div class="method-description">
|
377
|
+
|
378
|
+
<p>This closes all the sub-circuits.</p>
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
<div class="method-source-code" id="close_apps-source">
|
383
|
+
<pre><span class="ruby-comment"># File lib/circuits.rb, line 317</span>
|
384
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">close_apps</span>
|
385
|
+
<span class="ruby-ivar">@circuitarray</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">z</span><span class="ruby-operator">|</span>
|
386
|
+
<span class="ruby-identifier">z</span>.<span class="ruby-identifier">close_apps</span>
|
387
|
+
}
|
388
|
+
<span class="ruby-keyword">end</span></pre>
|
389
|
+
</div><!-- close_apps-source -->
|
390
|
+
|
391
|
+
</div>
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
</div><!-- close_apps-method -->
|
397
|
+
|
398
|
+
|
399
|
+
<div id="method-i-extend" class="method-detail ">
|
400
|
+
|
401
|
+
<div class="method-heading">
|
402
|
+
<span class="method-name">extend</span><span
|
403
|
+
class="method-args">(*startcir)</span>
|
404
|
+
<span class="method-click-advice">click to toggle source</span>
|
405
|
+
</div>
|
406
|
+
|
407
|
+
|
408
|
+
<div class="method-description">
|
409
|
+
|
410
|
+
<p>Extend circuits from startcir position in the circuit array. This is used
|
411
|
+
internally by Tor.attach_streams There is no need to call this directly,
|
412
|
+
instead use <a
|
413
|
+
href="LongCircuit.html#method-i-attach_streams">#attach_streams</a> method.</p>
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
<div class="method-source-code" id="extend-source">
|
418
|
+
<pre><span class="ruby-comment"># File lib/circuits.rb, line 334</span>
|
419
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">extend</span>(*<span class="ruby-identifier">startcir</span>)
|
420
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">startcir</span>.<span class="ruby-identifier">empty?</span>
|
421
|
+
<span class="ruby-identifier">tmp</span>=<span class="ruby-value">0</span>
|
422
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">startcir</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">nil?</span>
|
423
|
+
<span class="ruby-identifier">tmp</span>=<span class="ruby-value">0</span>
|
424
|
+
<span class="ruby-keyword">else</span>
|
425
|
+
<span class="ruby-identifier">tmp</span> = <span class="ruby-identifier">startcir</span>[<span class="ruby-value">0</span>]
|
426
|
+
<span class="ruby-keyword">end</span>
|
427
|
+
|
428
|
+
<span class="ruby-comment"># Extend all sub-circuits or extend only circuits from startcir index.</span>
|
429
|
+
<span class="ruby-identifier">tmp</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-ivar">@circuitarray</span>.<span class="ruby-identifier">count</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span> ){ <span class="ruby-operator">|</span><span class="ruby-identifier">y</span><span class="ruby-operator">|</span>
|
430
|
+
<span class="ruby-identifier">each_circuit</span> = <span class="ruby-ivar">@circuitarray</span>[<span class="ruby-identifier">y</span>]
|
431
|
+
<span class="ruby-identifier">counter_z</span>=<span class="ruby-value">0</span>
|
432
|
+
<span class="ruby-keyword">while</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">each_circuit</span>.<span class="ruby-identifier">built?</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">counter_z</span> <span class="ruby-operator"><</span> <span class="ruby-value">15</span> <span class="ruby-comment"># Try up to 15 times to build the same circuit before giving up</span>
|
433
|
+
<span class="ruby-comment"># each_circuit.launch if y != 0 # here I need to launch tor and polipo in this method with the right config file after adding tmpdir path and configs</span>
|
434
|
+
<span class="ruby-identifier">cirnum</span> = <span class="ruby-identifier">each_circuit</span>.<span class="ruby-identifier">extend</span>
|
435
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">each_circuit</span>.<span class="ruby-identifier">built?</span>
|
436
|
+
<span class="ruby-keyword">next</span>
|
437
|
+
<span class="ruby-keyword">else</span>
|
438
|
+
<span class="ruby-identifier">sleep</span>( <span class="ruby-value">2</span> * <span class="ruby-ivar">@circuitarray</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">each_circuit</span>) <span class="ruby-operator">+</span> <span class="ruby-value">2</span> ) <span class="ruby-comment"># arithmetic progression time possible delay between each circuits [2,4,6,8,10,12]...</span>
|
439
|
+
<span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">each_circuit</span>.<span class="ruby-identifier">built?</span>
|
440
|
+
<span class="ruby-keyword">end</span>
|
441
|
+
<span class="ruby-identifier">z</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
442
|
+
<span class="ruby-keyword">end</span>
|
443
|
+
|
444
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">z</span> <span class="ruby-operator">==</span> <span class="ruby-value">15</span>
|
445
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"Circuit failed \n"</span>
|
446
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>
|
447
|
+
<span class="ruby-keyword">else</span>
|
448
|
+
<span class="ruby-identifier">cirnum</span>
|
449
|
+
<span class="ruby-keyword">end</span>
|
450
|
+
}
|
451
|
+
<span class="ruby-keyword">end</span></pre>
|
452
|
+
</div><!-- extend-source -->
|
453
|
+
|
454
|
+
</div>
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
</div><!-- extend-method -->
|
460
|
+
|
461
|
+
|
462
|
+
</section><!-- public-instance-method-details -->
|
463
|
+
|
464
|
+
</section><!-- 5Buntitled-5D -->
|
465
|
+
|
466
|
+
</div><!-- documentation -->
|
467
|
+
|
468
|
+
|
469
|
+
<footer id="validator-badges">
|
470
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
471
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
|
472
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
473
|
+
</footer>
|
474
|
+
|