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: TransactionManager, rdtype: RdataType = RdataType.AXFR, serial: int | None = 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.
- Parameters:
is_udp (bool) – Whether UDP is being used for this XFR.
- process_message(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: TransactionManager, serial: int | None = 0, use_edns: int | bool | None = None, ednsflags: int | None = None, payload: int | None = None, request_payload: int | None = None, options: list[Option] | None = None, keyring: Any = None, keyname: Name | None = None, keyalgorithm: Name | str = <DNS name hmac-sha256.>) tuple[QueryMessage, int | None][source]
Make an AXFR or IXFR query.
- Parameters:
txn_manager (
dns.transaction.TransactionManager) – The transaction manager for this transfer, typically adns.zone.Zone.serial (int or
None) – If0, IXFR is attempted using the most recent serial from txn_manager (caller must ensure no write transactions are active that could invalidate the retrieved serial). If a serial cannot be determined, AXFR is forced. Other integer values are the starting serial to use.Noneforces 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.- Return type: