Sha256: 87a0899b8045072379c64b3232f04fb62bf7d3fcdfe36dfa4c47c8b523884586

Contents?: true

Size: 948 Bytes

Versions: 1

Compression:

Stored size: 948 Bytes

Contents

= em-powerdns

You can use this plus the unix program PowerDNS to make a custom DNS server
with the lookup done by a ruby script you write.

Even though the actual PowerDNS pipe backend is synchronous, using this will
allow a script to start up other side tasks, logging or stats for example,
without interrupting the scripts ability to serve more requests.

Include EM::P::PowerDNS in a module or class to use it as a PowerDNS backend.

== Example

  module RedisBackend
    include EM::P::PowerDNS

    def receive_query(query)
      # make some logic here to resolve the DNS
      ip = redis[query.qname]
      data query.qname, query.qclass, :A, 3600, 1, ip
      super
    end

    def redis
      @redis ||= Redis.new
    end
  end

  EM.run { EM.open_keyboard(RedisBackend) }

PowerDNS uses stdin to send all it's queries so EM.open_keyboard does exactly
what we need.

== Copyright

Copyright (c) 2010 Martin Emde. See LICENSE for details.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
em-powerdns-0.0.1 README.rdoc