RubyDNS否则不起作用
我用的是RubyDNS。 当我使用匹配块和其他块时,我想跳过匹配中的一些地址,这样它们就会被其他块捕获。 但它不会进入其他块RubyDNS否则不起作用,ruby,Ruby,我用的是RubyDNS。 当我使用匹配块和其他块时,我想跳过匹配中的一些地址,这样它们就会被其他块捕获。 但它不会进入其他块 RubyDNS.run_server(listen: INTERFACES, asynchronous: false) do upstream = RubyDNS::Resolver.new([[:udp, "8.8.8.8", 53], [:tcp, "8.8.8.8", 53]]) match(/^([\d\.]+)\.in-addr\.arpa$/, IN
RubyDNS.run_server(listen: INTERFACES, asynchronous: false) do
upstream = RubyDNS::Resolver.new([[:udp, "8.8.8.8", 53], [:tcp, "8.8.8.8", 53]])
match(/^([\d\.]+)\.in-addr\.arpa$/, IN::PTR) do |transaction, match_data|
domain = nil # just for test
if domain
transaction.respond!(Name.create(domain))
else
# Pass the request to the otherwise handler
# !!! this doesn't work
false
end
end
otherwise do |transaction|
transaction.passthrough!(upstream)
end
end
当我从匹配块返回false时,它不会转到其他块。
如何修复此问题?我找到了如何继续从匹配块中删除块:使用“下一步!”
match(/^([\d\.]+)\.in-addr\.arpa$/, IN::PTR) do |transaction, match_data|
domain = nil # just for test
if domain
transaction.respond!(Name.create(domain))
else
# Pass the request to the otherwise handler
next!
end
end
otherwise do |transaction|
transaction.passthrough!(upstream)
end
文件如下: