Загрузить файлы в «venv/Lib/site-packages/dns/rdtypes/ANY»
This commit is contained in:
45
venv/Lib/site-packages/dns/rdtypes/ANY/AFSDB.py
Normal file
45
venv/Lib/site-packages/dns/rdtypes/ANY/AFSDB.py
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
|
||||||
|
|
||||||
|
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, and distribute this software and its
|
||||||
|
# documentation for any purpose with or without fee is hereby granted,
|
||||||
|
# provided that the above copyright notice and this permission notice
|
||||||
|
# appear in all copies.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
|
||||||
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
|
||||||
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||||
|
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
import dns.immutable
|
||||||
|
import dns.rdtypes.mxbase
|
||||||
|
|
||||||
|
|
||||||
|
@dns.immutable.immutable
|
||||||
|
class AFSDB(dns.rdtypes.mxbase.UncompressedDowncasingMX):
|
||||||
|
"""AFSDB record"""
|
||||||
|
|
||||||
|
# Use the property mechanism to make "subtype" an alias for the
|
||||||
|
# "preference" attribute, and "hostname" an alias for the "exchange"
|
||||||
|
# attribute.
|
||||||
|
#
|
||||||
|
# This lets us inherit the UncompressedMX implementation but lets
|
||||||
|
# the caller use appropriate attribute names for the rdata type.
|
||||||
|
#
|
||||||
|
# We probably lose some performance vs. a cut-and-paste
|
||||||
|
# implementation, but this way we don't copy code, and that's
|
||||||
|
# good.
|
||||||
|
|
||||||
|
@property
|
||||||
|
def subtype(self):
|
||||||
|
"the AFSDB subtype"
|
||||||
|
return self.preference
|
||||||
|
|
||||||
|
@property
|
||||||
|
def hostname(self):
|
||||||
|
"the AFSDB hostname"
|
||||||
|
return self.exchange
|
||||||
89
venv/Lib/site-packages/dns/rdtypes/ANY/AMTRELAY.py
Normal file
89
venv/Lib/site-packages/dns/rdtypes/ANY/AMTRELAY.py
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
|
||||||
|
|
||||||
|
# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, and distribute this software and its
|
||||||
|
# documentation for any purpose with or without fee is hereby granted,
|
||||||
|
# provided that the above copyright notice and this permission notice
|
||||||
|
# appear in all copies.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
|
||||||
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
|
||||||
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||||
|
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
import struct
|
||||||
|
|
||||||
|
import dns.exception
|
||||||
|
import dns.immutable
|
||||||
|
import dns.rdata
|
||||||
|
import dns.rdtypes.util
|
||||||
|
|
||||||
|
|
||||||
|
class Relay(dns.rdtypes.util.Gateway):
|
||||||
|
name = "AMTRELAY relay"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def relay(self):
|
||||||
|
return self.gateway
|
||||||
|
|
||||||
|
|
||||||
|
@dns.immutable.immutable
|
||||||
|
class AMTRELAY(dns.rdata.Rdata):
|
||||||
|
"""AMTRELAY record"""
|
||||||
|
|
||||||
|
# see: RFC 8777
|
||||||
|
|
||||||
|
__slots__ = ["precedence", "discovery_optional", "relay_type", "relay"]
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self, rdclass, rdtype, precedence, discovery_optional, relay_type, relay
|
||||||
|
):
|
||||||
|
super().__init__(rdclass, rdtype)
|
||||||
|
relay = Relay(relay_type, relay)
|
||||||
|
self.precedence = self._as_uint8(precedence)
|
||||||
|
self.discovery_optional = self._as_bool(discovery_optional)
|
||||||
|
self.relay_type = relay.type
|
||||||
|
self.relay = relay.relay
|
||||||
|
|
||||||
|
def to_text(self, origin=None, relativize=True, **kw):
|
||||||
|
relay = Relay(self.relay_type, self.relay).to_text(origin, relativize)
|
||||||
|
return (
|
||||||
|
f"{self.precedence} {self.discovery_optional:d} {self.relay_type} {relay}"
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_text(
|
||||||
|
cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None
|
||||||
|
):
|
||||||
|
precedence = tok.get_uint8()
|
||||||
|
discovery_optional = tok.get_uint8()
|
||||||
|
if discovery_optional > 1:
|
||||||
|
raise dns.exception.SyntaxError("expecting 0 or 1")
|
||||||
|
discovery_optional = bool(discovery_optional)
|
||||||
|
relay_type = tok.get_uint8()
|
||||||
|
if relay_type > 0x7F:
|
||||||
|
raise dns.exception.SyntaxError("expecting an integer <= 127")
|
||||||
|
relay = Relay.from_text(relay_type, tok, origin, relativize, relativize_to)
|
||||||
|
return cls(
|
||||||
|
rdclass, rdtype, precedence, discovery_optional, relay_type, relay.relay
|
||||||
|
)
|
||||||
|
|
||||||
|
def _to_wire(self, file, compress=None, origin=None, canonicalize=False):
|
||||||
|
relay_type = self.relay_type | (self.discovery_optional << 7)
|
||||||
|
header = struct.pack("!BB", self.precedence, relay_type)
|
||||||
|
file.write(header)
|
||||||
|
Relay(self.relay_type, self.relay).to_wire(file, compress, origin, canonicalize)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_wire_parser(cls, rdclass, rdtype, parser, origin=None):
|
||||||
|
(precedence, relay_type) = parser.get_struct("!BB")
|
||||||
|
discovery_optional = bool(relay_type >> 7)
|
||||||
|
relay_type &= 0x7F
|
||||||
|
relay = Relay.from_wire_parser(relay_type, parser, origin)
|
||||||
|
return cls(
|
||||||
|
rdclass, rdtype, precedence, discovery_optional, relay_type, relay.relay
|
||||||
|
)
|
||||||
26
venv/Lib/site-packages/dns/rdtypes/ANY/AVC.py
Normal file
26
venv/Lib/site-packages/dns/rdtypes/ANY/AVC.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
|
||||||
|
|
||||||
|
# Copyright (C) 2016 Nominum, Inc.
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, and distribute this software and its
|
||||||
|
# documentation for any purpose with or without fee is hereby granted,
|
||||||
|
# provided that the above copyright notice and this permission notice
|
||||||
|
# appear in all copies.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
|
||||||
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
|
||||||
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||||
|
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
import dns.immutable
|
||||||
|
import dns.rdtypes.txtbase
|
||||||
|
|
||||||
|
|
||||||
|
@dns.immutable.immutable
|
||||||
|
class AVC(dns.rdtypes.txtbase.TXTBase):
|
||||||
|
"""AVC record"""
|
||||||
|
|
||||||
|
# See: IANA dns parameters for AVC
|
||||||
67
venv/Lib/site-packages/dns/rdtypes/ANY/CAA.py
Normal file
67
venv/Lib/site-packages/dns/rdtypes/ANY/CAA.py
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
|
||||||
|
|
||||||
|
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, and distribute this software and its
|
||||||
|
# documentation for any purpose with or without fee is hereby granted,
|
||||||
|
# provided that the above copyright notice and this permission notice
|
||||||
|
# appear in all copies.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
|
||||||
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
|
||||||
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||||
|
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
import struct
|
||||||
|
|
||||||
|
import dns.exception
|
||||||
|
import dns.immutable
|
||||||
|
import dns.rdata
|
||||||
|
import dns.tokenizer
|
||||||
|
|
||||||
|
|
||||||
|
@dns.immutable.immutable
|
||||||
|
class CAA(dns.rdata.Rdata):
|
||||||
|
"""CAA (Certification Authority Authorization) record"""
|
||||||
|
|
||||||
|
# see: RFC 6844
|
||||||
|
|
||||||
|
__slots__ = ["flags", "tag", "value"]
|
||||||
|
|
||||||
|
def __init__(self, rdclass, rdtype, flags, tag, value):
|
||||||
|
super().__init__(rdclass, rdtype)
|
||||||
|
self.flags = self._as_uint8(flags)
|
||||||
|
self.tag = self._as_bytes(tag, True, 255)
|
||||||
|
if not tag.isalnum():
|
||||||
|
raise ValueError("tag is not alphanumeric")
|
||||||
|
self.value = self._as_bytes(value)
|
||||||
|
|
||||||
|
def to_text(self, origin=None, relativize=True, **kw):
|
||||||
|
return f'{self.flags} {dns.rdata._escapify(self.tag)} "{dns.rdata._escapify(self.value)}"'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_text(
|
||||||
|
cls, rdclass, rdtype, tok, origin=None, relativize=True, relativize_to=None
|
||||||
|
):
|
||||||
|
flags = tok.get_uint8()
|
||||||
|
tag = tok.get_string().encode()
|
||||||
|
value = tok.get_string().encode()
|
||||||
|
return cls(rdclass, rdtype, flags, tag, value)
|
||||||
|
|
||||||
|
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
|
||||||
|
file.write(struct.pack("!B", l))
|
||||||
|
file.write(self.tag)
|
||||||
|
file.write(self.value)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_wire_parser(cls, rdclass, rdtype, parser, origin=None):
|
||||||
|
flags = parser.get_uint8()
|
||||||
|
tag = parser.get_counted_bytes()
|
||||||
|
value = parser.get_remaining()
|
||||||
|
return cls(rdclass, rdtype, flags, tag, value)
|
||||||
71
venv/Lib/site-packages/dns/rdtypes/ANY/__init__.py
Normal file
71
venv/Lib/site-packages/dns/rdtypes/ANY/__init__.py
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
|
||||||
|
|
||||||
|
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, and distribute this software and its
|
||||||
|
# documentation for any purpose with or without fee is hereby granted,
|
||||||
|
# provided that the above copyright notice and this permission notice
|
||||||
|
# appear in all copies.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES
|
||||||
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR
|
||||||
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||||
|
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
"""Class ANY (generic) rdata type classes."""
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"AFSDB",
|
||||||
|
"AMTRELAY",
|
||||||
|
"AVC",
|
||||||
|
"CAA",
|
||||||
|
"CDNSKEY",
|
||||||
|
"CDS",
|
||||||
|
"CERT",
|
||||||
|
"CNAME",
|
||||||
|
"CSYNC",
|
||||||
|
"DLV",
|
||||||
|
"DNAME",
|
||||||
|
"DNSKEY",
|
||||||
|
"DS",
|
||||||
|
"DSYNC",
|
||||||
|
"EUI48",
|
||||||
|
"EUI64",
|
||||||
|
"GPOS",
|
||||||
|
"HINFO",
|
||||||
|
"HIP",
|
||||||
|
"ISDN",
|
||||||
|
"L32",
|
||||||
|
"L64",
|
||||||
|
"LOC",
|
||||||
|
"LP",
|
||||||
|
"MX",
|
||||||
|
"NID",
|
||||||
|
"NINFO",
|
||||||
|
"NS",
|
||||||
|
"NSEC",
|
||||||
|
"NSEC3",
|
||||||
|
"NSEC3PARAM",
|
||||||
|
"OPENPGPKEY",
|
||||||
|
"OPT",
|
||||||
|
"PTR",
|
||||||
|
"RESINFO",
|
||||||
|
"RP",
|
||||||
|
"RRSIG",
|
||||||
|
"RT",
|
||||||
|
"SMIMEA",
|
||||||
|
"SOA",
|
||||||
|
"SPF",
|
||||||
|
"SSHFP",
|
||||||
|
"TKEY",
|
||||||
|
"TLSA",
|
||||||
|
"TSIG",
|
||||||
|
"TXT",
|
||||||
|
"URI",
|
||||||
|
"WALLET",
|
||||||
|
"X25",
|
||||||
|
"ZONEMD",
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user