unbound 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/CONTRIBUTING.md +116 -0
- data/Gemfile +2 -1
- data/Rakefile +3 -1
- data/VERSION +1 -1
- data/lib/unbound/context.rb +14 -0
- data/spec/context_spec.rb +26 -8
- data/spec/query_spec.rb +6 -6
- data/spec/resolver_spec.rb +6 -6
- data/spec/spec_helper.rb +2 -0
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 211b56bb13a5da0ea3a1b0421fe41f6411db3f28
|
4
|
+
data.tar.gz: 29166b0876346b3594e526ad2b73334617691ac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bfe6de68443b48c64989b827f010a348d5d02058013aacabb3190c03b212301bce6b859311d935d2258869a4c71db25e32375ba48f62c1cf057431fd9f9579b
|
7
|
+
data.tar.gz: 14b676d3ba013c16914494abe81b46c21341de3420a34e84801e869926dcc0d532a535971aa24d628f9f11fe3a3d50dcbd50797437b1d5e8818f8bc5edcac1a1
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Next
|
2
|
+
====
|
3
|
+
|
4
|
+
* Your contribution here.
|
5
|
+
|
6
|
+
2.1.0 (2014-07-23)
|
7
|
+
==================
|
8
|
+
|
9
|
+
* Make :spec default rake task - [@justfalter](https://github.com/justfalter)
|
10
|
+
* Add CONTRIBUTING.md - [@justfalter](https://github.com/justfalter)
|
11
|
+
* Rename Changes -> CHANGELOG.md - [@justfalter](https://github.com/justfalter)
|
12
|
+
* [#2](https://github.com/justfalter/unbound-ruby/pull/2): Add helper for synchronous queries - [@corny](https://github.com/corny)
|
13
|
+
|
14
|
+
2.0.0 (2014-03-12)
|
15
|
+
==================
|
16
|
+
* Breaking change: Unbound::Query#cancel! no longer cancels the query. Instead, use Unbound::Resolver#cancel_query to cancel queries. - [@justfalter](https://github.com/justfalter)
|
17
|
+
* Unbound::Query#async_id will now be set to nil when the query has finished. - [@justfalter](https://github.com/justfalter)
|
18
|
+
* Disable autoclose on the return of Context#io object. autoclose is bad news. - [@justfalter](https://github.com/justfalter)
|
19
|
+
|
20
|
+
1.0.1 (2014-03-06)
|
21
|
+
==================
|
22
|
+
* Fix issue where the resolver couldn't keep track of in-flight queries on 32-bit systems. - [@justfalter](https://github.com/justfalter)
|
23
|
+
|
24
|
+
1.0.0 (2014-01-31)
|
25
|
+
==================
|
26
|
+
* Initial release. - [@justfalter](https://github.com/justfalter)
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
Contributing to Unbound-Ruby
|
2
|
+
============================
|
3
|
+
|
4
|
+
You're encouraged to submit [pull requests](https://github.com/justfalter/unbound-ruby/pulls), [propose features and discuss issues](https://github.com/justfalter/unbound-ruby/issues).
|
5
|
+
|
6
|
+
#### Fork the Project
|
7
|
+
|
8
|
+
Fork the [project on Github](https://github.com/justfalter/unbound-ruby) and check out your copy.
|
9
|
+
|
10
|
+
```
|
11
|
+
git clone https://github.com/contributor/unbound-ruby.git
|
12
|
+
cd unbound-ruby
|
13
|
+
git remote add upstream https://github.com/justfalter/unbount-ruby.git
|
14
|
+
```
|
15
|
+
|
16
|
+
#### Create a Topic Branch
|
17
|
+
|
18
|
+
Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
|
19
|
+
|
20
|
+
```
|
21
|
+
git checkout master
|
22
|
+
git pull upstream master
|
23
|
+
git checkout -b my-feature-branch
|
24
|
+
```
|
25
|
+
|
26
|
+
#### Bundle Install and Test
|
27
|
+
|
28
|
+
Ensure that you can build the project and run tests.
|
29
|
+
|
30
|
+
```
|
31
|
+
bundle install
|
32
|
+
bundle exec rake
|
33
|
+
```
|
34
|
+
|
35
|
+
#### Write Tests
|
36
|
+
|
37
|
+
Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build. Add to [spec/](spec/).
|
38
|
+
|
39
|
+
We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
|
40
|
+
|
41
|
+
#### Write Code
|
42
|
+
|
43
|
+
Implement your feature or bug fix.
|
44
|
+
|
45
|
+
Make sure that `bundle exec rake` completes without errors.
|
46
|
+
|
47
|
+
#### Write Documentation
|
48
|
+
|
49
|
+
Document any external behavior in the [README](README.md).
|
50
|
+
|
51
|
+
#### Update Changelog
|
52
|
+
|
53
|
+
Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*. Make it look like every other line, including your name and link to your Github account.
|
54
|
+
|
55
|
+
#### Commit Changes
|
56
|
+
|
57
|
+
Make sure git knows your name and email address:
|
58
|
+
|
59
|
+
```
|
60
|
+
git config --global user.name "Your Name"
|
61
|
+
git config --global user.email "contributor@example.com"
|
62
|
+
```
|
63
|
+
|
64
|
+
Writing good commit logs is important. A commit log should describe what changed and why.
|
65
|
+
|
66
|
+
```
|
67
|
+
git add ...
|
68
|
+
git commit
|
69
|
+
```
|
70
|
+
|
71
|
+
#### Push
|
72
|
+
|
73
|
+
```
|
74
|
+
git push origin my-feature-branch
|
75
|
+
```
|
76
|
+
|
77
|
+
#### Make a Pull Request
|
78
|
+
|
79
|
+
Go to https://github.com/contributor/unbound-ruby and select your feature branch. Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
|
80
|
+
|
81
|
+
#### Rebase
|
82
|
+
|
83
|
+
If you've been working on a change for a while, rebase with upstream/master.
|
84
|
+
|
85
|
+
```
|
86
|
+
git fetch upstream
|
87
|
+
git rebase upstream/master
|
88
|
+
git push origin my-feature-branch -f
|
89
|
+
```
|
90
|
+
|
91
|
+
#### Update CHANGELOG Again
|
92
|
+
|
93
|
+
Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
|
94
|
+
|
95
|
+
```
|
96
|
+
* [#123](https://github.com/justfalter/unbound-ruby/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
|
97
|
+
```
|
98
|
+
|
99
|
+
Amend your previous commit and force push the changes.
|
100
|
+
|
101
|
+
```
|
102
|
+
git commit --amend
|
103
|
+
git push origin my-feature-branch -f
|
104
|
+
```
|
105
|
+
|
106
|
+
#### Check on Your Pull Request
|
107
|
+
|
108
|
+
Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
|
109
|
+
|
110
|
+
#### Be Patient
|
111
|
+
|
112
|
+
It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
|
113
|
+
|
114
|
+
#### Thank You
|
115
|
+
|
116
|
+
Please do know that we really appreciate and value your time and work. We love you, really.
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -26,7 +26,7 @@ else
|
|
26
26
|
Dir.glob("examples/*") +
|
27
27
|
Dir.glob("spec/{*.rb}") +
|
28
28
|
Dir.glob("spec/conf/{*.conf}") +
|
29
|
-
%w(LICENSE.txt Gemfile README.md Rakefile VERSION)
|
29
|
+
%w(CONTRIBUTING.md CHANGELOG.md LICENSE.txt Gemfile README.md Rakefile VERSION)
|
30
30
|
|
31
31
|
end
|
32
32
|
Jeweler::RubygemsDotOrgTasks.new
|
@@ -41,3 +41,5 @@ else
|
|
41
41
|
spec.pattern = FileList['spec/**/*_spec.rb']
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
task :default => [:spec]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.1.0
|
data/lib/unbound/context.rb
CHANGED
@@ -87,6 +87,20 @@ module Unbound
|
|
87
87
|
Unbound::Bindings.ub_fd(@ub_ctx)
|
88
88
|
end
|
89
89
|
|
90
|
+
def resolve(name, rrtype=1, rrclass=1)
|
91
|
+
check_closed!
|
92
|
+
result_ptr = FFI::MemoryPointer.new :pointer
|
93
|
+
raise_if_error!(
|
94
|
+
Unbound::Bindings.ub_resolve(
|
95
|
+
@ub_ctx, name, rrtype, rrclass, result_ptr))
|
96
|
+
ptr = result_ptr.get_pointer(0)
|
97
|
+
begin
|
98
|
+
Unbound::Result.new(ptr).to_resolv
|
99
|
+
ensure
|
100
|
+
Unbound::Bindings.ub_resolve_free ptr
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
90
104
|
def resolve_async(name, rrtype, rrclass, callback, private_data = nil)
|
91
105
|
check_closed!
|
92
106
|
async_id_ptr = FFI::MemoryPointer.new :int
|
data/spec/context_spec.rb
CHANGED
@@ -10,25 +10,25 @@ describe Unbound::Context do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
subject { @ctx }
|
13
|
-
its(:raise_on_noid?) { should
|
13
|
+
its(:raise_on_noid?) { should eq false }
|
14
14
|
|
15
15
|
|
16
16
|
it "should let me indicate that it should raise an error if the error code is :noid" do
|
17
17
|
@ctx.raise_on_noid = true
|
18
|
-
expect(@ctx.raise_on_noid?).to
|
18
|
+
expect(@ctx.raise_on_noid?).to eq true
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "#closed?" do
|
22
22
|
it "should indicate whether the context is closed or not" do
|
23
|
-
expect(@ctx.closed?).to
|
23
|
+
expect(@ctx.closed?).to eq false
|
24
24
|
@ctx.close
|
25
|
-
expect(@ctx.closed?).to
|
25
|
+
expect(@ctx.closed?).to eq true
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "#close" do
|
30
30
|
it "should delete the underlying context" do
|
31
|
-
Unbound::Bindings.
|
31
|
+
expect(Unbound::Bindings).to receive(:ub_ctx_delete)
|
32
32
|
@ctx.close
|
33
33
|
end
|
34
34
|
|
@@ -70,6 +70,24 @@ describe Unbound::Context do
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
+
|
74
|
+
context "an synchronous name resolution method" do
|
75
|
+
# expects:
|
76
|
+
# @ctx
|
77
|
+
describe 'existing zone' do
|
78
|
+
before :each do
|
79
|
+
@ctx.load_config(UnboundHelper.config_file("local_zone.conf"))
|
80
|
+
end
|
81
|
+
subject{ @ctx.resolve("mycomputer.local", 1, 1) }
|
82
|
+
it "should have the proper answer" do
|
83
|
+
expect(subject.answer.length).to be(1)
|
84
|
+
answer = subject.answer[0]
|
85
|
+
expect(answer[0].to_s).to eq("mycomputer.local")
|
86
|
+
expect(answer[2].address.to_s).to eq("192.0.2.51")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
73
91
|
shared_examples_for "an asynchronous name resolution method" do
|
74
92
|
# expects:
|
75
93
|
# @processing_proc = A Proc
|
@@ -126,14 +144,14 @@ describe Unbound::Context do
|
|
126
144
|
|
127
145
|
it "should raise an APIError when canceling a non-existent query" do
|
128
146
|
@ctx.raise_on_noid = true
|
129
|
-
expect(@ctx.raise_on_noid?).to
|
147
|
+
expect(@ctx.raise_on_noid?).to eq true
|
130
148
|
expect(lambda do
|
131
149
|
@ctx.cancel_async_query(@async_id + 1)
|
132
150
|
end).to raise_error(Unbound::APIError)
|
133
151
|
end
|
134
152
|
|
135
153
|
it "#raise_on_noid=false should raise an APIError when canceling a non-existent query" do
|
136
|
-
expect(@ctx.raise_on_noid?).to
|
154
|
+
expect(@ctx.raise_on_noid?).to eq false
|
137
155
|
expect(@ctx.cancel_async_query(@async_id + 1)).to eq(:noid)
|
138
156
|
end
|
139
157
|
end
|
@@ -149,7 +167,7 @@ describe Unbound::Context do
|
|
149
167
|
end
|
150
168
|
|
151
169
|
it "should not be set to autoclose" do
|
152
|
-
expect(@ctx.io.autoclose?).to
|
170
|
+
expect(@ctx.io.autoclose?).to eq false
|
153
171
|
end
|
154
172
|
|
155
173
|
it "should not autoclose when garbage collection occurs" do
|
data/spec/query_spec.rb
CHANGED
@@ -16,20 +16,20 @@ describe Unbound::Query do
|
|
16
16
|
|
17
17
|
describe "#finished?" do
|
18
18
|
it "should be false by default" do
|
19
|
-
expect(@query.finished?).to
|
19
|
+
expect(@query.finished?).to eq false
|
20
20
|
end
|
21
21
|
it "should be true after #cancel! is called" do
|
22
22
|
@query.cancel!
|
23
|
-
expect(@query.finished?).to
|
23
|
+
expect(@query.finished?).to eq true
|
24
24
|
end
|
25
25
|
it "should be true after #error! is called" do
|
26
26
|
@query.error!(1234)
|
27
|
-
expect(@query.finished?).to
|
27
|
+
expect(@query.finished?).to eq true
|
28
28
|
end
|
29
29
|
it "should be true after #answer! is called" do
|
30
30
|
result = double("Result")
|
31
31
|
@query.answer!(result)
|
32
|
-
expect(@query.finished?).to
|
32
|
+
expect(@query.finished?).to eq true
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -64,11 +64,11 @@ describe Unbound::Query do
|
|
64
64
|
|
65
65
|
describe "#started?" do
|
66
66
|
it "should be false by default" do
|
67
|
-
expect(@query.started?).to
|
67
|
+
expect(@query.started?).to eq false
|
68
68
|
end
|
69
69
|
it "should be true after start! is called" do
|
70
70
|
@query.start!(1234)
|
71
|
-
expect(@query.started?).to
|
71
|
+
expect(@query.started?).to eq true
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
data/spec/resolver_spec.rb
CHANGED
@@ -78,33 +78,33 @@ describe Unbound::Resolver do
|
|
78
78
|
|
79
79
|
describe "#outstanding_queries?" do
|
80
80
|
it "should be false if there are no outstanding queries" do
|
81
|
-
expect(@resolver.outstanding_queries?).to
|
81
|
+
expect(@resolver.outstanding_queries?).to eq false
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should be true if there are any outstanding queries" do
|
85
85
|
@resolver.send_query(query)
|
86
|
-
expect(@resolver.outstanding_queries?).to
|
86
|
+
expect(@resolver.outstanding_queries?).to eq true
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
90
|
describe "#closed?" do
|
91
91
|
it "should not be closed by default" do
|
92
|
-
expect(@resolver.closed?).to
|
92
|
+
expect(@resolver.closed?).to eq false
|
93
93
|
end
|
94
94
|
it "should be closed after calling #close" do
|
95
95
|
@resolver.close
|
96
|
-
expect(@resolver.closed?).to
|
96
|
+
expect(@resolver.closed?).to eq true
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
100
|
describe "#close" do
|
101
101
|
it "should call #cancel_all" do
|
102
|
-
@resolver.
|
102
|
+
expect(@resolver).to receive(:cancel_all).and_call_original
|
103
103
|
@resolver.close
|
104
104
|
end
|
105
105
|
|
106
106
|
it "should close the context" do
|
107
|
-
@
|
107
|
+
expect(@resolver).to receive(:close).and_call_original
|
108
108
|
@resolver.close
|
109
109
|
end
|
110
110
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unbound
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Ryan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jeweler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: Unbound DNS resolver bindings for Ruby
|
@@ -46,6 +46,8 @@ extra_rdoc_files:
|
|
46
46
|
- LICENSE.txt
|
47
47
|
- README.md
|
48
48
|
files:
|
49
|
+
- CHANGELOG.md
|
50
|
+
- CONTRIBUTING.md
|
49
51
|
- Gemfile
|
50
52
|
- LICENSE.txt
|
51
53
|
- README.md
|
@@ -81,17 +83,17 @@ require_paths:
|
|
81
83
|
- lib
|
82
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
85
|
requirements:
|
84
|
-
- -
|
86
|
+
- - ">="
|
85
87
|
- !ruby/object:Gem::Version
|
86
88
|
version: '0'
|
87
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
90
|
requirements:
|
89
|
-
- -
|
91
|
+
- - ">="
|
90
92
|
- !ruby/object:Gem::Version
|
91
93
|
version: '0'
|
92
94
|
requirements: []
|
93
95
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.0
|
96
|
+
rubygems_version: 2.2.0
|
95
97
|
signing_key:
|
96
98
|
specification_version: 4
|
97
99
|
summary: Unbound DNS resolver bindings for Ruby
|