feature: Bootstrapper secure server discovery

This commit is contained in:
Gary Sharp
2026-01-22 15:26:23 +11:00
parent 71fa53bfb2
commit e1f1973520
40 changed files with 2094 additions and 460 deletions
+30
View File
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
namespace Disco.Services.Interop.DNS
{
public class DnsService
{
public DnsService()
{
}
public static List<T> Query<T>(string name, bool bypassCache = false) where T : DnsRecord
{
DnsRecordType recordType;
if (typeof(T) == typeof(ADnsRecord))
recordType = DnsRecordType.A;
else if (typeof(T) == typeof(CnameDnsRecord))
recordType = DnsRecordType.Cname;
else if (typeof(T) == typeof(TxtDnsRecord))
recordType = DnsRecordType.Txt;
else if (typeof(T) == typeof(SrvDnsRecord))
recordType = DnsRecordType.Srv;
else
throw new NotSupportedException($"Unsupported DNS record type: {typeof(T).Name}");
var records = NativeDns.QueryRecords(recordType, name, bypassCache);
return records.ConvertAll(r => (T)r);
}
}
}