0.1.3 • Published 5 years ago

@dzfu/parser v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

@dzfu/parser

dns zonefile parser

Build Status License: MIT

Install

yarn add @dzfu/parser

Usage

import { RR } from "@dzfu/core";
import { parseZone } from "@dzfu/parser";

const text = `
$TTL  3600
@ IN  SOA ns.example1.com. root.example1.com. (
  20190101  ; serial
  3600 ; refresh
  3600 ; retry
  1209600 ; expire
  3600 ; negative cache ttl
)

; NS records

@  IN  NS  ns.example1.com.
@  IN  NS  ns2.example1.com. 

; A records

localhost.example1.com. IN  A 127.0.0.1
ns.example1.com.  IN  A 192.1.2.2
ns2.example1.com. IN  A 192.1.2.3
bug.example1.com. IN  A 192.249.249.1
dog IN  A 192.249.249.2
cat IN  A 192.249.249.3
shark IN  A 192.249.249.4

; CNAME records

foo.example1.com.  IN  CNAME example2.com.
bar.example1.com.  IN  CNAME foo.example2.com.
`;

const rrs: RR[] = parseZone(text, "example1.com.");
console.log(rrs);
/**
Array [
  Object {
    "class": 0,
    "expire": 1209600,
    "mbox": "root.example1.com.",
    "minttl": 3600,
    "name": "example1.com.",
    "ns": "ns.example1.com.",
    "refresh": 3600,
    "retry": 3600,
    "rrtype": 5,
    "serial": 20190101,
    "ttl": 3600,
  },
  Object {
    "class": 0,
    "name": "example1.com.",
    "ns": "ns.example1.com.",
    "rrtype": 3,
    "ttl": 3600,
  },

  ...,

  Object {
    "class": 0,
    "name": "bar.example1.com.",
    "rrtype": 0,
    "target": "foo.example2.com.",
    "ttl": 3600,
  },
]
*/
0.1.3

5 years ago

0.1.2

5 years ago

0.0.8

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago