-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated: get DNS records with
dig
cmd
- Loading branch information
1 parent
f95bbd6
commit de9424b
Showing
14 changed files
with
141 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,41 @@ | ||
import type { DnsRecord } from './types.js'; | ||
export declare function getDnsRecords(name: string, type?: string, resolver?: string): Promise<DnsRecord[]>; | ||
export type DnsRecord = { | ||
name: string; | ||
type: string; | ||
ttl: number; | ||
data: string; | ||
}; | ||
/** | ||
* Get DNS records of a given type for a FQDN. | ||
* @param name Fully qualified domain name. | ||
* @param type DNS record type: A, AAAA, TXT, CNAME, MX, etc. | ||
* @param resolver DNS resolver to use. Default: cloudflare-dns. | ||
*/ | ||
export declare function getDnsRecords(name: string, type?: string, resolver?: string | Function): Promise<DnsRecord[]>; | ||
export type GetAllDnsRecordsOptions = { | ||
resolver?: string; | ||
resolver?: string | Function; | ||
subdomains?: string[]; | ||
}; | ||
/** | ||
* Discover all DNS records for a given domain and stream each record as a text line. | ||
* @param domain Valid domain name. | ||
* @param options Options for DNS resolver, extra subdomains to check, etc. | ||
*/ | ||
export declare function getAllDnsRecordsStream(domain: string, options?: Partial<GetAllDnsRecordsOptions>): ReadableStream; | ||
/** | ||
* Discover all DNS records for a given domain and return an array of records. | ||
* @param domain Valid domain name. | ||
* @param options Options for DNS resolver, extra subdomains to check, etc. | ||
*/ | ||
export declare function getAllDnsRecords(domain: string, options?: Partial<GetAllDnsRecordsOptions>): Promise<DnsRecord[]>; | ||
/** | ||
* Parse a DNS record string into a DnsRecord object. | ||
* @param record DNS record string. | ||
*/ | ||
export declare function parseDnsRecord(record: string | Uint8Array): DnsRecord; | ||
/** | ||
* Detect wildcard DNS records and return a new array with the wildcard records added. | ||
* @param domain Domain name. | ||
* @param records Array of DNS records. | ||
* @param percent Percentage of records with the same data to consider a wildcard. | ||
*/ | ||
export declare function detectWildcardRecords(domain: string, records: DnsRecord[], percent?: number): DnsRecord[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { DnsRecord, getAllDnsRecords } from '../src/index.ts' | ||
import { getDnsRecordsDig } from '../src/resolver-node-dig.ts' | ||
|
||
const domain = 'render.com' | ||
|
||
const dnsRecords = await getAllDnsRecords(domain, { | ||
resolver: getDnsRecordsDig, | ||
}) | ||
|
||
console.log(dnsRecords) | ||
console.log(`${dnsRecords.length} DNS Records found ${domain} 👆`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { DnsRecord, getDnsRecords } from '../src/index.ts' | ||
import { getDnsRecordsDig } from '../src/resolver-node-dig.ts' | ||
|
||
const domain = 'amazon.com' | ||
|
||
const txtRecords = await getDnsRecords(domain, 'TXT', 'node-dig') | ||
const txtRecords = await getDnsRecordsDig(domain, 'TXT') | ||
|
||
console.log(`TXT records for ${domain}`) | ||
console.log(txtRecords) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "@layered/dns-records", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"exports": "./src/index.ts" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.