@push.rocks/smartdns 5.0.4 → 6.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/npmextra.json CHANGED
@@ -2,17 +2,30 @@
2
2
  "gitzone": {
3
3
  "projectType": "npm",
4
4
  "module": {
5
- "githost": "gitlab.com",
6
- "gitscope": "pushrocks",
5
+ "githost": "code.foss.global",
6
+ "gitscope": "push.rocks",
7
7
  "gitrepo": "smartdns",
8
- "description": "smart dns methods written in TypeScript",
9
- "npmPackagename": "@pushrocks/smartdns",
10
- "license": "MIT"
8
+ "description": "A TypeScript library for smart DNS methods, supporting various DNS records and providers.",
9
+ "npmPackagename": "@push.rocks/smartdns",
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "DNS",
13
+ "TypeScript",
14
+ "Node.js",
15
+ "Google DNS",
16
+ "Cloudflare",
17
+ "DNS records",
18
+ "DNS resolution",
19
+ "DNSSEC"
20
+ ]
11
21
  }
12
22
  },
13
23
  "npmci": {
14
24
  "npmGlobalTools": [],
15
25
  "npmAccessLevel": "public",
16
26
  "npmRegistryUrl": "registry.npmjs.org"
27
+ },
28
+ "tsdoc": {
29
+ "legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
17
30
  }
18
31
  }
