*add getRelayServers api method

This commit is contained in:
Derrick Hammer 2022-08-14 07:28:40 -04:00
parent 37fbd1ee62
commit 4956592d1d
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 16 additions and 6 deletions

View File

@ -33,6 +33,7 @@ addHandler("addRelay", handleAddRelay);
addHandler("removeRelay", handleRemoveRelay);
addHandler("clearRelays", handleClearRelays);
addHandler("getRelays", handleGetRelays);
addHandler("getRelayServers", handleGetRelayServers);
addHandler("ready", handleReady);
async function handlePresentSeed(aq: ActiveQuery) {
@ -268,6 +269,15 @@ function handleGetRelays(aq: ActiveQuery) {
aq.respond(dht.relays);
}
function handleGetRelayServers(aq: ActiveQuery) {
const dht = validateDht(aq);
if (!dht) {
return;
}
aq.respond(dht.relayServers);
}
async function handleReady(aq: ActiveQuery) {
const dht = validateDht(aq);