This does two things.
1) Makes the file parameter optional, removing the requirement that
callers create an io.BytesIO object if all they want is the bytes. This
is done by renaming all of the rdata subclass to_wire() methods to
_to_wire(), and making dns.rdata.to_wire() create the io.BytesIO
internally if needed, and then delegate to the subclass.
2) Add canonicalize=False parameter, allowing code reuse for conversion
to wire format and conversion to hashable format. This also removes all
of the rdata subclass to_digestable routines that are no longer needed,
as dns.rdata.to_digestable will work for all rdata types.
"""Common DNSSEC-related functions and constants."""
import hashlib
-import io
import struct
import time
import base64
return Algorithm.to_text(value)
-def _to_rdata(record, origin):
- s = io.BytesIO()
- record.to_wire(s, origin=origin)
- return s.getvalue()
-
-
def key_id(key):
"""Return the key id (a 16-bit number) for the specified key.
Returns an ``int`` between 0 and 65535
"""
- rdata = _to_rdata(key, None)
+ rdata = key.to_wire()
if key.algorithm == Algorithm.RSAMD5:
return (rdata[-3] << 8) + rdata[-2]
else:
if isinstance(name, str):
name = dns.name.from_text(name, origin)
dshash.update(name.canonicalize().to_wire())
- dshash.update(_to_rdata(key, origin))
+ dshash.update(key.to_wire(origin=origin))
digest = dshash.digest()
dsrdata = struct.pack("!HBB", key_id(key), key.algorithm, algorithm) + \
raise ValidationFailure('unknown algorithm %u' % rrsig.algorithm)
data = b''
- data += _to_rdata(rrsig, origin)[:18]
+ data += rrsig.to_wire(origin=origin)[:18]
data += rrsig.signer.to_digestable(origin)
if rrsig.labels < len(rrname) - 1:
Returns a ``bytes``.
"""
- out = bytearray()
- for label in self.labels:
- out.append(len(label))
- out += label.lower()
- if not self.is_absolute():
- if origin is None or not origin.is_absolute():
- raise NeedAbsoluteNameOrOrigin
- for label in origin.labels:
- out.append(len(label))
- out += label.lower()
- return bytes(out)
+ return self.to_wire(origin=origin, canonicalize=True)
- def to_wire(self, file=None, compress=None, origin=None):
+ def to_wire(self, file=None, compress=None, origin=None,
+ canonicalize=False):
"""Convert name to wire format, possibly compressing it.
*file* is the file where the name is emitted (typically an
relative and origin is not ``None``, then *origin* will be appended
to it.
+ *canonicalize*, a ``bool``, indicates whether the name should
+ be canonicalized; that is, converted to a format suitable for
+ digesting in hashes.
+
Raises ``dns.name.NeedAbsoluteNameOrOrigin`` if the name is
relative and no origin was provided.
out = bytearray()
for label in self.labels:
out.append(len(label))
- out += label
+ if canonicalize:
+ out += label.lower()
+ else:
+ out += label
if not self.is_absolute():
if origin is None or not origin.is_absolute():
raise NeedAbsoluteNameOrOrigin
for label in origin.labels:
out.append(len(label))
- out += label
+ if canonicalize:
+ out += label.lower()
+ else:
+ out += label
return bytes(out)
if not self.is_absolute():
l = len(label)
file.write(struct.pack('!B', l))
if l > 0:
- file.write(label)
+ if canonicalize:
+ file.write(label.lower())
+ else:
+ file.write(label)
def __len__(self):
"""The length of the name (in labels).
def to_text(self, omit_final_dot=False) -> str: ...
def to_unicode(self, omit_final_dot=False, idna_codec=None) -> str: ...
def to_digestable(self, origin=None) -> bytes: ...
- def to_wire(self, file=None, compress=None, origin=None) -> Optional[bytes]: ...
+ def to_wire(self, file=None, compress=None, origin=None,
+ canonicalize=False) -> Optional[bytes]: ...
def __add__(self, other : Name): ...
def __sub__(self, other : Name): ...
def split(self, depth) -> List[Tuple[str,str]]: ...
raise NotImplementedError
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
+ raise NotImplementedError
+
+ def to_wire(self, file=None, compress=None, origin=None,
+ canonicalize=False):
"""Convert an rdata to wire format.
- Returns ``None``.
+ Returns a ``bytes`` or ``None``.
"""
- raise NotImplementedError
+ if file:
+ return self._to_wire(file, compress, origin, canonicalize)
+ else:
+ f = io.BytesIO()
+ self._to_wire(f, compress, origin, canonicalize)
+ return f.getvalue()
def to_generic(self, origin=None):
"""Creates a dns.rdata.GenericRdata equivalent of this rdata.
Returns a ``dns.rdata.GenericRdata``.
"""
- f = io.BytesIO()
- self.to_wire(f, origin=origin)
- return dns.rdata.GenericRdata(self.rdclass, self.rdtype, f.getvalue())
+ return dns.rdata.GenericRdata(self.rdclass, self.rdtype,
+ self.to_wire(origin=origin))
def to_digestable(self, origin=None):
"""Convert rdata to a format suitable for digesting in hashes. This
Returns a ``bytes``.
"""
- f = io.BytesIO()
- self.to_wire(f, None, origin)
- return f.getvalue()
+ return self.to_wire(origin=origin, canonicalize=True)
def validate(self):
"""Check that the current contents of the rdata's fields are
'generic rdata hex data has wrong length')
return cls(rdclass, rdtype, data)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
file.write(self.data)
@classmethod
-from typing import Dict, Tuple, Any, Optional
+from typing import Dict, Tuple, Any, Optional, BinaryIO
from .name import Name, IDNACodec
class Rdata:
def __init__(self):
self.address : str
- def to_wire(self, file, compress : Optional[Dict[Name,int]], origin : Optional[Name]) -> bytes:
+ def to_wire(self, file : Optional[BinaryIO], compress : Optional[Dict[Name,int]], origin : Optional[Name], canonicalize : Optional[bool]) -> Optional[bytes]:
...
@classmethod
def from_text(cls, rdclass : int, rdtype : int, tok, origin=None, relativize=True):
value = tok.get_string().encode()
return cls(rdclass, rdtype, flags, tag, value)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
file.write(struct.pack('!B', self.flags))
l = len(self.tag)
assert l < 256
return cls(rdclass, rdtype, certificate_type, key_tag,
algorithm, certificate)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
prefix = struct.pack("!HHB", self.certificate_type, self.key_tag,
self.algorithm)
file.write(prefix)
windows.append((window, bitmap[0:octets]))
return cls(rdclass, rdtype, serial, flags, windows)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
file.write(struct.pack('!IH', self.serial, self.flags))
for (window, bitmap) in self.windows:
file.write(struct.pack('!BB', window, len(bitmap)))
"""DNAME record"""
- def to_digestable(self, origin=None):
- return self.target.to_digestable(origin)
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
+ self.target.to_wire(file, None, origin, canonicalize)
tok.get_eol()
return cls(rdclass, rdtype, latitude, longitude, altitude)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
l = len(self.latitude)
assert l < 256
file.write(struct.pack('!B', l))
tok.get_eol()
return cls(rdclass, rdtype, cpu, os)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
l = len(self.cpu)
assert l < 256
file.write(struct.pack('!B', l))
servers.append(server)
return cls(rdclass, rdtype, hit, algorithm, key, servers)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
lh = len(self.hit)
lk = len(self.key)
file.write(struct.pack("!BBH", lh, self.algorithm, lk))
file.write(self.hit)
file.write(self.key)
for server in self.servers:
- server.to_wire(file, None, origin)
+ server.to_wire(file, None, origin, False)
@classmethod
def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
tok.get_eol()
return cls(rdclass, rdtype, address, subaddress)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
l = len(self.address)
assert l < 256
file.write(struct.pack('!B', l))
return cls(rdclass, rdtype, latitude, longitude, altitude,
size, hprec, vprec)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
milliseconds = (self.latitude[0] * 3600000 +
self.latitude[1] * 60000 +
self.latitude[2] * 1000 +
windows.append((window, bitmap[0:octets]))
return cls(rdclass, rdtype, next, windows)
- def to_wire(self, file, compress=None, origin=None):
- self.next.to_wire(file, None, origin)
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
+ self.next.to_wire(file, None, origin, canonicalize)
for (window, bitmap) in self.windows:
file.write(struct.pack('!BB', window, len(bitmap)))
file.write(bitmap)
- def to_digestable(self, origin=None):
- file = io.BytesIO()
- file.write(self.next.to_digestable(origin))
- for (window, bitmap) in self.windows:
- file.write(struct.pack('!BB', window, len(bitmap)))
- file.write(bitmap)
- return file.getvalue()
-
@classmethod
def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
(next, cused) = dns.name.from_wire(wire[: current + rdlen], current)
return cls(rdclass, rdtype, algorithm, flags, iterations, salt, next,
windows)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
l = len(self.salt)
file.write(struct.pack("!BBHB", self.algorithm, self.flags,
self.iterations, l))
tok.get_eol()
return cls(rdclass, rdtype, algorithm, flags, iterations, salt)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
l = len(self.salt)
file.write(struct.pack("!BBHB", self.algorithm, self.flags,
self.iterations, l))
key = base64.b64decode(b64)
return cls(rdclass, rdtype, key)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
file.write(self.key)
@classmethod
tok.get_eol()
return cls(rdclass, rdtype, mbox, txt)
- def to_wire(self, file, compress=None, origin=None):
- self.mbox.to_wire(file, None, origin)
- self.txt.to_wire(file, None, origin)
-
- def to_digestable(self, origin=None):
- return self.mbox.to_digestable(origin) + \
- self.txt.to_digestable(origin)
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
+ self.mbox.to_wire(file, None, origin, canonicalize)
+ self.txt.to_wire(file, None, origin, canonicalize)
@classmethod
def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
original_ttl, expiration, inception, key_tag, signer,
signature)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
header = struct.pack('!HBBIIIH', self.type_covered,
self.algorithm, self.labels,
self.original_ttl, self.expiration,
self.inception, self.key_tag)
file.write(header)
- self.signer.to_wire(file, None, origin)
+ self.signer.to_wire(file, None, origin, canonicalize)
file.write(self.signature)
- def to_digestable(self, origin=None):
- return struct.pack('!HBBIIIH', self.type_covered,
- self.algorithm, self.labels,
- self.original_ttl, self.expiration,
- self.inception, self.key_tag) + \
- self.signer.to_digestable(origin) + \
- self.signature
-
@classmethod
def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
header = struct.unpack('!HBBIIIH', wire[current: current + 18])
return cls(rdclass, rdtype, mname, rname, serial, refresh, retry,
expire, minimum)
- def to_wire(self, file, compress=None, origin=None):
- self.mname.to_wire(file, compress, origin)
- self.rname.to_wire(file, compress, origin)
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
+ self.mname.to_wire(file, compress, origin, canonicalize)
+ self.rname.to_wire(file, compress, origin, canonicalize)
five_ints = struct.pack('!IIIII', self.serial, self.refresh,
self.retry, self.expire, self.minimum)
file.write(five_ints)
- def to_digestable(self, origin=None):
- return self.mname.to_digestable(origin) + \
- self.rname.to_digestable(origin) + \
- struct.pack('!IIIII', self.serial, self.refresh,
- self.retry, self.expire, self.minimum)
-
@classmethod
def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
(mname, cused) = dns.name.from_wire(wire[: current + rdlen], current)
fingerprint = binascii.unhexlify(fingerprint)
return cls(rdclass, rdtype, algorithm, fp_type, fingerprint)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
header = struct.pack("!BB", self.algorithm, self.fp_type)
file.write(header)
file.write(self.fingerprint)
cert = binascii.unhexlify(cert)
return cls(rdclass, rdtype, usage, selector, mtype, cert)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
header = struct.pack("!BBB", self.usage, self.selector, self.mtype)
file.write(header)
file.write(self.cert)
tok.get_eol()
return cls(rdclass, rdtype, priority, weight, target.value)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
two_ints = struct.pack("!HH", self.priority, self.weight)
file.write(two_ints)
file.write(self.target)
tok.get_eol()
return cls(rdclass, rdtype, address)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
l = len(self.address)
assert l < 256
file.write(struct.pack('!B', l))
tok.get_eol()
return cls(rdclass, rdtype, address, domain)
- def to_wire(self, file, compress=None, origin=None):
- self.domain.to_wire(file, compress, origin)
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
+ self.domain.to_wire(file, compress, origin, canonicalize)
pref = struct.pack("!H", self.address)
file.write(pref)
- def to_digestable(self, origin=None):
- return self.domain.to_digestable(origin) + \
- struct.pack("!H", self.address)
-
@classmethod
def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
(domain, cused) = dns.name.from_wire(wire[:current + rdlen - 2],
tok.get_eol()
return cls(rdclass, rdtype, address)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
file.write(dns.ipv4.inet_aton(self.address))
@classmethod
tok.get_eol()
return cls(rdclass, rdtype, address)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
file.write(dns.ipv6.inet_aton(self.address))
@classmethod
return cls(rdclass, rdtype, items)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
for item in self.items:
item.to_wire(file)
data = base64.b64decode(b64)
return cls(rdclass, rdtype, data)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
file.write(self.data)
@classmethod
return cls(rdclass, rdtype, precedence, gateway_type, algorithm,
gateway, key)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
header = struct.pack("!BBB", self.precedence, self.gateway_type,
self.algorithm)
file.write(header)
elif self.gateway_type == 2:
file.write(dns.ipv6.inet_aton(self.gateway))
elif self.gateway_type == 3:
- self.gateway.to_wire(file, None, origin)
+ self.gateway.to_wire(file, None, origin, False)
else:
raise ValueError('invalid gateway type')
file.write(self.key)
return cls(rdclass, rdtype, order, preference, flags, service,
regexp, replacement)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
two_ints = struct.pack("!HH", self.order, self.preference)
file.write(two_ints)
_write_string(file, self.flags)
_write_string(file, self.service)
_write_string(file, self.regexp)
- self.replacement.to_wire(file, compress, origin)
-
- def to_digestable(self, origin=None):
- file = io.BytesIO()
- two_ints = struct.pack("!HH", self.order, self.preference)
- file.write(two_ints)
- _write_string(file, self.flags)
- _write_string(file, self.service)
- _write_string(file, self.regexp)
- return file.getvalue() + self.replacement.to_digestable(origin)
+ self.replacement.to_wire(file, compress, origin, canonicalize)
@classmethod
def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
address = binascii.unhexlify(address.encode())
return cls(rdclass, rdtype, address)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
file.write(self.address)
@classmethod
tok.get_eol()
return cls(rdclass, rdtype, preference, map822, mapx400)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
pref = struct.pack("!H", self.preference)
file.write(pref)
- self.map822.to_wire(file, None, origin)
- self.mapx400.to_wire(file, None, origin)
-
- def to_digestable(self, origin=None):
- return struct.pack("!H", self.preference) + \
- self.map822.to_digestable(origin) + \
- self.mapx400.to_digestable(origin)
+ self.map822.to_wire(file, None, origin, canonicalize)
+ self.mapx400.to_wire(file, None, origin, canonicalize)
@classmethod
def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
tok.get_eol()
return cls(rdclass, rdtype, priority, weight, port, target)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
three_ints = struct.pack("!HHH", self.priority, self.weight, self.port)
file.write(three_ints)
- self.target.to_wire(file, compress, origin)
-
- def to_digestable(self, origin=None):
- f = io.BytesIO()
- f.write(struct.pack("!HHH", self.priority, self.weight, self.port))
- f.write(self.target.to_digestable(origin))
- return f.getvalue()
+ self.target.to_wire(file, compress, origin, canonicalize)
@classmethod
def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
bitmap = dns.rdata._truncate_bitmap(bitmap)
return cls(rdclass, rdtype, address, protocol, bitmap)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
file.write(dns.ipv4.inet_aton(self.address))
protocol = struct.pack('!B', self.protocol)
file.write(protocol)
key = base64.b64decode(b64)
return cls(rdclass, rdtype, flags, protocol, algorithm, key)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
header = struct.pack("!HBB", self.flags, self.protocol, self.algorithm)
file.write(header)
file.write(self.key)
relativize_to=None):
...
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
...
@classmethod
return cls(rdclass, rdtype, key_tag, algorithm, digest_type,
digest)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
header = struct.pack("!HBB", self.key_tag, self.algorithm,
self.digest_type)
file.write(header)
raise dns.exception.SyntaxError('Hex decoding error: %s' % str(ex))
return cls(rdclass, rdtype, data)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
file.write(self.eui)
@classmethod
tok.get_eol()
return cls(rdclass, rdtype, preference, exchange)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
pref = struct.pack("!H", self.preference)
file.write(pref)
- self.exchange.to_wire(file, compress, origin)
-
- def to_digestable(self, origin=None):
- return struct.pack("!H", self.preference) + \
- self.exchange.to_digestable(origin)
+ self.exchange.to_wire(file, compress, origin, canonicalize)
@classmethod
def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
is not compressed when converted to DNS wire format, and whose
digestable form is not downcased."""
- def to_wire(self, file, compress=None, origin=None):
- super(UncompressedMX, self).to_wire(file, None, origin)
-
- def to_digestable(self, origin=None):
- f = io.BytesIO()
- self.to_wire(f, None, origin)
- return f.getvalue()
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
+ super()._to_wire(file, None, origin, False)
class UncompressedDowncasingMX(MXBase):
"""Base class for rdata that is like an MX record, but whose name
is not compressed when convert to DNS wire format."""
- def to_wire(self, file, compress=None, origin=None):
- super(UncompressedDowncasingMX, self).to_wire(file, None, origin)
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
+ super()._to_wire(file, None, origin, canonicalize)
tok.get_eol()
return cls(rdclass, rdtype, target)
- def to_wire(self, file, compress=None, origin=None):
- self.target.to_wire(file, compress, origin)
-
- def to_digestable(self, origin=None):
- return self.target.to_digestable(origin)
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
+ self.target.to_wire(file, compress, origin, canonicalize)
@classmethod
def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
is not compressed when convert to DNS wire format, and whose
digestable form is not downcased."""
- def to_wire(self, file, compress=None, origin=None):
- super(UncompressedNS, self).to_wire(file, None, origin)
-
- def to_digestable(self, origin=None):
- f = io.BytesIO()
- self.to_wire(f, None, origin)
- return f.getvalue()
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
+ self.target.to_wire(file, None, origin, False)
raise dns.exception.UnexpectedEnd
return cls(rdclass, rdtype, strings)
- def to_wire(self, file, compress=None, origin=None):
+ def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
for s in self.strings:
l = len(s)
assert l < 256
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import unittest
-from io import BytesIO
import dns.rrset
import dns.rdtypes.ANY.EUI48
inst = dns.rdtypes.ANY.EUI48.EUI48(dns.rdataclass.IN,
dns.rdatatype.EUI48,
eui)
- buff = BytesIO()
- inst.to_wire(buff)
- self.assertEqual(buff.getvalue(), eui)
+ self.assertEqual(inst.to_wire(), eui)
def testFromWireOk(self):
'''Valid wire format.'''
inst = dns.rdtypes.ANY.EUI64.EUI64(dns.rdataclass.IN,
dns.rdatatype.EUI64,
eui)
- buff = BytesIO()
- inst.to_wire(buff)
- self.assertEqual(buff.getvalue(), eui)
+ self.assertEqual(inst.to_wire(), eui)
def testFromWireOk(self):
'''Valid wire format.'''