DNS Record types

This commit is contained in:
Braydon 2024-04-14 16:10:45 -04:00
parent fe00e7d50b
commit 13c0a76e97
2 changed files with 50 additions and 16 deletions

49
Lib/src/types/dns.d.ts vendored Normal file

@ -0,0 +1,49 @@
/**
* An A record.
*/
interface ARecord extends DNSRecord {
/**
* The address of this record, undefined if unresolved.
*/
address?: string | undefined;
}
/**
* An SRV record.
*/
interface SRVRecord extends DNSRecord {
/**
* The priority of this record.
*/
priority: number;
/**
* The weight of this record.
*/
weight: number;
/**
* The port of this record.
*/
port: number;
/**
* The target of this record.
*/
target: string;
}
/**
* A representation of a DNS record.
*/
type DNSRecord = {
/**
* The type of this record.
*/
type: RecordType;
/**
* The TTL (Time To Live) of this record.
*/
ttl: number;
};

@ -20,7 +20,7 @@ type MinecraftServer = {
/** /**
* The DNS records resolved for this server. * The DNS records resolved for this server.
*/ */
records: DNSRecord[]; records: ARecord | SRVRecord[];
/** /**
* The player counts of this server. * The player counts of this server.
@ -33,21 +33,6 @@ type MinecraftServer = {
motd: MOTD; motd: MOTD;
}; };
/**
* A representation of a DNS record.
*/
type DNSRecord = {
/**
* The type of this record.
*/
type: RecordType;
/**
* The TTL (Time To Live) of this record.
*/
ttl: number;
};
/** /**
* Player count data for a server. * Player count data for a server.
*/ */