moonzoneguard

    Bounded DNS delegation and DS/DNSKEY digest rollout analysis

    dns
    zone
    delegation
    rollout
    Download zip
    Author
    Version
    0.3.0
    License
    Apache-2.0
    Last updated
    5 hours ago
    Downloads
    7

    Dependencies

    #geniuszby/moonzoneguard

    AliasTrace

    pub(all) struct AliasTrace {
    path : Array[String]
    terminal : String
    cycle : Bool
    } derive(
    Debug
    )

    AuditPolicy

    pub(all) struct AuditPolicy {
    min_ttl : Int?
    max_ttl : Int?
    min_apex_ns : Int
    require_ipv6_for_mail : Bool
    forbid_types : Array[String]
    } derive(
    Debug
    )

    Optional local review policy. Defaults are deliberately permissive.

    ChangeImpact

    pub(all) struct ChangeImpact {
    score : Int
    level : String
    changed_owners : Int
    added : Int
    removed : Int
    ttl_changed : Int
    notes : Array[ImpactNote]
    } derive(
    Debug
    )

    DelegationFinding

    pub(all) struct DelegationFinding {
    code : String
    severity : String
    source : String
    owner : String
    line : Int
    message : String
    } derive(
    Debug
    )

    A finding in one parent/child deployment snapshot. source identifies the input file, and line is the original zone-file line.

    DelegationRollout

    pub(all) struct DelegationRollout {
    states : Array[DelegationState]
    preflight : Array[DelegationFinding]
    parent_first : Bool
    child_first : Bool
    recommendation : String
    } derive(
    Debug
    )

    The four snapshots assume that each zone file is published atomically. A safe order means no local error was found in its three snapshots.

    DelegationState

    pub(all) struct DelegationState {
    name : String
    parent_version : String
    child_version : String
    blocked : Bool
    findings : Array[DelegationFinding]
    } derive(
    Debug
    )

    DeploymentCounterexample

    pub(all) struct DeploymentCounterexample {
    from_mask : Int
    to_mask : Int
    changed_zone : String
    safe_prefix : Array[String]
    findings : Array[DelegationFinding]
    } derive(
    Debug
    )

    One attempted publication step from a reachable state into a blocked state. from_mask = -1 means the baseline itself is blocked.

    DeploymentPlan

    pub(all) struct DeploymentPlan {
    status : String
    zone_order : Array[String]
    order : Array[String]
    snapshots : Array[DeploymentSnapshot]
    preflight : Array[DelegationFinding]
    counterexample : DeploymentCounterexample?
    safe_order_count : Int
    required_precedence : Array[DeploymentPrecedence]
    first_steps : Array[String]
    blocked_state_count : Int
    } derive(
    Debug
    )

    A safe order is a path through the Boolean state lattice where each step updates exactly one zone and every visited snapshot passes.

    DeploymentPrecedence

    pub(all) struct DeploymentPrecedence {
    before_origin : String
    after_origin : String
    } derive(
    Debug
    )

    A relation shared by every safe complete publication sequence.

    DeploymentSnapshot

    pub(all) struct DeploymentSnapshot {
    mask : Int
    blocked : Bool
    findings : Array[DelegationFinding]
    } derive(
    Debug
    )

    Diagnostic

    pub(all) struct Diagnostic {
    code : String
    severity : String
    message : String
    line : Int
    column : Int
    owner : String
    } derive(Eq,
    Debug
    )

    A source-linked finding. severity is error, warning, or note.

    DnskeyFingerprint

    pub(all) struct DnskeyFingerprint {
    owner : String
    flags : Int
    algorithm : Int
    key_tag : Int
    sha256_digest : String
    } derive(
    Debug
    )

    A digest association, not evidence that the public key or RRSIG is valid.

    ImpactNote

    pub(all) struct ImpactNote {
    severity : String
    category : String
    message : String
    owner : String
    line : Int
    } derive(Eq,
    Debug
    )

    LexResult

    type LexResult derive(
    Debug
    )

    LookupResult

    pub(all) struct LookupResult {
    status : String
    queried_name : String
    queried_type : String
    canonical_name : String
    alias_path : Array[String]
    answers : Array[ResourceRecord]
    } derive(
    Debug
    )

    PolicyParse

    pub(all) struct PolicyParse {
    policy : AuditPolicy
    diagnostics : Array[Diagnostic]
    } derive(
    Debug
    )

    ResourceRecord

    pub(all) struct ResourceRecord {
    owner : String
    origin : String
    ttl : Int
    class_name : String
    record_type : String
    rdata : Array[String]
    line : Int
    column : Int
    } derive(Eq,
    Debug
    )

    One parsed DNS resource record. Names are canonical absolute names.

    SerialOrder

    pub(all) enum SerialOrder {
    Same
    Forward
    Backward
    Undefined
    } derive(Eq,
    Debug
    )

    RFC 1982 serial-number arithmetic yields an undefined region at exactly half the space.

    Statement

    type Statement derive(
    Debug
    )

    TypeCount

    pub(all) struct TypeCount {
    record_type : String
    count : Int
    } derive(Eq,
    Debug
    )

    Zone

    pub(all) struct Zone {
    origin : String
    records : Array[ResourceRecord]
    diagnostics : Array[Diagnostic]
    } derive(
    Debug
    )

    A parsed zone and its syntax diagnostics.

    ZoneChange

    pub(all) struct ZoneChange {
    kind : String
    owner : String
    record_type : String
    rdata : Array[String]
    before_ttl : Int?
    after_ttl : Int?
    line : Int
    } derive(Eq,
    Debug
    )

    ZoneDiff

    pub(all) struct ZoneDiff {
    changes : Array[ZoneChange]
    diagnostics : Array[Diagnostic]
    serial_order : SerialOrder?
    } derive(
    Debug
    )

    ZoneInventory

    pub(all) struct ZoneInventory {
    origin : String
    record_count : Int
    owner_count : Int
    address_count : Int
    alias_count : Int
    min_ttl : Int?
    max_ttl : Int?
    type_counts : Array[TypeCount]
    } derive(
    Debug
    )

    ZoneRevision

    pub(all) struct ZoneRevision {
    origin : String
    before : Zone
    after : Zone
    } derive(
    Debug
    )

    One zone's proposed atomic transition. The origin must match both parsed zone documents. At most six revisions can be checked in one plan.

    absolute_name

    fn absolute_name(name : String, origin : String) -> String

    Convert a master-file owner or domain-valued RDATA to an absolute DNS name.

    analyze_delegation_rollout

    fn analyze_delegation_rollout(parent_before : Zone, parent_after : Zone, child_before : Zone, child_after : Zone) -> DelegationRollout

    Check both publication orders of one parent and one child zone. This is a bounded offline model: it does not simulate DNS caches, live servers, DNSSEC validation, or non-atomic publication.

    assess_impact

    fn assess_impact(diff : ZoneDiff, origin : String) -> ChangeImpact

    A transparent review priority score, not a prediction of DNS availability. SOA serial changes alone are ignored in this score.

    canonical_record_line

    fn canonical_record_line(record : ResourceRecord) -> String

    Render one record with explicit owner, TTL, class, and type. RDATA names are expanded against the $ORIGIN active at that record.

    compare_serial

    fn compare_serial(before : UInt, after : UInt) -> SerialOrder

    compare_zones

    fn compare_zones(before : Zone, after : Zone) -> ZoneDiff

    Compare two versions of one zone as multisets of resource records.

    default_policy

    fn default_policy() -> AuditPolicy

    dnskey_ds_sha256

    fn dnskey_ds_sha256(record : ResourceRecord) -> Result[DnskeyFingerprint, String]

    Compute key tag and digest type 2 for a numeric DNSKEY presentation record. RSA/MD5 algorithm 1 is deliberately unsupported because its key tag differs.

    error_count

    fn error_count(diagnostics : Array[Diagnostic]) -> Int

    find_records

    fn find_records(zone : Zone, owner : String, record_type : String) -> Array[ResourceRecord]

    Get all exact owner/type matches in source order. * means every type.

    inspect_zone

    fn inspect_zone(input : String, origin : String) -> Array[Diagnostic]

    Parse and validate a master file in one call.

    inventory_zone

    fn inventory_zone(zone : Zone) -> ZoneInventory

    Summarize a parsed zone without any network lookup.

    lookup_zone

    fn lookup_zone(zone : Zone, name : String, record_type : String) -> LookupResult

    Simulate an exact, local lookup with CNAME following. This is not a DNS resolver: it performs no wildcard synthesis, delegation, or network I/O.

    parse_policy

    fn parse_policy(source : String) -> PolicyParse

    Parse a small, reviewable policy format: one key value pair per line. Blank lines and lines beginning with # are ignored.

    parse_serial

    fn parse_serial(input : String) -> UInt?

    parse_ttl

    fn parse_ttl(input : String) -> Int?

    Parse a TTL written as seconds or a sequence such as 1w2d3h.

    parse_zone

    fn parse_zone(input : String, origin : String) -> Zone

    Parse the supported RFC 1035 zone-file subset without filesystem or network access.

    plan_delegation_rollout

    fn plan_delegation_rollout(revisions : Array[ZoneRevision]) -> DeploymentPlan

    Enumerate at most 64 before/after combinations, then search for a path from all-before to all-after where one zone changes at each step.

    render_canonical_zone

    fn render_canonical_zone(zone : Zone) -> String

    Produce stable, explicit master-file text in source record order.

    render_delegation_rollout_json

    fn render_delegation_rollout_json(result : DelegationRollout) -> String

    render_delegation_rollout_text

    fn render_delegation_rollout_text(result : DelegationRollout) -> String

    render_deployment_plan_json

    fn render_deployment_plan_json(plan : DeploymentPlan) -> String

    render_deployment_plan_text

    fn render_deployment_plan_text(plan : DeploymentPlan) -> String

    render_diagnostics_json

    fn render_diagnostics_json(items : Array[Diagnostic]) -> String

    Render a deterministic, parseable JSON diagnostics object.

    render_diagnostics_markdown

    fn render_diagnostics_markdown(items : Array[Diagnostic]) -> String

    Render a compact review report suitable for a pull request description.

    render_diagnostics_text

    fn render_diagnostics_text(items : Array[Diagnostic]) -> String

    Render diagnostics for terminal display.

    render_diff_json

    fn render_diff_json(diff : ZoneDiff) -> String

    render_diff_text

    fn render_diff_text(diff : ZoneDiff) -> String

    render_impact_json

    fn render_impact_json(impact : ChangeImpact) -> String

    render_impact_text

    fn render_impact_text(impact : ChangeImpact) -> String

    render_inventory_json

    fn render_inventory_json(inventory : ZoneInventory) -> String

    render_inventory_text

    fn render_inventory_text(inventory : ZoneInventory) -> String

    render_lookup_json

    fn render_lookup_json(result : LookupResult) -> String

    render_lookup_text

    fn render_lookup_text(result : LookupResult) -> String

    trace_alias

    fn trace_alias(zone : Zone, owner : String) -> AliasTrace

    Walk in-zone CNAME links. A repeated name ends the trace with cycle=true.

    valid_domain_name

    fn valid_domain_name(name : String) -> Bool

    Conservative ASCII presentation-name validation. Escaped octets are outside v1 scope.

    valid_ipv4

    fn valid_ipv4(value : String) -> Bool

    valid_ipv6

    fn valid_ipv6(value : String) -> Bool

    Check the text form of an IPv6 address without accepting zone identifiers.

    validate_with_policy

    fn validate_with_policy(zone : Zone, policy : AuditPolicy) -> Array[Diagnostic]

    Apply optional team policy after the standard DNS validation.

    validate_zone

    fn validate_zone(zone : Zone) -> Array[Diagnostic]

    Analyze syntax, record content, and cross-record DNS invariants.

    warning_count

    fn warning_count(diagnostics : Array[Diagnostic]) -> Int

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io