Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/lib/net/dns/rr/cname.rb
Views: 11784
# -*- coding: binary -*-1##2#3# Net::DNS::RR::CNAME4#5# $Id: CNAME.rb,v 1.7 2006/07/28 07:33:36 bluemonk Exp $6#7##89module Net10module DNS1112class RR1314#------------------------------------------------------------15# RR type CNAME16#------------------------------------------------------------17class CNAME < RR18attr_reader :cname1920private2122def check_name(name)23unless name =~ /(\w\.?)+\s*$/ and name =~ /[a-zA-Z]/24raise RRArgumentError, "Canonical Name not valid: #{name}"25end26name27end2829def build_pack30@cname_pack = pack_name(@cname)31@rdlength = @cname_pack.size32end3334def set_type35@type = Net::DNS::RR::Types.new("CNAME")36end3738def get_data39@cname_pack40end4142def get_inspect43"#@cname"44end4546def subclass_new_from_hash(args)47if args.has_key? :cname48@cname = check_name args[:cname]49else50raise RRArgumentError, ":cname field is mandatory but missing"51end52end5354def subclass_new_from_string(str)55@cname = check_name(str)56end5758def subclass_new_from_binary(data,offset)59@cname,offset = dn_expand(data,offset)60return offset61end6263end # class CNAME6465end # class RR66end # module DNS67end # module Net686970