*add getRelayServers api method
This commit is contained in:
parent
37fbd1ee62
commit
4956592d1d
10
src/index.ts
10
src/index.ts
|
@ -33,6 +33,7 @@ addHandler("addRelay", handleAddRelay);
|
||||||
addHandler("removeRelay", handleRemoveRelay);
|
addHandler("removeRelay", handleRemoveRelay);
|
||||||
addHandler("clearRelays", handleClearRelays);
|
addHandler("clearRelays", handleClearRelays);
|
||||||
addHandler("getRelays", handleGetRelays);
|
addHandler("getRelays", handleGetRelays);
|
||||||
|
addHandler("getRelayServers", handleGetRelayServers);
|
||||||
addHandler("ready", handleReady);
|
addHandler("ready", handleReady);
|
||||||
|
|
||||||
async function handlePresentSeed(aq: ActiveQuery) {
|
async function handlePresentSeed(aq: ActiveQuery) {
|
||||||
|
@ -268,6 +269,15 @@ function handleGetRelays(aq: ActiveQuery) {
|
||||||
|
|
||||||
aq.respond(dht.relays);
|
aq.respond(dht.relays);
|
||||||
}
|
}
|
||||||
|
function handleGetRelayServers(aq: ActiveQuery) {
|
||||||
|
const dht = validateDht(aq);
|
||||||
|
|
||||||
|
if (!dht) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
aq.respond(dht.relayServers);
|
||||||
|
}
|
||||||
|
|
||||||
async function handleReady(aq: ActiveQuery) {
|
async function handleReady(aq: ActiveQuery) {
|
||||||
const dht = validateDht(aq);
|
const dht = validateDht(aq);
|
||||||
|
|
Loading…
Reference in New Issue