1
0
mirror of https://github.com/cmur2/dyndnsd.git synced 2025-07-02 08:30:18 +02:00

Add DynDNS.com compatible responder

This commit is contained in:
cn
2013-04-27 14:30:41 +02:00
parent 3a39f4fa0a
commit 315e460c28
2 changed files with 21 additions and 1 deletions

View File

@ -0,0 +1,19 @@
module Dyndnsd
module Responder
class DynDNSStyle
def response_for(state, ip = nil)
# general http errors
return [405, {"Content-Type" => "text/plain"}, ["Method Not Allowed"]] if state == :method_forbidden
return [404, {"Content-Type" => "text/plain"}, ["Not Found"]] if state == :not_found
# specific errors
return [200, {"Content-Type" => "text/plain"}, ["notfqdn"]] if state == :hostname_missing
return [200, {"Content-Type" => "text/plain"}, ["nohost"]] if state == :host_forbidden
return [200, {"Content-Type" => "text/plain"}, ["notfqdn"]] if state == :hostname_malformed
# OKs
return [200, {"Content-Type" => "text/plain"}, ["good #{ip}"]] if state == :good
return [200, {"Content-Type" => "text/plain"}, ["nochg #{ip}"]] if state == :nochg
end
end
end
end