settings and resolver

stripwan
gapodo 2023-11-21 01:54:51 +01:00
parent 8b502811a4
commit 1c28f62f36
2 changed files with 143 additions and 126 deletions

View File

@ -408,12 +408,12 @@ export class Settings {
static readonly KEY_FLAG_CONNECT_DEFAULT: ValuedRegistryKey<boolean> = {
key: "connect_default",
valueType: "boolean",
defaultValue: false
defaultValue: true
};
static readonly KEY_CONNECT_ADDRESS: ValuedRegistryKey<string> = {
key: "connect_address",
valueType: "string",
defaultValue: undefined
defaultValue: "tea.lp.kle.li"
};
static readonly KEY_CONNECT_PROFILE: ValuedRegistryKey<string> = {
key: "connect_profile",
@ -448,7 +448,7 @@ export class Settings {
static readonly KEY_CONNECT_NO_DNSPROXY: ValuedRegistryKey<boolean> = {
key: "connect_no_dnsproxy",
defaultValue: false,
defaultValue: true,
valueType: "boolean",
};

View File

@ -26,6 +26,20 @@ class LocalhostResolver implements DNSResolveMethod {
}
class FakeResolver implements DNSResolveMethod {
name(): string {
return "fake resolver";
}
async resolve(address: DNSAddress): Promise<DNSAddress | undefined> {
return {
hostname: "tea.lp.kle.li",
port: address.port
}
}
}
class IPResolveMethod implements DNSResolveMethod {
readonly v6: boolean;
@ -309,6 +323,7 @@ class TeaSpeakDNSResolve {
}
}
const kResolverFake = new FakeResolver();
const kResolverLocalhost = new LocalhostResolver();
const kResolverIpV4 = new IPResolveMethod(false);
@ -327,7 +342,9 @@ export async function resolveTeaSpeakServerAddress(address: DNSAddress, _options
const resolver = new TeaSpeakDNSResolve(address);
resolver.registerResolver(kResolverLocalhost);
resolver.registerResolver(kResolverFake);
resolver.registerResolver(kResolverLocalhost, kResolverFake);
resolver.registerResolver(resolverSrvTS, kResolverLocalhost);
resolver.registerResolver(resolverSrvTS3, kResolverLocalhost);