The dns.xfr.Inbound Class and make_query() function¶
The Inbound
class provides support for inbound DNS zone transfers,
both AXFR and IXFR. It is invoked by I/O code, i.e.
dns.query.inbound_xfr()
or
dns.asyncquery.inbound_xfr()
. When a message related to the
transfer arrives, the I/O code calls the process_message()
method
which adds the content to the pending transaction.
The make_query()
function is used to making the query message for
the query methods to use in more complex situations, e.g. with TSIG or
EDNS.
- class dns.xfr.Inbound(txn_manager: dns.transaction.TransactionManager, rdtype: dns.rdatatype.RdataType = RdataType.AXFR, serial: Optional[int] = None, is_udp: bool = False)[source]¶
State machine for zone transfers.
Initialize an inbound zone transfer.
txn_manager is a
dns.transaction.TransactionManager
.rdtype can be dns.rdatatype.AXFR or dns.rdatatype.IXFR
serial is the base serial number for IXFRs, and is required in that case.
is_udp, a
bool
indidicates if UDP is being used for this XFR.- process_message(message: dns.message.Message) bool [source]¶
Process one message in the transfer.
The message should have the same relativization as was specified when the dns.xfr.Inbound was created. The message should also have been created with one_rr_per_rrset=True because order matters.
Returns True if the transfer is complete, and False otherwise.
- dns.xfr.make_query(txn_manager: dns.transaction.TransactionManager, serial: Optional[int] = 0, use_edns: Optional[Union[int, bool]] = None, ednsflags: Optional[int] = None, payload: Optional[int] = None, request_payload: Optional[int] = None, options: Optional[List[dns.edns.Option]] = None, keyring: Any = None, keyname: Optional[dns.name.Name] = None, keyalgorithm: Union[dns.name.Name, str] = <DNS name hmac-sha256.>) Tuple[dns.message.QueryMessage, Optional[int]] [source]¶
Make an AXFR or IXFR query.
txn_manager is a
dns.transaction.TransactionManager
, typically adns.zone.Zone
.serial is an
int
orNone
. If 0, then IXFR will be attempted using the most recent serial number from the txn_manager; it is the caller’s responsibility to ensure there are no write transactions active that could invalidate the retrieved serial. If a serial cannot be determined, AXFR will be forced. Other integer values are the starting serial to use.None
forces an AXFR.Please see the documentation for
dns.message.make_query()
anddns.message.Message.use_tsig()
for details on the other parameters to this function.Returns a (query, serial) tuple.