package/package.json CHANGED
@@ -1,44 +1,51 @@
1
1
  {
2
2
  "name": "@push.rocks/smartdns",
3
- "version": "5.0.4",
3
+ "version": "6.1.1",
4
4
  "private": false,
5
- "description": "smart dns methods written in TypeScript",
6
- "main": "dist_ts/index.js",
7
- "typings": "dist_ts/index.d.ts",
8
- "scripts": {
9
- "test": "(tstest test/)",
10
- "build": "(tsbuild --web --allowimplicitany)",
11
- "buildDocs": "tsdoc"
5
+ "description": "A TypeScript library for smart DNS methods, supporting various DNS records and providers.",
6
+ "exports": {
7
+ ".": "./dist_ts_server/index.js",
8
+ "./server": "./dist_ts_server/index.js",
9
+ "./client": "./dist_ts_client/index.js"
12
10
  },
13
11
  "repository": {
14
12
  "type": "git",
15
- "url": "git+ssh://git@gitlab.com/pushrocks/dnsly.git"
13
+ "url": "https://code.foss.global/push.rocks/smartdns.git"
16
14
  },
17
15
  "keywords": [
18
- "dns",
19
- "google dns",
20
- "dns record"
16
+ "DNS",
17
+ "TypeScript",
18
+ "Node.js",
19
+ "Google DNS",
20
+ "Cloudflare",
21
+ "DNS records",
22
+ "DNS resolution",
23
+ "DNSSEC"
21
24
  ],
22
25
  "author": "Lossless GmbH",
23
26
  "license": "MIT",
24
27
  "bugs": {
25
28
  "url": "https://gitlab.com/pushrocks/dnsly/issues"
26
29
  },
27
- "homepage": "https://gitlab.com/pushrocks/dnsly#README",
30
+ "homepage": "https://code.foss.global/push.rocks/smartdns",
28
31
  "dependencies": {
29
- "@pushrocks/smartdelay": "^2.0.13",
30
- "@pushrocks/smartenv": "^5.0.2",
31
- "@pushrocks/smartpromise": "^3.1.7",
32
- "@pushrocks/smartrequest": "^2.0.11",
33
- "@tsclass/tsclass": "^4.0.17",
34
- "dns2": "^2.0.5"
32
+ "@push.rocks/smartdelay": "^3.0.1",
33
+ "@push.rocks/smartenv": "^5.0.5",
34
+ "@push.rocks/smartpromise": "^4.0.4",
35
+ "@push.rocks/smartrequest": "^2.0.15",
36
+ "@tsclass/tsclass": "^4.1.2",
37
+ "@types/dns-packet": "^5.6.5",
38
+ "@types/elliptic": "^6.4.18",
39
+ "dns-packet": "^5.6.1",
40
+ "elliptic": "^6.5.7",
41
+ "minimatch": "^10.0.1"
35
42
  },
36
43
  "devDependencies": {
37
- "@gitzone/tsbuild": "^2.1.63",
38
- "@gitzone/tsrun": "^1.2.39",
39
- "@gitzone/tstest": "^1.0.72",
40
- "@pushrocks/tapbundle": "^5.0.4",
41
- "@types/node": "^18.15.11"
44
+ "@git.zone/tsbuild": "^2.1.84",
45
+ "@git.zone/tsrun": "^1.2.49",
46
+ "@git.zone/tstest": "^1.0.77",
47
+ "@push.rocks/tapbundle": "^5.2.0",
48
+ "@types/node": "^22.5.5"
42
49
  },
43
50
  "files": [
44
51
  "ts/**/*",
@@ -55,5 +62,10 @@
55
62
  "browserslist": [
56
63
  "last 1 chrome versions"
57
64
  ],
58
- "type": "module"
65
+ "type": "module",
66
+ "scripts": {
67
+ "test": "(tstest test/)",
68
+ "build": "(tsbuild tsfolders --web --allowimplicitany)",
69
+ "buildDocs": "tsdoc"
70
+ }
59
71
  }
@@ -0,0 +1 @@
1
+
package/readme.md CHANGED
@@ -1,51 +1,124 @@
1
- # @pushrocks/smartdns
1
+ # @push.rocks/smartdns
2
+
2
3
  smart dns methods written in TypeScript
3
4
 
4
- ## Availabililty and Links
5
- * [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartdns)
6
- * [gitlab.com (source)](https://gitlab.com/pushrocks/smartdns)
7
- * [github.com (source mirror)](https://github.com/pushrocks/smartdns)
8
- * [docs (typedoc)](https://pushrocks.gitlab.io/smartdns/)
9
-
10
- ## Status for master
11
-
12
- Status Category | Status Badge
13
- -- | --
14
- GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartdns/badges/master/pipeline.svg)](https://lossless.cloud)
15
- GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartdns/badges/master/coverage.svg)](https://lossless.cloud)
16
- npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartdns)](https://lossless.cloud)
17
- Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartdns)](https://lossless.cloud)
18
- TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
19
- node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
20
- Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
21
- PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartdns)](https://lossless.cloud)
22
- PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartdns)](https://lossless.cloud)
23
- BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartdns)](https://lossless.cloud)
5
+ ## Install
6
+
7
+ To install `@push.rocks/smartdns`, use the following command with npm:
8
+
9
+ ```bash
10
+ npm install @push.rocks/smartdns --save
11
+ ```
12
+
13
+ Or with `yarn`:
14
+
15
+ ```bash
16
+ yarn add @push.rocks/smartdns
17
+ ```
18
+
19
+ Make sure you have a TypeScript environment setup to utilize the library effectively.
24
20
 
25
21
  ## Usage
26
22
 
27
- Use TypeScript for best in class instellisense.
23
+ `@push.rocks/smartdns` is a comprehensive library aimed at facilitating smart DNS operations, leveraging TypeScript for enhanced development experience. This section aims to cover several real-world scenarios demonstrating the library's capabilities, from basic DNS lookups to more advanced DNS management tasks.
24
+
25
+ ### Getting Started
26
+
27
+ First, ensure you import the module into your TypeScript project:
28
+
29
+ ```typescript
30
+ import { Smartdns } from '@push.rocks/smartdns';
31
+ ```
32
+
33
+ ### Basic DNS Record Lookup
34
+
35
+ Often, the need arises to fetch various DNS records for a domain. `@push.rocks/smartdns` simplifies this by providing intuitive methods.
36
+
37
+ #### Fetching A Records
38
+
39
+ To fetch an "A" record for a domain:
40
+
41
+ ```typescript
42
+ const dnsManager = new Smartdns({});
43
+ const aRecords = await dnsManager.getRecordsA('example.com');
44
+ console.log(aRecords);
45
+ ```
46
+
47
+ #### Fetching AAAA Records
48
+
49
+ Similarly, for "AAAA" records:
50
+
51
+ ```typescript
52
+ const aaaaRecords = await dnsManager.getRecordsAAAA('example.com');
53
+ console.log(aaaaRecords);
54
+ ```
55
+
56
+ ### Advanced DNS Management
57
+
58
+ Beyond simple queries, `@push.rocks/smartdns` offers functionalities suitable for more complex DNS management scenarios.
59
+
60
+ #### Checking DNS Propagation
61
+
62
+ When changing DNS records, ensuring that the new records have propagated fully is crucial. `@push.rocks/smartdns` facilitates this with a method to check a DNS record until it is available globally.
28
63
 
29
64
  ```typescript
30
- const mySmartDns = new smartdns.SmartDns(); // uses Google DNS Https API
31
- const demoRecord = await mySmartDns.getRecord('example.com', 'AAAA'); // returns promise
32
- /*
33
- demoRecord looks like this:
34
- {
35
- name: 'example.com',
36
- type: 'A',
37
- dnsSecEnabled: true,
38
- value: '104.24.103.243'
65
+ const recordType = 'TXT'; // Record type: A, AAAA, CNAME, TXT etc.
66
+ const expectedValue = 'your_expected_value';
67
+ const isAvailable = await dnsManager.checkUntilAvailable('example.com', recordType, expectedValue);
68
+
69
+ if (isAvailable) {
70
+ console.log('Record propagated successfully.');
71
+ } else {
72
+ console.log('Record propagation failed or timed out.');
39
73
  }
40
- */
41
74
  ```
42
75
 
43
- ## Contribution
76
+ ### Leveraging DNS for Application Logic
77
+
78
+ DNS records can serve beyond mere domain-to-IP resolution; they can be instrumental in application logic, such as feature flagging or environment-specific configurations.
79
+
80
+ #### Example: Feature Flagging via TXT Records
81
+
82
+ Consider leveraging TXT records for enabling/disabling features dynamically without deploying new code.
83
+
84
+ ```typescript
85
+ const txtRecords = await dnsManager.getRecordsTxt('features.example.com');
86
+ const featureFlags = txtRecords.reduce((acc, record) => {
87
+ const [flag, isEnabled] = record.value.split('=');
88
+ acc[flag] = isEnabled === 'true';
89
+ return acc;
90
+ }, {});
91
+
92
+ if (featureFlags['NewFeature']) {
93
+ // Logic to enable the new feature
94
+ }
95
+ ```
96
+
97
+ ### Conclusion
98
+
99
+ `@push.rocks/smartdns` offers a versatile set of tools for DNS querying and management, tailored for applications at any scale. The examples provided illustrate the library's potential use cases, highlighting its applicability in various scenarios from basic lookups to facilitating complex application features through DNS.
100
+
101
+ For the full spectrum of functionalities, including detailed method documentation and additional use cases, consult the module's [TypeDoc documentation](https://pushrocks.gitlab.io/smartdns/). This will serve as a comprehensive guide to leveraging `@push.rocks/smartdns` effectively in your projects.
102
+
103
+ Remember, DNS changes might take time to propagate worldwide, and the utility methods provided by `@push.rocks/smartdns` for checking record availability will be invaluable in managing these changes seamlessly.
104
+
105
+
106
+
107
+ ## License and Legal Information
108
+
109
+ This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
110
+
111
+ **Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
112
+
113
+ ### Trademarks
114
+
115
+ This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
116
+
117
+ ### Company Information
44
118
 
45
- We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
119
+ Task Venture Capital GmbH
120
+ Registered at District court Bremen HRB 35230 HB, Germany
46
121
 
47
- For further information read the linked docs at the top of this readme.
122
+ For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
48
123
 
49
- ## Legal
50
- > MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
51
- | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
124
+ By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
@@ -1,9 +0,0 @@
1
- /**
2
- * autocreated commitinfo by @pushrocks/commitinfo
3
- */
4
- export const commitinfo = {
5
- name: '@pushrocks/smartdns',
6
- version: '5.0.4',
7
- description: 'smart dns methods written in TypeScript'
8
- };
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSxxQkFBcUI7SUFDM0IsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLHlDQUF5QztDQUN2RCxDQUFBIn0=
@@ -1,13 +0,0 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- import * as smartenv from '@pushrocks/smartenv';
3
- import type dnsType from 'dns';
4
- declare const dns: typeof dnsType;
5
- export { dns };
6
- import * as smartdelay from '@pushrocks/smartdelay';
7
- import * as smartpromise from '@pushrocks/smartpromise';
8
- import * as smartrequest from '@pushrocks/smartrequest';
9
- export { smartdelay, smartenv, smartpromise, smartrequest };
10
- import * as tsclass from '@tsclass/tsclass';
11
- export { tsclass };
12
- declare const dns2: Promise<any>;
13
- export { dns2 };
@@ -1,15 +0,0 @@
1
- import * as smartenv from '@pushrocks/smartenv';
2
- const smartenvInstance = new smartenv.Smartenv();
3
- const dns = await smartenvInstance.getSafeNodeModule('dns');
4
- export { dns };
5
- // pushrocks scope
6
- import * as smartdelay from '@pushrocks/smartdelay';
7
- import * as smartpromise from '@pushrocks/smartpromise';
8
- import * as smartrequest from '@pushrocks/smartrequest';
9
- export { smartdelay, smartenv, smartpromise, smartrequest };
10
- import * as tsclass from '@tsclass/tsclass';
11
- export { tsclass };
12
- // third party scope
13
- const dns2 = smartenvInstance.getSafeNodeModule('dns2');
14
- export { dns2 };
15
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG5zbHkucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2Ruc2x5LnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLFFBQVEsTUFBTSxxQkFBcUIsQ0FBQztBQUNoRCxNQUFNLGdCQUFnQixHQUFHLElBQUksUUFBUSxDQUFDLFFBQVEsRUFBRSxDQUFDO0FBR2pELE1BQU0sR0FBRyxHQUFtQixNQUFNLGdCQUFnQixDQUFDLGlCQUFpQixDQUFDLEtBQUssQ0FBQyxDQUFDO0FBRTVFLE9BQU8sRUFBRSxHQUFHLEVBQUUsQ0FBQztBQUVmLGtCQUFrQjtBQUNsQixPQUFPLEtBQUssVUFBVSxNQUFNLHVCQUF1QixDQUFDO0FBQ3BELE9BQU8sS0FBSyxZQUFZLE1BQU0seUJBQXlCLENBQUM7QUFDeEQsT0FBTyxLQUFLLFlBQVksTUFBTSx5QkFBeUIsQ0FBQztBQUV4RCxPQUFPLEVBQUUsVUFBVSxFQUFFLFFBQVEsRUFBRSxZQUFZLEVBQUUsWUFBWSxFQUFFLENBQUM7QUFFNUQsT0FBTyxLQUFLLE9BQU8sTUFBTSxrQkFBa0IsQ0FBQztBQUU1QyxPQUFPLEVBQUUsT0FBTyxFQUFFLENBQUM7QUFFbkIsb0JBQW9CO0FBQ3BCLE1BQU0sSUFBSSxHQUFHLGdCQUFnQixDQUFDLGlCQUFpQixDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBQ3hELE9BQU8sRUFBRSxJQUFJLEVBQUUsQ0FBQyJ9
package/dist_ts/index.js DELETED
@@ -1,186 +0,0 @@
1
- import * as plugins from './dnsly.plugins.js';
2
- export const makeNodeProcessUseDnsProvider = (providerArg) => {
3
- switch (providerArg) {
4
- case 'cloudflare':
5
- plugins.dns.setServers([
6
- '1.1.1.1',
7
- '1.0.0.1',
8
- '[2606:4700:4700::1111]',
9
- '[2606:4700:4700::1001]',
10
- ]);
11
- break;
12
- case 'google':
13
- plugins.dns.setServers([
14
- '8.8.8.8',
15
- '8.8.4.4',
16
- '[2001:4860:4860::8888]',
17
- '[2606:4700:4700::1001]',
18
- ]);
19
- }
20
- };
21
- /**
22
- * class dnsly offers methods for working with dns from a dns provider like Google DNS
23
- */
24
- export class Smartdns {
25
- /**
26
- * constructor for class dnsly
27
- */
28
- constructor(optionsArg) {
29
- this.dnsTypeMap = {
30
- A: 1,
31
- AAAA: 28,
32
- CNAME: 5,
33
- MX: 15,
34
- TXT: 16,
35
- };
36
- }
37
- /**
38
- * check a dns record until it has propagated to Google DNS
39
- * should be considerably fast
40
- * @param recordNameArg
41
- * @param recordTypeArg
42
- * @param expectedValue
43
- */
44
- async checkUntilAvailable(recordNameArg, recordTypeArg, expectedValue, cyclesArg = 50, intervalArg = 500) {
45
- let runCycles = 0;
46
- const doCheck = async () => {
47
- if (runCycles < cyclesArg) {
48
- runCycles++;
49
- try {
50
- let myRecordArray;
51
- if (runCycles % 2 === 0 || !plugins.dns) {
52
- myRecordArray = await this.getRecords(recordNameArg, recordTypeArg, 0);
53
- }
54
- else {
55
- myRecordArray = await this.getRecordWithNodeDNS(recordNameArg, recordTypeArg);
56
- }
57
- const myRecord = myRecordArray[0].value;
58
- if (myRecord === expectedValue) {
59
- console.log(`smartdns: .checkUntilAvailable() verified that wanted >>>${recordTypeArg}<<< record exists for >>>${recordNameArg}<<< with value >>>${expectedValue}<<<`);
60
- return true;
61
- }
62
- else {
63
- await plugins.smartdelay.delayFor(intervalArg);
64
- return await doCheck();
65
- }
66
- }
67
- catch (err) {
68
- // console.log(err);
69
- await plugins.smartdelay.delayFor(intervalArg);
70
- return await doCheck();
71
- }
72
- }
73
- else {
74
- console.log(`smartdns: .checkUntilAvailable() failed permanently for ${recordNameArg} with value ${recordTypeArg} - ${expectedValue}...`);
75
- return false;
76
- }
77
- };
78
- return await doCheck();
79
- }
80
- /**
81
- * get A Dns Record
82
- */
83
- async getRecordsA(recordNameArg) {
84
- return await this.getRecords(recordNameArg, 'A');
85
- }
86
- /**
87
- * get AAAA Record
88
- */
89
- async getRecordsAAAA(recordNameArg) {
90
- return await this.getRecords(recordNameArg, 'AAAA');
91
- }
92
- /**
93
- * gets a txt record
94
- */
95
- async getRecordsTxt(recordNameArg) {
96
- return await this.getRecords(recordNameArg, 'TXT');
97
- }
98
- async getRecords(recordNameArg, recordTypeArg, retriesCounterArg = 20) {
99
- const requestUrl = `https://cloudflare-dns.com/dns-query?name=${recordNameArg}&type=${recordTypeArg}&do=1`;
100
- const returnArray = [];
101
- const getResponseBody = async (counterArg = 0) => {
102
- const response = await plugins.smartrequest.request(requestUrl, {
103
- method: 'GET',
104
- headers: {
105
- accept: 'application/dns-json',
106
- },
107
- });
108
- const responseBody = response.body;
109
- if (responseBody?.Status !== 0 && counterArg < retriesCounterArg) {
110
- await plugins.smartdelay.delayFor(500);
111
- return getResponseBody(counterArg++);
112
- }
113
- else {
114
- return responseBody;
115
- }
116
- };
117
- const responseBody = await getResponseBody();
118
- if (!responseBody.Answer || !typeof responseBody.Answer[Symbol.iterator]) {
119
- return returnArray;
120
- }
121
- for (const dnsEntry of responseBody.Answer) {
122
- if (dnsEntry.data.startsWith('"') && dnsEntry.data.endsWith('"')) {
123
- dnsEntry.data = dnsEntry.data.replace(/^"(.*)"$/, '$1');
124
- }
125
- if (dnsEntry.name.endsWith('.')) {
126
- dnsEntry.name = dnsEntry.name.substring(0, dnsEntry.name.length - 1);
127
- }
128
- returnArray.push({
129
- name: dnsEntry.name,
130
- type: this.convertDnsTypeNumberToTypeName(dnsEntry.type),
131
- dnsSecEnabled: responseBody.AD,
132
- value: dnsEntry.data,
133
- });
134
- }
135
- // console.log(responseBody);
136
- return returnArray;
137
- }
138
- /**
139
- * gets a record using nodejs dns resolver
140
- */
141
- async getRecordWithNodeDNS(recordNameArg, recordTypeArg) {
142
- const done = plugins.smartpromise.defer();
143
- plugins.dns.resolve(recordNameArg, recordTypeArg, (err, recordsArg) => {
144
- if (err) {
145
- done.reject(err);
146
- return;
147
- }
148
- const returnArray = [];
149
- for (const recordKey in recordsArg) {
150
- returnArray.push({
151
- name: recordNameArg,
152
- value: recordsArg[recordKey][0],
153
- type: recordTypeArg,
154
- dnsSecEnabled: false,
155
- });
156
- }
157
- done.resolve(returnArray);
158
- });
159
- return done.promise;
160
- }
161
- async getNameServers(domainNameArg) {
162
- const done = plugins.smartpromise.defer();
163
- plugins.dns.resolveNs(domainNameArg, (err, result) => {
164
- if (!err) {
165
- done.resolve(result);
166
- }
167
- else {
168
- console.log(err);
169
- done.reject(err);
170
- }
171
- });
172
- return await done.promise;
173
- }
174
- convertDnsTypeNameToTypeNumber(dnsTypeNameArg) {
175
- return this.dnsTypeMap[dnsTypeNameArg];
176
- }
177
- convertDnsTypeNumberToTypeName(dnsTypeNumberArg) {
178
- for (const key in this.dnsTypeMap) {
179
- if (this.dnsTypeMap[key] === dnsTypeNumberArg) {
180
- return key;
181
- }
182
- }
183
- return null;
184
- }
185
- }
186
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLG9CQUFvQixDQUFDO0FBSTlDLE1BQU0sQ0FBQyxNQU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/**
2
- * autocreated commitinfo by @pushrocks/commitinfo
3
- */
4
- export const commitinfo = {
5
- name: '@pushrocks/smartdns',
6
- version: '5.0.4',
7
- description: 'smart dns methods written in TypeScript'
8
- }
@@ -1,22 +0,0 @@
1
- import * as smartenv from '@pushrocks/smartenv';
2
- const smartenvInstance = new smartenv.Smartenv();
3
- // node native scope
4
- import type dnsType from 'dns';
5
- const dns: typeof dnsType = await smartenvInstance.getSafeNodeModule('dns');
6
-
7
- export { dns };
8
-
9
- // pushrocks scope
10
- import * as smartdelay from '@pushrocks/smartdelay';
11
- import * as smartpromise from '@pushrocks/smartpromise';
12
- import * as smartrequest from '@pushrocks/smartrequest';
13
-
14
- export { smartdelay, smartenv, smartpromise, smartrequest };
15
-
16
- import * as tsclass from '@tsclass/tsclass';
17
-
18
- export { tsclass };
19
-
20
- // third party scope
21
- const dns2 = smartenvInstance.getSafeNodeModule('dns2');
22
- export { dns2 };