devdnsd 2.4.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rbx/8b/8b2d1928657c1eeac610d1207ff1bee6e918287c +857 -0
- data/.rbx/db/dbd6130694811dcd0359863bd5380c673db0fe71 +288 -0
- data/.travis-gemfile +1 -2
- data/.travis.yml +1 -0
- data/Gemfile +2 -3
- data/README.md +3 -1
- data/Rakefile +1 -1
- data/bin/devdnsd +29 -5
- data/config/devdnsd_config.sample +2 -5
- data/devdnsd.gemspec +6 -5
- data/doc/DevDNSd.html +4 -4
- data/doc/DevDNSd/Application.html +560 -520
- data/doc/DevDNSd/ApplicationMethods.html +4 -4
- data/doc/DevDNSd/ApplicationMethods/Aliases.html +780 -0
- data/doc/DevDNSd/ApplicationMethods/Server.html +46 -46
- data/doc/DevDNSd/ApplicationMethods/System.html +222 -20
- data/doc/DevDNSd/ApplicationMethods/System/ClassMethods.html +3 -3
- data/doc/DevDNSd/Configuration.html +20 -20
- data/doc/DevDNSd/Errors.html +3 -3
- data/doc/DevDNSd/Errors/InvalidRule.html +3 -3
- data/doc/DevDNSd/Rule.html +15 -15
- data/doc/DevDNSd/Version.html +5 -5
- data/doc/_index.html +11 -4
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +6 -4
- data/doc/frames.html +1 -1
- data/doc/index.html +6 -4
- data/doc/method_list.html +73 -31
- data/doc/top-level-namespace.html +3 -3
- data/lib/devdnsd.rb +6 -3
- data/lib/devdnsd/application.rb +220 -11
- data/lib/devdnsd/configuration.rb +19 -1
- data/lib/devdnsd/errors.rb +1 -1
- data/lib/devdnsd/rule.rb +2 -2
- data/lib/devdnsd/version.rb +3 -3
- data/locales/en.yml +28 -2
- data/locales/it.yml +29 -2
- data/spec/coverage_helper.rb +3 -3
- data/spec/devdnsd/application_spec.rb +202 -51
- data/spec/devdnsd/configuration_spec.rb +1 -1
- data/spec/devdnsd/rule_spec.rb +1 -1
- data/spec/resolver_helper.rb +51 -0
- data/spec/spec_helper.rb +3 -5
- metadata +34 -26
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<title>
|
|
7
7
|
Module: DevDNSd::ApplicationMethods
|
|
8
8
|
|
|
9
|
-
— Documentation by YARD 0.8.
|
|
9
|
+
— Documentation by YARD 0.8.7
|
|
10
10
|
|
|
11
11
|
</title>
|
|
12
12
|
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
<p class="children">
|
|
99
99
|
|
|
100
100
|
|
|
101
|
-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="ApplicationMethods/Server.html" title="DevDNSd::ApplicationMethods::Server (module)">Server</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html" title="DevDNSd::ApplicationMethods::System (module)">System</a></span>
|
|
101
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="ApplicationMethods/Aliases.html" title="DevDNSd::ApplicationMethods::Aliases (module)">Aliases</a></span>, <span class='object_link'><a href="ApplicationMethods/Server.html" title="DevDNSd::ApplicationMethods::Server (module)">Server</a></span>, <span class='object_link'><a href="ApplicationMethods/System.html" title="DevDNSd::ApplicationMethods::System (module)">System</a></span>
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
|
|
@@ -116,9 +116,9 @@
|
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
118
|
<div id="footer">
|
|
119
|
-
Generated on
|
|
119
|
+
Generated on Sun Aug 18 16:18:38 2013 by
|
|
120
120
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
121
|
-
0.8.
|
|
121
|
+
0.8.7 (ruby-2.0.0).
|
|
122
122
|
</div>
|
|
123
123
|
|
|
124
124
|
</body>
|
|
@@ -0,0 +1,780 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
Module: DevDNSd::ApplicationMethods::Aliases
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.8.7
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
|
19
|
+
relpath = '../../';
|
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
|
25
|
+
|
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<div id="header">
|
|
32
|
+
<div id="menu">
|
|
33
|
+
|
|
34
|
+
<a href="../../_index.html">Index (A)</a> »
|
|
35
|
+
<span class='title'><span class='object_link'><a href="../../DevDNSd.html" title="DevDNSd (module)">DevDNSd</a></span></span> » <span class='title'><span class='object_link'><a href="../ApplicationMethods.html" title="DevDNSd::ApplicationMethods (module)">ApplicationMethods</a></span></span>
|
|
36
|
+
»
|
|
37
|
+
<span class="title">Aliases</span>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div id="search">
|
|
44
|
+
|
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
|
46
|
+
href="../../class_list.html">
|
|
47
|
+
Class List
|
|
48
|
+
</a>
|
|
49
|
+
|
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
|
51
|
+
href="../../method_list.html">
|
|
52
|
+
Method List
|
|
53
|
+
</a>
|
|
54
|
+
|
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
|
56
|
+
href="../../file_list.html">
|
|
57
|
+
File List
|
|
58
|
+
</a>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
<div class="clear"></div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<iframe id="search_frame"></iframe>
|
|
65
|
+
|
|
66
|
+
<div id="content"><h1>Module: DevDNSd::ApplicationMethods::Aliases
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</h1>
|
|
71
|
+
|
|
72
|
+
<dl class="box">
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
<dt class="r1">Extended by:</dt>
|
|
77
|
+
<dd class="r1">ActiveSupport::Concern</dd>
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
<dt class="r2">Included in:</dt>
|
|
85
|
+
<dd class="r2"><span class='object_link'><a href="../Application.html" title="DevDNSd::Application (class)">DevDNSd::Application</a></span></dd>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
<dt class="r1 last">Defined in:</dt>
|
|
90
|
+
<dd class="r1 last">lib/devdnsd/application.rb</dd>
|
|
91
|
+
|
|
92
|
+
</dl>
|
|
93
|
+
<div class="clear"></div>
|
|
94
|
+
|
|
95
|
+
<h2>Overview</h2><div class="docstring">
|
|
96
|
+
<div class="discussion">
|
|
97
|
+
<p>Methods to handle interfaces aliases.</p>
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
<div class="tags">
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
<h2>
|
|
114
|
+
Instance Method Summary
|
|
115
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
116
|
+
</h2>
|
|
117
|
+
|
|
118
|
+
<ul class="summary">
|
|
119
|
+
|
|
120
|
+
<li class="public ">
|
|
121
|
+
<span class="summary_signature">
|
|
122
|
+
|
|
123
|
+
<a href="#compute_addresses-instance_method" title="#compute_addresses (instance method)">- (Array) <strong>compute_addresses</strong>(type = :all) </a>
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
</span>
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
<span class="summary_desc"><div class='inline'><p>Computes the list of address to manage.</p>
|
|
138
|
+
</div></span>
|
|
139
|
+
|
|
140
|
+
</li>
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
<li class="public ">
|
|
144
|
+
<span class="summary_signature">
|
|
145
|
+
|
|
146
|
+
<a href="#is_ipv4%3F-instance_method" title="#is_ipv4? (instance method)">- (Boolean) <strong>is_ipv4?</strong>(address) </a>
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
</span>
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
<span class="summary_desc"><div class='inline'><p>Checks if an address is a valid IPv4 address.</p>
|
|
161
|
+
</div></span>
|
|
162
|
+
|
|
163
|
+
</li>
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
<li class="public ">
|
|
167
|
+
<span class="summary_signature">
|
|
168
|
+
|
|
169
|
+
<a href="#is_ipv6%3F-instance_method" title="#is_ipv6? (instance method)">- (Boolean) <strong>is_ipv6?</strong>(address) </a>
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
</span>
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
<span class="summary_desc"><div class='inline'><p>Checks if an address is a valid IPv6 address.</p>
|
|
184
|
+
</div></span>
|
|
185
|
+
|
|
186
|
+
</li>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
<li class="public ">
|
|
190
|
+
<span class="summary_signature">
|
|
191
|
+
|
|
192
|
+
<a href="#manage_address-instance_method" title="#manage_address (instance method)">- (Boolean) <strong>manage_address</strong>(type, address, dry_run = false) </a>
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
</span>
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
<span class="summary_desc"><div class='inline'><p>Adds or removes an alias from the interface.</p>
|
|
207
|
+
</div></span>
|
|
208
|
+
|
|
209
|
+
</li>
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
<li class="public ">
|
|
213
|
+
<span class="summary_signature">
|
|
214
|
+
|
|
215
|
+
<a href="#manage_aliases-instance_method" title="#manage_aliases (instance method)">- (Boolean) <strong>manage_aliases</strong>(operation, message, options) </a>
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
</span>
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
<span class="summary_desc"><div class='inline'><p>Manages aliases.</p>
|
|
230
|
+
</div></span>
|
|
231
|
+
|
|
232
|
+
</li>
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
</ul>
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
<div id="instance_method_details" class="method_details_list">
|
|
242
|
+
<h2>Instance Method Details</h2>
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
<div class="method_details first">
|
|
246
|
+
<h3 class="signature first" id="compute_addresses-instance_method">
|
|
247
|
+
|
|
248
|
+
- (<tt>Array</tt>) <strong>compute_addresses</strong>(type = :all)
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
</h3><div class="docstring">
|
|
255
|
+
<div class="discussion">
|
|
256
|
+
<p>Computes the list of address to manage.</p>
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
</div>
|
|
260
|
+
</div>
|
|
261
|
+
<div class="tags">
|
|
262
|
+
<p class="tag_title">Parameters:</p>
|
|
263
|
+
<ul class="param">
|
|
264
|
+
|
|
265
|
+
<li>
|
|
266
|
+
|
|
267
|
+
<span class='name'>type</span>
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
<em class="default">(defaults to: <tt>:all</tt>)</em>
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
—
|
|
277
|
+
<div class='inline'><p>The type of addresses to consider. Valid values are <code>:ipv4</code>, <code>:ipv6</code>, otherwise all addresses are considered.</p>
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
</li>
|
|
281
|
+
|
|
282
|
+
</ul>
|
|
283
|
+
|
|
284
|
+
<p class="tag_title">Returns:</p>
|
|
285
|
+
<ul class="return">
|
|
286
|
+
|
|
287
|
+
<li>
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
—
|
|
295
|
+
<div class='inline'><p>The list of addresses to add or remove from the interface.</p>
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
</li>
|
|
299
|
+
|
|
300
|
+
</ul>
|
|
301
|
+
|
|
302
|
+
</div><table class="source_code">
|
|
303
|
+
<tr>
|
|
304
|
+
<td>
|
|
305
|
+
<pre class="lines">
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
340
|
|
309
|
+
341
|
|
310
|
+
342
|
|
311
|
+
343</pre>
|
|
312
|
+
</td>
|
|
313
|
+
<td>
|
|
314
|
+
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 340</span>
|
|
315
|
+
|
|
316
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_compute_addresses'>compute_addresses</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='symbol'>:all</span><span class='rparen'>)</span>
|
|
317
|
+
<span class='id identifier rubyid_config'>config</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_config'>config</span>
|
|
318
|
+
<span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_addresses'>addresses</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='op'>?</span> <span class='id identifier rubyid_filter_addresses'>filter_addresses</span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_generate_addresses'>generate_addresses</span><span class='lparen'>(</span><span class='id identifier rubyid_config'>config</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span>
|
|
319
|
+
<span class='kw'>end</span></pre>
|
|
320
|
+
</td>
|
|
321
|
+
</tr>
|
|
322
|
+
</table>
|
|
323
|
+
</div>
|
|
324
|
+
|
|
325
|
+
<div class="method_details ">
|
|
326
|
+
<h3 class="signature " id="is_ipv4?-instance_method">
|
|
327
|
+
|
|
328
|
+
- (<tt>Boolean</tt>) <strong>is_ipv4?</strong>(address)
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
</h3><div class="docstring">
|
|
335
|
+
<div class="discussion">
|
|
336
|
+
<p>Checks if an address is a valid IPv4 address.</p>
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
</div>
|
|
340
|
+
</div>
|
|
341
|
+
<div class="tags">
|
|
342
|
+
<p class="tag_title">Parameters:</p>
|
|
343
|
+
<ul class="param">
|
|
344
|
+
|
|
345
|
+
<li>
|
|
346
|
+
|
|
347
|
+
<span class='name'>address</span>
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
—
|
|
355
|
+
<div class='inline'><p>The address to check.</p>
|
|
356
|
+
</div>
|
|
357
|
+
|
|
358
|
+
</li>
|
|
359
|
+
|
|
360
|
+
</ul>
|
|
361
|
+
|
|
362
|
+
<p class="tag_title">Returns:</p>
|
|
363
|
+
<ul class="return">
|
|
364
|
+
|
|
365
|
+
<li>
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
—
|
|
373
|
+
<div class='inline'><p><code>true</code> if the address is a valid IPv4 address, <code>false</code> otherwise.</p>
|
|
374
|
+
</div>
|
|
375
|
+
|
|
376
|
+
</li>
|
|
377
|
+
|
|
378
|
+
</ul>
|
|
379
|
+
|
|
380
|
+
</div><table class="source_code">
|
|
381
|
+
<tr>
|
|
382
|
+
<td>
|
|
383
|
+
<pre class="lines">
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
349
|
|
387
|
+
350
|
|
388
|
+
351
|
|
389
|
+
352
|
|
390
|
+
353
|
|
391
|
+
354</pre>
|
|
392
|
+
</td>
|
|
393
|
+
<td>
|
|
394
|
+
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 349</span>
|
|
395
|
+
|
|
396
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_is_ipv4?'>is_ipv4?</span><span class='lparen'>(</span><span class='id identifier rubyid_address'>address</span><span class='rparen'>)</span>
|
|
397
|
+
<span class='id identifier rubyid_address'>address</span> <span class='op'>=</span> <span class='id identifier rubyid_address'>address</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
|
398
|
+
|
|
399
|
+
<span class='id identifier rubyid_mo'>mo</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\Z</span><span class='regexp_end'>/</span></span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='id identifier rubyid_address'>address</span><span class='rparen'>)</span>
|
|
400
|
+
<span class='lparen'>(</span><span class='id identifier rubyid_mo'>mo</span> <span class='op'>&&</span> <span class='id identifier rubyid_mo'>mo</span><span class='period'>.</span><span class='id identifier rubyid_captures'>captures</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'><</span> <span class='int'>256</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
|
|
401
|
+
<span class='kw'>end</span></pre>
|
|
402
|
+
</td>
|
|
403
|
+
</tr>
|
|
404
|
+
</table>
|
|
405
|
+
</div>
|
|
406
|
+
|
|
407
|
+
<div class="method_details ">
|
|
408
|
+
<h3 class="signature " id="is_ipv6?-instance_method">
|
|
409
|
+
|
|
410
|
+
- (<tt>Boolean</tt>) <strong>is_ipv6?</strong>(address)
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
</h3><div class="docstring">
|
|
417
|
+
<div class="discussion">
|
|
418
|
+
<p>Checks if an address is a valid IPv6 address.</p>
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
</div>
|
|
422
|
+
</div>
|
|
423
|
+
<div class="tags">
|
|
424
|
+
<p class="tag_title">Parameters:</p>
|
|
425
|
+
<ul class="param">
|
|
426
|
+
|
|
427
|
+
<li>
|
|
428
|
+
|
|
429
|
+
<span class='name'>address</span>
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
—
|
|
437
|
+
<div class='inline'><p>The address to check.</p>
|
|
438
|
+
</div>
|
|
439
|
+
|
|
440
|
+
</li>
|
|
441
|
+
|
|
442
|
+
</ul>
|
|
443
|
+
|
|
444
|
+
<p class="tag_title">Returns:</p>
|
|
445
|
+
<ul class="return">
|
|
446
|
+
|
|
447
|
+
<li>
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
—
|
|
455
|
+
<div class='inline'><p><code>true</code> if the address is a valid IPv6 address, <code>false</code> otherwise.</p>
|
|
456
|
+
</div>
|
|
457
|
+
|
|
458
|
+
</li>
|
|
459
|
+
|
|
460
|
+
</ul>
|
|
461
|
+
|
|
462
|
+
</div><table class="source_code">
|
|
463
|
+
<tr>
|
|
464
|
+
<td>
|
|
465
|
+
<pre class="lines">
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
360
|
|
469
|
+
361
|
|
470
|
+
362
|
|
471
|
+
363
|
|
472
|
+
364
|
|
473
|
+
365
|
|
474
|
+
366
|
|
475
|
+
367
|
|
476
|
+
368
|
|
477
|
+
369
|
|
478
|
+
370
|
|
479
|
+
371
|
|
480
|
+
372
|
|
481
|
+
373
|
|
482
|
+
374
|
|
483
|
+
375</pre>
|
|
484
|
+
</td>
|
|
485
|
+
<td>
|
|
486
|
+
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 360</span>
|
|
487
|
+
|
|
488
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_is_ipv6?'>is_ipv6?</span><span class='lparen'>(</span><span class='id identifier rubyid_address'>address</span><span class='rparen'>)</span>
|
|
489
|
+
<span class='id identifier rubyid_address'>address</span> <span class='op'>=</span> <span class='id identifier rubyid_address'>address</span><span class='period'>.</span><span class='id identifier rubyid_ensure_string'>ensure_string</span>
|
|
490
|
+
|
|
491
|
+
<span class='id identifier rubyid_catch'>catch</span><span class='lparen'>(</span><span class='symbol'>:valid</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
|
492
|
+
<span class='comment'># IPv6 (normal)
|
|
493
|
+
</span> <span class='id identifier rubyid_throw'>throw</span><span class='lparen'>(</span><span class='symbol'>:valid</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*\Z</span><span class='regexp_end'>/</span></span> <span class='op'>=~</span> <span class='id identifier rubyid_address'>address</span>
|
|
494
|
+
<span class='id identifier rubyid_throw'>throw</span><span class='lparen'>(</span><span class='symbol'>:valid</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*)?\Z</span><span class='regexp_end'>/</span></span> <span class='op'>=~</span> <span class='id identifier rubyid_address'>address</span>
|
|
495
|
+
<span class='id identifier rubyid_throw'>throw</span><span class='lparen'>(</span><span class='symbol'>:valid</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*)?\Z</span><span class='regexp_end'>/</span></span> <span class='op'>=~</span> <span class='id identifier rubyid_address'>address</span>
|
|
496
|
+
<span class='comment'># IPv6 (IPv4 compat)
|
|
497
|
+
</span> <span class='id identifier rubyid_throw'>throw</span><span class='lparen'>(</span><span class='symbol'>:valid</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*:</span><span class='regexp_end'>/</span></span> <span class='op'>=~</span> <span class='id identifier rubyid_address'>address</span> <span class='op'>&&</span> <span class='id identifier rubyid_is_ipv4?'>is_ipv4?</span><span class='lparen'>(</span><span class='backref'>$'</span><span class='rparen'>)</span>
|
|
498
|
+
<span class='id identifier rubyid_throw'>throw</span><span class='lparen'>(</span><span class='symbol'>:valid</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A[\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*:)?</span><span class='regexp_end'>/</span></span> <span class='op'>=~</span> <span class='id identifier rubyid_address'>address</span> <span class='op'>&&</span> <span class='id identifier rubyid_is_ipv4?'>is_ipv4?</span><span class='lparen'>(</span><span class='backref'>$'</span><span class='rparen'>)</span>
|
|
499
|
+
<span class='id identifier rubyid_throw'>throw</span><span class='lparen'>(</span><span class='symbol'>:valid</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A::([\dA-Fa-f]{1,4}(:[\dA-Fa-f]{1,4})*:)?</span><span class='regexp_end'>/</span></span> <span class='op'>=~</span> <span class='id identifier rubyid_address'>address</span> <span class='op'>&&</span> <span class='id identifier rubyid_is_ipv4?'>is_ipv4?</span><span class='lparen'>(</span><span class='backref'>$'</span><span class='rparen'>)</span>
|
|
500
|
+
|
|
501
|
+
<span class='kw'>false</span>
|
|
502
|
+
<span class='kw'>end</span>
|
|
503
|
+
<span class='kw'>end</span></pre>
|
|
504
|
+
</td>
|
|
505
|
+
</tr>
|
|
506
|
+
</table>
|
|
507
|
+
</div>
|
|
508
|
+
|
|
509
|
+
<div class="method_details ">
|
|
510
|
+
<h3 class="signature " id="manage_address-instance_method">
|
|
511
|
+
|
|
512
|
+
- (<tt>Boolean</tt>) <strong>manage_address</strong>(type, address, dry_run = false)
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
</h3><div class="docstring">
|
|
519
|
+
<div class="discussion">
|
|
520
|
+
<p>Adds or removes an alias from the interface.</p>
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
</div>
|
|
524
|
+
</div>
|
|
525
|
+
<div class="tags">
|
|
526
|
+
<p class="tag_title">Parameters:</p>
|
|
527
|
+
<ul class="param">
|
|
528
|
+
|
|
529
|
+
<li>
|
|
530
|
+
|
|
531
|
+
<span class='name'>type</span>
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
—
|
|
539
|
+
<div class='inline'><p>The operation to execute. Can be <code>:add</code> or <code>:remove</code>.</p>
|
|
540
|
+
</div>
|
|
541
|
+
|
|
542
|
+
</li>
|
|
543
|
+
|
|
544
|
+
<li>
|
|
545
|
+
|
|
546
|
+
<span class='name'>address</span>
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
—
|
|
554
|
+
<div class='inline'><p>The address to manage.</p>
|
|
555
|
+
</div>
|
|
556
|
+
|
|
557
|
+
</li>
|
|
558
|
+
|
|
559
|
+
<li>
|
|
560
|
+
|
|
561
|
+
<span class='name'>dry_run</span>
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
<em class="default">(defaults to: <tt>false</tt>)</em>
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
—
|
|
571
|
+
<div class='inline'><p>If only show which modifications will be done.</p>
|
|
572
|
+
</div>
|
|
573
|
+
|
|
574
|
+
</li>
|
|
575
|
+
|
|
576
|
+
</ul>
|
|
577
|
+
|
|
578
|
+
<p class="tag_title">Returns:</p>
|
|
579
|
+
<ul class="return">
|
|
580
|
+
|
|
581
|
+
<li>
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
—
|
|
589
|
+
<div class='inline'><p><code>true</code> if operation succeeded, <code>false</code> otherwise.</p>
|
|
590
|
+
</div>
|
|
591
|
+
|
|
592
|
+
</li>
|
|
593
|
+
|
|
594
|
+
</ul>
|
|
595
|
+
|
|
596
|
+
</div><table class="source_code">
|
|
597
|
+
<tr>
|
|
598
|
+
<td>
|
|
599
|
+
<pre class="lines">
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
320
|
|
603
|
+
321
|
|
604
|
+
322
|
|
605
|
+
323
|
|
606
|
+
324
|
|
607
|
+
325
|
|
608
|
+
326
|
|
609
|
+
327
|
|
610
|
+
328
|
|
611
|
+
329
|
|
612
|
+
330
|
|
613
|
+
331
|
|
614
|
+
332
|
|
615
|
+
333
|
|
616
|
+
334</pre>
|
|
617
|
+
</td>
|
|
618
|
+
<td>
|
|
619
|
+
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 320</span>
|
|
620
|
+
|
|
621
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_manage_address'>manage_address</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_address'>address</span><span class='comma'>,</span> <span class='id identifier rubyid_dry_run'>dry_run</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
|
622
|
+
<span class='id identifier rubyid_locale'>locale</span> <span class='op'>=</span> <span class='id identifier rubyid_i18n'>i18n</span>
|
|
623
|
+
<span class='id identifier rubyid_rv'>rv</span><span class='comma'>,</span> <span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='id identifier rubyid_prefix'>prefix</span> <span class='op'>=</span> <span class='id identifier rubyid_setup_management'>setup_management</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_address'>address</span><span class='rparen'>)</span>
|
|
624
|
+
|
|
625
|
+
<span class='comment'># Now execute
|
|
626
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_rv'>rv</span> <span class='kw'>then</span>
|
|
627
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_dry_run'>dry_run</span> <span class='kw'>then</span>
|
|
628
|
+
<span class='id identifier rubyid_execute_manage'>execute_manage</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='id identifier rubyid_prefix'>prefix</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_address'>address</span><span class='comma'>,</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_config'>config</span><span class='rparen'>)</span>
|
|
629
|
+
<span class='kw'>else</span>
|
|
630
|
+
<span class='id identifier rubyid_log_management'>log_management</span><span class='lparen'>(</span><span class='symbol'>:dry_run</span><span class='comma'>,</span> <span class='id identifier rubyid_prefix'>prefix</span><span class='comma'>,</span> <span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='period'>.</span><span class='id identifier rubyid_remove'>remove</span><span class='comma'>,</span> <span class='id identifier rubyid_locale'>locale</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='comma'>,</span> <span class='id identifier rubyid_address'>address</span><span class='comma'>,</span> <span class='id identifier rubyid_config'>config</span><span class='rparen'>)</span>
|
|
631
|
+
<span class='kw'>end</span>
|
|
632
|
+
<span class='kw'>end</span>
|
|
633
|
+
|
|
634
|
+
<span class='id identifier rubyid_rv'>rv</span>
|
|
635
|
+
<span class='kw'>end</span></pre>
|
|
636
|
+
</td>
|
|
637
|
+
</tr>
|
|
638
|
+
</table>
|
|
639
|
+
</div>
|
|
640
|
+
|
|
641
|
+
<div class="method_details ">
|
|
642
|
+
<h3 class="signature " id="manage_aliases-instance_method">
|
|
643
|
+
|
|
644
|
+
- (<tt>Boolean</tt>) <strong>manage_aliases</strong>(operation, message, options)
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
</h3><div class="docstring">
|
|
651
|
+
<div class="discussion">
|
|
652
|
+
<p>Manages aliases.</p>
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
</div>
|
|
656
|
+
</div>
|
|
657
|
+
<div class="tags">
|
|
658
|
+
<p class="tag_title">Parameters:</p>
|
|
659
|
+
<ul class="param">
|
|
660
|
+
|
|
661
|
+
<li>
|
|
662
|
+
|
|
663
|
+
<span class='name'>operation</span>
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
<span class='type'>(<tt>Symbol</tt>)</span>
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
—
|
|
671
|
+
<div class='inline'><p>The type of operation. Can be <code>:add</code> or <code>:remove</code>.</p>
|
|
672
|
+
</div>
|
|
673
|
+
|
|
674
|
+
</li>
|
|
675
|
+
|
|
676
|
+
<li>
|
|
677
|
+
|
|
678
|
+
<span class='name'>message</span>
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
—
|
|
686
|
+
<div class='inline'><p>The message to show if no addresses are found.</p>
|
|
687
|
+
</div>
|
|
688
|
+
|
|
689
|
+
</li>
|
|
690
|
+
|
|
691
|
+
<li>
|
|
692
|
+
|
|
693
|
+
<span class='name'>options</span>
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
—
|
|
701
|
+
<div class='inline'><p>The options provided by the user.</p>
|
|
702
|
+
</div>
|
|
703
|
+
|
|
704
|
+
</li>
|
|
705
|
+
|
|
706
|
+
</ul>
|
|
707
|
+
|
|
708
|
+
<p class="tag_title">Returns:</p>
|
|
709
|
+
<ul class="return">
|
|
710
|
+
|
|
711
|
+
<li>
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
—
|
|
719
|
+
<div class='inline'><p><code>true</code> if operation succeeded, <code>false</code> otherwise.</p>
|
|
720
|
+
</div>
|
|
721
|
+
|
|
722
|
+
</li>
|
|
723
|
+
|
|
724
|
+
</ul>
|
|
725
|
+
|
|
726
|
+
</div><table class="source_code">
|
|
727
|
+
<tr>
|
|
728
|
+
<td>
|
|
729
|
+
<pre class="lines">
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
299
|
|
733
|
+
300
|
|
734
|
+
301
|
|
735
|
+
302
|
|
736
|
+
303
|
|
737
|
+
304
|
|
738
|
+
305
|
|
739
|
+
306
|
|
740
|
+
307
|
|
741
|
+
308
|
|
742
|
+
309
|
|
743
|
+
310
|
|
744
|
+
311
|
|
745
|
+
312</pre>
|
|
746
|
+
</td>
|
|
747
|
+
<td>
|
|
748
|
+
<pre class="code"><span class="info file"># File 'lib/devdnsd/application.rb', line 299</span>
|
|
749
|
+
|
|
750
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_manage_aliases'>manage_aliases</span><span class='lparen'>(</span><span class='id identifier rubyid_operation'>operation</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
|
751
|
+
<span class='id identifier rubyid_config'>config</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_config'>config</span>
|
|
752
|
+
<span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_k'>k</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_k'>k</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
753
|
+
|
|
754
|
+
<span class='id identifier rubyid_addresses'>addresses</span> <span class='op'>=</span> <span class='id identifier rubyid_compute_addresses'>compute_addresses</span>
|
|
755
|
+
|
|
756
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_addresses'>addresses</span><span class='period'>.</span><span class='id identifier rubyid_present?'>present?</span> <span class='kw'>then</span>
|
|
757
|
+
<span class='comment'># Now, for every address, call the command
|
|
758
|
+
</span> <span class='id identifier rubyid_addresses'>addresses</span><span class='period'>.</span><span class='id identifier rubyid_all?'>all?</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_address'>address</span><span class='op'>|</span> <span class='id identifier rubyid_manage_address'>manage_address</span><span class='lparen'>(</span><span class='id identifier rubyid_operation'>operation</span><span class='comma'>,</span> <span class='id identifier rubyid_address'>address</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:dry_run</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
759
|
+
<span class='kw'>else</span>
|
|
760
|
+
<span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
|
|
761
|
+
<span class='kw'>false</span>
|
|
762
|
+
<span class='kw'>end</span>
|
|
763
|
+
<span class='kw'>end</span></pre>
|
|
764
|
+
</td>
|
|
765
|
+
</tr>
|
|
766
|
+
</table>
|
|
767
|
+
</div>
|
|
768
|
+
|
|
769
|
+
</div>
|
|
770
|
+
|
|
771
|
+
</div>
|
|
772
|
+
|
|
773
|
+
<div id="footer">
|
|
774
|
+
Generated on Sun Aug 18 16:18:38 2013 by
|
|
775
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
776
|
+
0.8.7 (ruby-2.0.0).
|
|
777
|
+
</div>
|
|
778
|
+
|
|
779
|
+
</body>
|
|
780
|
+
</html>
|