class DockerBoss::Module::DNS::Server
Constants
- IN
Attributes
records[W]
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
# File lib/docker_boss/module/dns.rb, line 63 def initialize(options = {}) super(options) @manager = options[:manager] @ttl = options[:ttl].to_i @zones = options[:zones] servers = options[:upstream_dns].map { |ip| [:udp, ip, 53] } servers.concat(options[:upstream_dns].map { |ip| [:tcp, ip, 53] }) @resolver = RubyDNS::Resolver.new(servers) end
Public Instance Methods
process(name, resource_class, transaction)
click to toggle source
# File lib/docker_boss/module/dns.rb, line 74 def process(name, resource_class, transaction) zone = @zones.find { |z| name =~ /#{z}$/ } if records.has_key? name # XXX: revisit whenever docker supports IPv6, for AAAA records... if [IN::A].include? resource_class transaction.respond!(records[name], :ttl => @ttl) else transaction.fail!(:NXDomain) end elsif zone soa = Resolv::DNS::Resource::IN::SOA.new(Resolv::DNS::Name.create("#{zone}"), Resolv::DNS::Name.create("dockerboss."), 1, @ttl, @ttl, @ttl, @ttl) transaction.add([soa], :name => "#{zone}.", :ttl => @ttl, :section => :authority) transaction.fail!(:NXDomain) else transaction.passthrough!(@resolver) end end
records()
click to toggle source
# File lib/docker_boss/module/dns.rb, line 59 def records @manager.records end