CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-dnspython

DNS toolkit for Python supporting almost all record types with high-level and low-level DNS operations

85

1.37x
Overview
Eval results
Files

task.mdevals/scenario-8/

RRset Text/Wire Serializer

Implement helpers that convert DNS record text into RRsets, produce wire-format bytes, and read them back while keeping canonical record ordering. Use the DNS dependency's built-in parsing and serialization helpers rather than manual string handling.

Capabilities

Build RRset from text

  • Given a domain name, TTL, class, type, and multiple RDATA strings for the same record set, the helper builds a single RRset and returns normalized record lines that include the name, TTL, class, type, and each RDATA value. @test
  • Duplicate RDATA values are not emitted more than once in the normalized output. @test

Serialize to wire bytes

  • Converting the built RRset to wire format returns a non-empty bytes object that encodes all records for that name/type. @test

Parse wire back to text

  • Parsing the wire-format bytes for an RRset yields the same set of RDATA strings in canonical order, suitable for direct comparison with the normalized text output. @test

Implementation

@generates

API

from typing import List, Tuple

def build_rrset(name: str, ttl: int, rdclass: str, rdtype: str, records: List[str]) -> Tuple[List[str], bytes]:
    """
    Build an RRset from textual RDATA strings for a single name/class/type.
    Returns (normalized_records, wire_bytes) where normalized_records contains full record lines
    with name, TTL, class, type, and RDATA values sorted in canonical order.
    Uses the dependency's parsing and RRset helpers for construction and serialization.
    """

def parse_wire(name: str, rdclass: str, rdtype: str, wire: bytes) -> List[str]:
    """
    Parse wire-format data for a single RRset into canonical textual RDATA strings.
    Uses the dependency's wire-parsing helpers rather than manual decoding.
    """

Dependencies { .dependencies }

dnspython { .dependency }

Provides DNS record parsing, RRset construction, and wire-format serialization utilities.

Install with Tessl CLI

npx tessl i tessl/pypi-dnspython

tile.json