Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
ba4a910962 | |||
739c95c1e1 | |||
39442208c8 | |||
b686202ae5 | |||
4093d091f4 | |||
7a8086b58c | |||
a45e41889d | |||
c33ee3f52c | |||
1732a2ab3e | |||
43ebd17ae6 |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartwhois",
|
"name": "@pushrocks/smartwhois",
|
||||||
"version": "1.0.8",
|
"version": "1.0.13",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a package for dealing with whois requests",
|
"description": "a package for dealing with whois requests",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@ -23,8 +23,9 @@
|
|||||||
"@types/node": "^18.15.11"
|
"@types/node": "^18.15.11"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartrequest": "^2.0.11",
|
"@pushrocks/smartrequest": "^2.0.15",
|
||||||
"@pushrocks/smarturl": "^3.0.6",
|
"@pushrocks/smarturl": "^3.0.6",
|
||||||
|
"@tsclass/tsclass": "^4.0.38",
|
||||||
"tldts": "^6.0.3",
|
"tldts": "^6.0.3",
|
||||||
"whoiser": "^1.16.0"
|
"whoiser": "^1.16.0"
|
||||||
},
|
},
|
||||||
|
37
pnpm-lock.yaml
generated
37
pnpm-lock.yaml
generated
@ -2,11 +2,14 @@ lockfileVersion: '6.0'
|
|||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
'@pushrocks/smartrequest':
|
'@pushrocks/smartrequest':
|
||||||
specifier: ^2.0.11
|
specifier: ^2.0.15
|
||||||
version: 2.0.11
|
version: 2.0.15
|
||||||
'@pushrocks/smarturl':
|
'@pushrocks/smarturl':
|
||||||
specifier: ^3.0.6
|
specifier: ^3.0.6
|
||||||
version: 3.0.6
|
version: 3.0.6
|
||||||
|
'@tsclass/tsclass':
|
||||||
|
specifier: ^4.0.38
|
||||||
|
version: 4.0.38
|
||||||
tldts:
|
tldts:
|
||||||
specifier: ^6.0.3
|
specifier: ^6.0.3
|
||||||
version: 6.0.3
|
version: 6.0.3
|
||||||
@ -479,10 +482,10 @@ packages:
|
|||||||
'@pushrocks/smartmime': 1.0.5
|
'@pushrocks/smartmime': 1.0.5
|
||||||
'@pushrocks/smartpath': 5.0.5
|
'@pushrocks/smartpath': 5.0.5
|
||||||
'@pushrocks/smartpromise': 3.1.7
|
'@pushrocks/smartpromise': 3.1.7
|
||||||
'@pushrocks/smartrequest': 2.0.11
|
'@pushrocks/smartrequest': 2.0.15
|
||||||
'@pushrocks/smartsitemap': 2.0.1
|
'@pushrocks/smartsitemap': 2.0.1
|
||||||
'@pushrocks/smarttime': 4.0.1
|
'@pushrocks/smarttime': 4.0.1
|
||||||
'@tsclass/tsclass': 4.0.34
|
'@tsclass/tsclass': 4.0.38
|
||||||
'@types/compression': 1.7.2
|
'@types/compression': 1.7.2
|
||||||
'@types/cors': 2.8.13
|
'@types/cors': 2.8.13
|
||||||
'@types/express': 4.17.17
|
'@types/express': 4.17.17
|
||||||
@ -520,7 +523,7 @@ packages:
|
|||||||
'@pushrocks/smartmime': 1.0.5
|
'@pushrocks/smartmime': 1.0.5
|
||||||
'@pushrocks/smartpath': 5.0.5
|
'@pushrocks/smartpath': 5.0.5
|
||||||
'@pushrocks/smartpromise': 3.1.7
|
'@pushrocks/smartpromise': 3.1.7
|
||||||
'@pushrocks/smartrequest': 2.0.11
|
'@pushrocks/smartrequest': 2.0.15
|
||||||
'@pushrocks/smartstream': 2.0.3
|
'@pushrocks/smartstream': 2.0.3
|
||||||
'@pushrocks/streamfunction': 4.0.4
|
'@pushrocks/streamfunction': 4.0.4
|
||||||
'@types/fs-extra': 11.0.1
|
'@types/fs-extra': 11.0.1
|
||||||
@ -656,7 +659,7 @@ packages:
|
|||||||
'@pushrocks/smartpromise': 3.1.7
|
'@pushrocks/smartpromise': 3.1.7
|
||||||
'@pushrocks/smartpuppeteer': 2.0.2
|
'@pushrocks/smartpuppeteer': 2.0.2
|
||||||
'@pushrocks/smartunique': 3.0.3
|
'@pushrocks/smartunique': 3.0.3
|
||||||
'@tsclass/tsclass': 4.0.34
|
'@tsclass/tsclass': 4.0.38
|
||||||
'@types/express': 4.17.17
|
'@types/express': 4.17.17
|
||||||
express: 4.18.2
|
express: 4.18.2
|
||||||
pdf-merger-js: 3.4.0
|
pdf-merger-js: 3.4.0
|
||||||
@ -677,6 +680,10 @@ packages:
|
|||||||
|
|
||||||
/@pushrocks/smartpromise@3.1.7:
|
/@pushrocks/smartpromise@3.1.7:
|
||||||
resolution: {integrity: sha512-2gLQCeviEJwZ+cHHtK2Ks98brZatGC6dPXKIs1tVgJsiNgRFjnp90fESuJ1Pmoe7RrS+7J3mO4NtsFHAJJ/y5w==}
|
resolution: {integrity: sha512-2gLQCeviEJwZ+cHHtK2Ks98brZatGC6dPXKIs1tVgJsiNgRFjnp90fESuJ1Pmoe7RrS+7J3mO4NtsFHAJJ/y5w==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
|
/@pushrocks/smartpromise@4.0.2:
|
||||||
|
resolution: {integrity: sha512-bqorOaGXPOuiOSV81luTKrTghg4O4NBRD0zyv7TIqmrMGf4a0uoozaUMp1X8vQdZW+y0gTzUJP9wkzAE6Cci0g==}
|
||||||
|
|
||||||
/@pushrocks/smartpuppeteer@2.0.2:
|
/@pushrocks/smartpuppeteer@2.0.2:
|
||||||
resolution: {integrity: sha512-l3tqnD6Evseofq1avHsMy2FXXEmCd4Z+nm3xmMWS7nWvP9qTbJIn0XguOBaUIAhR8zE53UKPXs5/qBqXVNZDDQ==}
|
resolution: {integrity: sha512-l3tqnD6Evseofq1avHsMy2FXXEmCd4Z+nm3xmMWS7nWvP9qTbJIn0XguOBaUIAhR8zE53UKPXs5/qBqXVNZDDQ==}
|
||||||
@ -692,10 +699,10 @@ packages:
|
|||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@pushrocks/smartrequest@2.0.11:
|
/@pushrocks/smartrequest@2.0.15:
|
||||||
resolution: {integrity: sha512-fqS5D+o4fzhen4qlhT8DJiSSUVno1q+hSXcq5VJFGTQVtvaZ5lZeK1odqMJsCOHZ3mD2LykrufIPViktwgnyVg==}
|
resolution: {integrity: sha512-QDXXKhOwAIp+TNFrDglApBpbCTClHrf8pUM3w81q5+VtrMbqUrLINHhInXt3ZUSgTS7RD9HtJSIVSqAukcJo5A==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@pushrocks/smartpromise': 3.1.7
|
'@pushrocks/smartpromise': 4.0.2
|
||||||
'@pushrocks/smarturl': 3.0.6
|
'@pushrocks/smarturl': 3.0.6
|
||||||
agentkeepalive: 4.3.0
|
agentkeepalive: 4.3.0
|
||||||
form-data: 4.0.0
|
form-data: 4.0.0
|
||||||
@ -930,11 +937,10 @@ packages:
|
|||||||
type-fest: 2.19.0
|
type-fest: 2.19.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@tsclass/tsclass@4.0.34:
|
/@tsclass/tsclass@4.0.38:
|
||||||
resolution: {integrity: sha512-Fk4y/cKfzAjq+9HcsR/CRvWDn7ERrKxd75oPVASrfjECyA/Mf7zDKbPfLwZyAq4zk4abkg1RydfNjQWRLXHdTA==}
|
resolution: {integrity: sha512-dwxW8MkmAAi8BYO//yYLb0x01BqtUh3kN6t5pq163GEMBYZ9pNSLs/7cafQFPX1/Ia9gknlOphYH0uYZwJET/g==}
|
||||||
dependencies:
|
dependencies:
|
||||||
type-fest: 3.7.2
|
type-fest: 3.8.0
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@tsconfig/node10@1.0.9:
|
/@tsconfig/node10@1.0.9:
|
||||||
resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==}
|
resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==}
|
||||||
@ -4265,10 +4271,9 @@ packages:
|
|||||||
engines: {node: '>=12.20'}
|
engines: {node: '>=12.20'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/type-fest@3.7.2:
|
/type-fest@3.8.0:
|
||||||
resolution: {integrity: sha512-f9BHrLjRJ4MYkfOsnC/53PNDzZJcVo14MqLp2+hXE39p5bgwqohxR5hDZztwxlbxmIVuvC2EFAKrAkokq23PLA==}
|
resolution: {integrity: sha512-FVNSzGQz9Th+/9R6Lvv7WIAkstylfHN2/JYxkyhhmKFYh9At2DST8t6L6Lref9eYO8PXFTfG9Sg1Agg0K3vq3Q==}
|
||||||
engines: {node: '>=14.16'}
|
engines: {node: '>=14.16'}
|
||||||
dev: true
|
|
||||||
|
|
||||||
/type-is@1.6.18:
|
/type-is@1.6.18:
|
||||||
resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==}
|
resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==}
|
||||||
|
13
test/test.ts
13
test/test.ts
@ -9,7 +9,14 @@ tap.test('should create a valid instance of SmartWhois', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should get a parsed url result for whois', async () => {
|
tap.test('should get a parsed url result for whois', async () => {
|
||||||
const parsedUrlResult = await testSmartWhois.getParsedUrlResultForWhois('https://coffee.link/understanding-gen-z/');
|
const parsedUrlResult = await testSmartWhois.getDomainDelegation('https://coffee.link/understanding-gen-z/');
|
||||||
|
console.log(parsedUrlResult);
|
||||||
|
const parsedUrlResult2 = await testSmartWhois.getDomainDelegation('task.vc');
|
||||||
|
console.log(parsedUrlResult2);
|
||||||
|
});
|
||||||
|
|
||||||
|
tap.test('should get additional data', async () => {
|
||||||
|
const parsedUrlResult = await testSmartWhois.getAdditionalWhoisDataForDomain('https://coffee.link/understanding-gen-z/');
|
||||||
console.log(parsedUrlResult);
|
console.log(parsedUrlResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -17,6 +24,10 @@ tap.test('should get whois info for domain', async () => {
|
|||||||
const whoisInfo = await testSmartWhois.getWhoisForDomain('task.vc');
|
const whoisInfo = await testSmartWhois.getWhoisForDomain('task.vc');
|
||||||
console.log(whoisInfo);
|
console.log(whoisInfo);
|
||||||
});
|
});
|
||||||
|
tap.test('should get whois info for domain', async () => {
|
||||||
|
const whoisInfo = await testSmartWhois.getWhoisForDomain('https://lossless.com');
|
||||||
|
console.log(whoisInfo);
|
||||||
|
});
|
||||||
|
|
||||||
tap.test('should get whois info for domain', async () => {
|
tap.test('should get whois info for domain', async () => {
|
||||||
const whoisInfo = await testSmartWhois.getWhoisForDomain('https://coffee.link/understanding-gen-z/');
|
const whoisInfo = await testSmartWhois.getWhoisForDomain('https://coffee.link/understanding-gen-z/');
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@pushrocks/smartwhois',
|
name: '@pushrocks/smartwhois',
|
||||||
version: '1.0.8',
|
version: '1.0.13',
|
||||||
description: 'a package for dealing with whois requests'
|
description: 'a package for dealing with whois requests'
|
||||||
}
|
}
|
||||||
|
29
ts/index.ts
29
ts/index.ts
@ -41,7 +41,10 @@ export class SmartWhois {
|
|||||||
/**
|
/**
|
||||||
* can be used to prepare an input for the whois command
|
* can be used to prepare an input for the whois command
|
||||||
*/
|
*/
|
||||||
public async getParsedUrlResultForWhois(urlArg: string) {
|
public async getDomainDelegation(urlArg: string): Promise<plugins.tsclass.network.IDomainDelegation> {
|
||||||
|
if (!urlArg.includes('//')) {
|
||||||
|
urlArg = `https://${urlArg}`;
|
||||||
|
}
|
||||||
const smarturlInstance = plugins.smarturl.Smarturl.createFromUrl(urlArg);
|
const smarturlInstance = plugins.smarturl.Smarturl.createFromUrl(urlArg);
|
||||||
const tldtsData = plugins.tldts.parse(urlArg);
|
const tldtsData = plugins.tldts.parse(urlArg);
|
||||||
return {
|
return {
|
||||||
@ -50,13 +53,35 @@ export class SmartWhois {
|
|||||||
domain: tldtsData.domain,
|
domain: tldtsData.domain,
|
||||||
publicSuffix: tldtsData.publicSuffix,
|
publicSuffix: tldtsData.publicSuffix,
|
||||||
subdomain: tldtsData.subdomain,
|
subdomain: tldtsData.subdomain,
|
||||||
|
domainWithoutSuffix: tldtsData.domainWithoutSuffix,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async getAdditionalWhoisDataForDomain(domainArg: string) {
|
||||||
|
if (domainArg.includes('//')) {
|
||||||
|
const parsedUrlResult = await this.getDomainDelegation(domainArg);
|
||||||
|
domainArg = parsedUrlResult.fullDomain;
|
||||||
|
}
|
||||||
|
|
||||||
|
// lets test http response
|
||||||
|
const httpResult = await plugins.smartrequest.safeGet(`http://${domainArg}/`);
|
||||||
|
|
||||||
|
// lets test https response
|
||||||
|
const httpsResult = await plugins.smartrequest.safeGet(`https://${domainArg}/`);
|
||||||
|
|
||||||
|
return {
|
||||||
|
httpStatus: httpResult.statusCode,
|
||||||
|
httpsStatus: httpsResult.statusCode,
|
||||||
|
httpHeaders: httpResult.headers,
|
||||||
|
httpsHeaders: httpsResult.headers,
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public async getWhoisForDomain(domainArg: string): Promise<IWhoisInfo> {
|
public async getWhoisForDomain(domainArg: string): Promise<IWhoisInfo> {
|
||||||
if (domainArg.includes('//')) {
|
if (domainArg.includes('//')) {
|
||||||
const parsedUrlResult = await this.getParsedUrlResultForWhois(domainArg);
|
const parsedUrlResult = await this.getDomainDelegation(domainArg);
|
||||||
domainArg = parsedUrlResult.fullDomain;
|
domainArg = parsedUrlResult.fullDomain;
|
||||||
}
|
}
|
||||||
const whoisInfo = await plugins.whoiser.domain(domainArg);
|
const whoisInfo = await plugins.whoiser.domain(domainArg);
|
||||||
|
@ -1,8 +1,17 @@
|
|||||||
|
// @tsclass scope
|
||||||
|
import * as tsclass from '@tsclass/tsclass';
|
||||||
|
|
||||||
|
export {
|
||||||
|
tsclass,
|
||||||
|
}
|
||||||
|
|
||||||
// pushrocks scope
|
// pushrocks scope
|
||||||
import * as smarturl from '@pushrocks/smarturl';
|
import * as smarturl from '@pushrocks/smarturl';
|
||||||
|
import * as smartrequest from '@pushrocks/smartrequest';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
smarturl,
|
smarturl,
|
||||||
|
smartrequest,
|
||||||
}
|
}
|
||||||
|
|
||||||
// third party
|
// third party
|
||||||
|
Reference in New Issue
Block a user