SRV protocols aren't just plain text anymore.
This commit is contained in:
parent
38da24fe66
commit
009928a8ee
@ -828,11 +828,17 @@ class DNSManager::Storage::Zone
|
|||||||
|
|
||||||
class SRV < ResourceRecord
|
class SRV < ResourceRecord
|
||||||
def_clone
|
def_clone
|
||||||
|
|
||||||
|
enum Protocol
|
||||||
|
TCP
|
||||||
|
UDP
|
||||||
|
end
|
||||||
|
|
||||||
property port : UInt16
|
property port : UInt16
|
||||||
property protocol : String = "tcp"
|
property protocol : Protocol
|
||||||
property priority : UInt32 = 10
|
property priority : UInt32 = 10
|
||||||
property weight : UInt32 = 10
|
property weight : UInt32 = 10
|
||||||
def initialize(@name, @ttl, @target, @port, @protocol = "tcp", @priority = 10, @weight = 10)
|
def initialize(@name, @ttl, @target, @port, @protocol = Protocol::TCP, @priority = 10, @weight = 10)
|
||||||
@rrtype = "SRV"
|
@rrtype = "SRV"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -855,7 +861,7 @@ class DNSManager::Storage::Zone
|
|||||||
|
|
||||||
def to_s(io : IO)
|
def to_s(io : IO)
|
||||||
io << "(#{ "%4d" % @rrid }) "
|
io << "(#{ "%4d" % @rrid }) "
|
||||||
io << "_#{@name.downcase}._#{@protocol.downcase} "
|
io << "_#{@name.downcase}._#{@protocol.to_s.downcase} "
|
||||||
io << "#{ "%6d" % @ttl} SRV "
|
io << "#{ "%6d" % @ttl} SRV "
|
||||||
io << "#{ "%3d" % @priority} "
|
io << "#{ "%3d" % @priority} "
|
||||||
io << "#{ "%3d" % @weight} "
|
io << "#{ "%3d" % @weight} "
|
||||||
@ -864,7 +870,7 @@ class DNSManager::Storage::Zone
|
|||||||
end
|
end
|
||||||
|
|
||||||
def to_bind9(io : IO)
|
def to_bind9(io : IO)
|
||||||
io << "_#{@name.downcase}._#{@protocol.downcase} "
|
io << "_#{@name.downcase}._#{@protocol.to_s.downcase} "
|
||||||
io << "#{@ttl} IN SRV #{@priority} #{@weight} #{@port} #{@target}\n"
|
io << "#{@ttl} IN SRV #{@priority} #{@weight} #{@port} #{@target}\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user