fix(core): update
This commit is contained in:
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartwhois',
|
||||
version: '1.0.7',
|
||||
version: '1.0.8',
|
||||
description: 'a package for dealing with whois requests'
|
||||
}
|
||||
|
20
ts/index.ts
20
ts/index.ts
@ -38,7 +38,27 @@ export interface IWhoisInfo {
|
||||
}
|
||||
|
||||
export class SmartWhois {
|
||||
/**
|
||||
* can be used to prepare an input for the whois command
|
||||
*/
|
||||
public async getParsedUrlResultForWhois(urlArg: string) {
|
||||
const smarturlInstance = plugins.smarturl.Smarturl.createFromUrl(urlArg);
|
||||
const tldtsData = plugins.tldts.parse(urlArg);
|
||||
return {
|
||||
fullUrl: smarturlInstance.toString(),
|
||||
fullDomain: smarturlInstance.hostname,
|
||||
domain: tldtsData.domain,
|
||||
publicSuffix: tldtsData.publicSuffix,
|
||||
subdomain: tldtsData.subdomain,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async getWhoisForDomain(domainArg: string): Promise<IWhoisInfo> {
|
||||
if (domainArg.includes('//')) {
|
||||
const parsedUrlResult = await this.getParsedUrlResultForWhois(domainArg);
|
||||
domainArg = parsedUrlResult.fullDomain;
|
||||
}
|
||||
const whoisInfo = await plugins.whoiser.domain(domainArg);
|
||||
const whoisServers = Object.keys(whoisInfo);
|
||||
const selectedWhoisInfo: any = whoisInfo[whoisServers[0]];
|
||||
|
@ -1,3 +1,10 @@
|
||||
// pushrocks scope
|
||||
import * as smarturl from '@pushrocks/smarturl';
|
||||
|
||||
export {
|
||||
smarturl,
|
||||
}
|
||||
|
||||
// third party
|
||||
import * as whoiser from 'whoiser';
|
||||
import tldts from 'tldts';
|
||||
|
Reference in New Issue
Block a user