diff --git a/src/discovery/mdns.js b/src/discovery/local-discovery.js similarity index 98% rename from src/discovery/mdns.js rename to src/discovery/local-discovery.js index ebc3cd691..33ec0863c 100644 --- a/src/discovery/mdns.js +++ b/src/discovery/local-discovery.js @@ -21,7 +21,7 @@ export const ERR_DUPLICATE = 'Duplicate connection' /** * @extends {TypedEmitter} */ -export class MdnsDiscovery extends TypedEmitter { +export class LocalDiscovery extends TypedEmitter { #identityKeypair #server /** @type {Map>} */ @@ -254,7 +254,7 @@ export class MdnsDiscovery extends TypedEmitter { } /** - * @type {MdnsDiscovery['stop']} + * @type {LocalDiscovery['stop']} */ async #stop({ force = false, timeout = 0 } = {}) { this.#log('stopping') diff --git a/tests/discovery/mdns.js b/tests/discovery/local-discovery.js similarity index 94% rename from tests/discovery/mdns.js rename to tests/discovery/local-discovery.js index 9c6a41cbb..529b9fe25 100644 --- a/tests/discovery/mdns.js +++ b/tests/discovery/local-discovery.js @@ -5,7 +5,10 @@ import { KeyManager } from '@mapeo/crypto' import { setTimeout as delay } from 'node:timers/promises' import pDefer from 'p-defer' import { keyToPublicId } from '@mapeo/crypto' -import { ERR_DUPLICATE, MdnsDiscovery } from '../../src/discovery/mdns.js' +import { + ERR_DUPLICATE, + LocalDiscovery, +} from '../../src/discovery/local-discovery.js' import NoiseSecretStream from '@hyperswarm/secret-stream' test('mdns - discovery and sharing of data', (t) => { @@ -13,10 +16,10 @@ test('mdns - discovery and sharing of data', (t) => { const identityKeypair1 = new KeyManager(randomBytes(16)).getIdentityKeypair() const identityKeypair2 = new KeyManager(randomBytes(16)).getIdentityKeypair() - const mdnsDiscovery1 = new MdnsDiscovery({ + const mdnsDiscovery1 = new LocalDiscovery({ identityKeypair: identityKeypair1, }) - const mdnsDiscovery2 = new MdnsDiscovery({ + const mdnsDiscovery2 = new LocalDiscovery({ identityKeypair: identityKeypair2, }) const str = 'hi' @@ -52,7 +55,7 @@ test('deduplicate incoming connections', async (t) => { const localKp = new KeyManager(randomBytes(16)).getIdentityKeypair() const remoteKp = new KeyManager(randomBytes(16)).getIdentityKeypair() - const discovery = new MdnsDiscovery({ identityKeypair: localKp }) + const discovery = new LocalDiscovery({ identityKeypair: localKp }) await discovery.start() discovery.on('connection', (conn) => { @@ -113,7 +116,7 @@ async function testMultiple(t, { period, nPeers = 20 }) { async function spawnPeer(onConnected) { const identityKeypair = new KeyManager(randomBytes(16)).getIdentityKeypair() - const discovery = new MdnsDiscovery({ identityKeypair }) + const discovery = new LocalDiscovery({ identityKeypair }) const peerId = keyToPublicId(discovery.publicKey) peersById.set(peerId, discovery) const conns = []