From 13c0a76e97a4e4e68f5c322061526f0c0dc63ab8 Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Sun, 14 Apr 2024 16:10:45 -0400 Subject: [PATCH] DNS Record types --- Lib/src/types/dns.d.ts | 49 +++++++++++++++++++++++++++++++++++++++ Lib/src/types/server.d.ts | 17 +------------- 2 files changed, 50 insertions(+), 16 deletions(-) create mode 100644 Lib/src/types/dns.d.ts diff --git a/Lib/src/types/dns.d.ts b/Lib/src/types/dns.d.ts new file mode 100644 index 0000000..27ee19d --- /dev/null +++ b/Lib/src/types/dns.d.ts @@ -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; +}; diff --git a/Lib/src/types/server.d.ts b/Lib/src/types/server.d.ts index 4ed395e..4381fa6 100644 --- a/Lib/src/types/server.d.ts +++ b/Lib/src/types/server.d.ts @@ -20,7 +20,7 @@ type MinecraftServer = { /** * The DNS records resolved for this server. */ - records: DNSRecord[]; + records: ARecord | SRVRecord[]; /** * The player counts of this server. @@ -33,21 +33,6 @@ type MinecraftServer = { 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. */