fix(core): Refactor import paths and update dependency references
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import * as plugins from '../plugins.js';
|
||||
import type { IChallengeHandler } from './IChallengeHandler.js';
|
||||
|
||||
/**
|
||||
@ -13,6 +14,8 @@ export interface Http01MemoryHandlerChallenge {
|
||||
}
|
||||
|
||||
export class Http01MemoryHandler implements IChallengeHandler<Http01MemoryHandlerChallenge> {
|
||||
private smartnetworkInstance = new plugins.smartnetwork.SmartNetwork();
|
||||
private smartdnsClient = new plugins.smartdnsClient.Smartdns({});
|
||||
private store: Map<string, string> = new Map();
|
||||
|
||||
public getSupportedTypes(): string[] {
|
||||
@ -64,4 +67,17 @@ export class Http01MemoryHandler implements IChallengeHandler<Http01MemoryHandle
|
||||
res.statusCode = 404;
|
||||
return res.end();
|
||||
}
|
||||
}
|
||||
|
||||
public async checkWetherDomainIsSupported(domainArg: string): Promise<boolean> {
|
||||
const publicIps = await this.smartnetworkInstance.getPublicIps();
|
||||
const aRecords = await this.smartdnsClient.getRecordsA(domainArg);
|
||||
const aaaaRecords = await this.smartdnsClient.getRecordsAAAA(domainArg);
|
||||
if (aRecords.length && aRecords.some((record) => record.value !== publicIps.v4)) {
|
||||
return false;
|
||||
}
|
||||
if (aaaaRecords.length && aaaaRecords.some((record) => record.value !== publicIps.v6)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user