Class: PowerDNS::Pipe
- Inherits:
-
Object
- Object
- PowerDNS::Pipe
- Defined in:
- lib/powerdns_pipe.rb
Overview
DnsPipe is an abstraction of the Powerdns pipe backend protocol. doc.powerdns.com/backends-detail.html
It’s dead simple to use, see the README for examples
Written by John Leach <[email protected]>
Defined Under Namespace
Instance Attribute Summary collapse
-
#banner ⇒ Object
readonly
Returns the value of attribute banner.
-
#err ⇒ Object
readonly
Returns the value of attribute err.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#version_range ⇒ Object
readonly
Returns the value of attribute version_range.
Instance Method Summary collapse
- #answer(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Pipe
constructor
A new instance of Pipe.
- #run!(&query_processor) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Pipe
Returns a new instance of Pipe.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/powerdns_pipe.rb', line 45 def initialize( = {}) = { :input => STDIN, :output => STDOUT, :err => STDERR, :version_range => 1..2, :banner => "Ruby PowerDNS::Pipe" }.merge @input = [:input] @output = [:output] @err = [:err] @version_range = [:version_range] @banner = [:banner] end |
Instance Attribute Details
#banner ⇒ Object (readonly)
Returns the value of attribute banner.
11 12 13 |
# File 'lib/powerdns_pipe.rb', line 11 def @banner end |
#err ⇒ Object (readonly)
Returns the value of attribute err.
11 12 13 |
# File 'lib/powerdns_pipe.rb', line 11 def err @err end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
11 12 13 |
# File 'lib/powerdns_pipe.rb', line 11 def input @input end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
11 12 13 |
# File 'lib/powerdns_pipe.rb', line 11 def output @output end |
#version_range ⇒ Object (readonly)
Returns the value of attribute version_range.
11 12 13 |
# File 'lib/powerdns_pipe.rb', line 11 def version_range @version_range end |
Instance Method Details
#answer(options = {}) ⇒ Object
69 70 71 72 73 74 75 76 77 |
# File 'lib/powerdns_pipe.rb', line 69 def answer( = {}) = { :ttl => 3600, :id => -1, :class => 'IN' }.merge respond "DATA", [:name], [:class], [:type], [:ttl], [:id], [:content] end |
#run!(&query_processor) ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/powerdns_pipe.rb', line 61 def run!(&query_processor) while (line = input.readline) do process_line line, query_processor end rescue EOFError err.write "EOF, terminating loop\n" end |