diff --git a/npmextra.json b/npmextra.json index 942d059..56db911 100644 --- a/npmextra.json +++ b/npmextra.json @@ -1,14 +1,13 @@ { "gitzone": { "projectType": "npm", - "compliance": "standard", "module": { - "githost": {}, - "gitscope": {}, - "gitrepo": {}, - "shortDescription": {}, - "npmPackagename": {}, - "license": {} + "githost": "gitlab.com", + "gitscope": "pushrocks", + "gitrepo": "smartdns", + "shortDescription": "smart dns methods written in TypeScript", + "npmPackagename": "@pushrocks/smartdns", + "license": "MIT" } }, "npmci": { diff --git a/package.json b/package.json index 99d926d..db435d0 100644 --- a/package.json +++ b/package.json @@ -49,4 +49,4 @@ "npmextra.json", "readme.md" ] -} +} \ No newline at end of file diff --git a/readme.md b/readme.md index cf850b6..e994477 100644 --- a/readme.md +++ b/readme.md @@ -1,17 +1,17 @@ -# @[object Object]/[object Object] -[object Object] +# @pushrocks/smartdns +smart dns methods written in TypeScript ## Availabililty and Links -* [npmjs.org (npm package)](https://www.npmjs.com/package/[object Object]) -* [gitlab.com (source)](https://[object Object]/[object Object]/[object Object]) -* [github.com (source mirror)](https://github.com/[object Object]/[object Object]) -* [docs (typedoc)](https://[object Object].gitlab.io/[object Object]/) +* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartdns) +* [gitlab.com (source)](https://gitlab.com/pushrocks/smartdns) +* [github.com (source mirror)](https://github.com/pushrocks/smartdns) +* [docs (typedoc)](https://pushrocks.gitlab.io/smartdns/) ## Status for master -[![pipeline status](https://[object Object]/[object Object]/[object Object]/badges/master/pipeline.svg)](https://[object Object]/[object Object]/[object Object]/commits/master) -[![coverage report](https://[object Object]/[object Object]/[object Object]/badges/master/coverage.svg)](https://[object Object]/[object Object]/[object Object]/commits/master) -[![npm downloads per month](https://img.shields.io/npm/dm/[object Object].svg)](https://www.npmjs.com/package/[object Object]) -[![Known Vulnerabilities](https://snyk.io/test/npm/[object Object]/badge.svg)](https://snyk.io/test/npm/[object Object]) +[![pipeline status](https://gitlab.com/pushrocks/smartdns/badges/master/pipeline.svg)](https://gitlab.com/pushrocks/smartdns/commits/master) +[![coverage report](https://gitlab.com/pushrocks/smartdns/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smartdns/commits/master) +[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smartdns.svg)](https://www.npmjs.com/package/@pushrocks/smartdns) +[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smartdns/badge.svg)](https://snyk.io/test/npm/@pushrocks/smartdns) [![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/) @@ -22,7 +22,7 @@ Use TypeScript for best in class instellisense. ```typescript const mySmartDns = new smartdns.SmartDns(); // uses Google DNS Https API -const demoRecord = mySmartDns.getRecord('example.com', 'AAAA') // returns promise +const demoRecord = mySmartDns.getRecord('example.com', 'AAAA'); // returns promise /* demoRecord looks like this: { @@ -34,16 +34,13 @@ demoRecord looks like this: */ ``` -For further information read the linked docs at the top of this README. +## Contribution -> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) -> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) - -[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks) +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). :) For further information read the linked docs at the top of this readme. -> [object Object] licensed | **©** [Lossless GmbH](https://lossless.gmbh) +> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) [![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) diff --git a/test/test.ts b/test/test.ts index 22170c4..1741356 100644 --- a/test/test.ts +++ b/test/test.ts @@ -71,6 +71,6 @@ tap.test('should detect dns sec', async () => { const result = await testDnsly.getRecordA('lossless.com'); console.log(result[0]); expect(result[0].dnsSecEnabled).to.be.true; -}) +}); tap.start(); diff --git a/ts/index.ts b/ts/index.ts index 318b224..14b1abd 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -11,12 +11,10 @@ export interface IGoogleDNSHTTPSResponse { RA: boolean; AD: boolean; CD: boolean; - Question: Array< { name: string, type: number }>; - Answer: Array< - { name: string, type: number, TTL: number, data: string } - >, - Additional: [], - Comment: string + Question: Array<{ name: string; type: number }>; + Answer: Array<{ name: string; type: number; TTL: number; data: string }>; + Additional: []; + Comment: string; } /** @@ -26,13 +24,13 @@ export class Smartdns { public dnsServerIp: string; public dnsServerPort: number; - public dnsTypeMap: {[key: string]: number} = { + public dnsTypeMap: { [key: string]: number } = { A: 1, AAAA: 28, CNAME: 5, MX: 15, - TXT: 16, - } + TXT: 16 + }; /** * constructor for class dnsly @@ -107,7 +105,7 @@ export class Smartdns { const response = await plugins.smartrequest.request(requestUrl, { method: 'GET' }); - const returnArray: plugins.tsclass.network.IDnsRecord[] = []; + const returnArray: plugins.tsclass.network.IDnsRecord[] = []; const responseBody: IGoogleDNSHTTPSResponse = response.body; for (const dnsEntry of responseBody.Answer) { if (dnsEntry.data.startsWith('"') && dnsEntry.data.endsWith('"')) { @@ -187,16 +185,18 @@ export class Smartdns { } } - public convertDnsTypeNameToTypeNumber (dnsTypeNameArg: string): number { + public convertDnsTypeNameToTypeNumber(dnsTypeNameArg: string): number { return this.dnsTypeMap[dnsTypeNameArg]; } - public convertDnsTypeNumberToTypeName (dnsTypeNumberArg: number): plugins.tsclass.network.TDnsRecordType { + public convertDnsTypeNumberToTypeName( + dnsTypeNumberArg: number + ): plugins.tsclass.network.TDnsRecordType { for (const key in this.dnsTypeMap) { if (this.dnsTypeMap[key] === dnsTypeNumberArg) { return key as plugins.tsclass.network.TDnsRecordType; } - }; - return null + } + return null; } }