moonzoneguard

    Offline DNS zone-file validation and revision analysis

    dns
    zone
    linter
    diff
    Download zip
    Author
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    8 hours ago
    Downloads
    1

    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
    )

    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.

    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
    )

    absolute_name

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

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

    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

    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.

    render_canonical_zone

    fn render_canonical_zone(zone : Zone) -> String

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

    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