Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
fix: update interfaces (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed May 6, 2022
1 parent d7bc3c9 commit bbb0c62
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"release": "aegir release"
},
"dependencies": {
"@libp2p/interfaces": "^1.3.31",
"@libp2p/interfaces": "^1.3.32",
"@libp2p/logger": "^1.1.3",
"@libp2p/peer-id": "^1.1.9",
"@multiformats/multiaddr": "^10.1.5",
Expand Down
9 changes: 9 additions & 0 deletions src/compat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Responder } from './responder.js'
import { Querier } from './querier.js'
import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interfaces/peer-discovery'
import type { Components, Initializable } from '@libp2p/interfaces/components'
import { symbol } from '@libp2p/interfaces/peer-discovery'

export interface GoMulticastDNSInit {
queryPeriod?: number
Expand Down Expand Up @@ -32,6 +33,14 @@ export class GoMulticastDNS extends EventEmitter<PeerDiscoveryEvents> implements
})
}

get [symbol] (): true {
return true
}

get [Symbol.toStringTag] () {
return '@libp2p/go-mdns'
}

init (components: Components): void {
this._responder.init(components)
this._querier.init(components)
Expand Down
9 changes: 9 additions & 0 deletions src/compat/querier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { ResponsePacket } from 'multicast-dns'
import type { RemoteInfo } from 'dgram'
import { Components, Initializable } from '@libp2p/interfaces/components'
import { findPeerInfoInAnswers } from './utils.js'
import { symbol } from '@libp2p/interfaces/peer-discovery'

const log = logger('libp2p:mdns:compat:querier')

Expand Down Expand Up @@ -42,6 +43,14 @@ export class Querier extends EventEmitter<PeerDiscoveryEvents> implements PeerDi
this._onResponse = this._onResponse.bind(this)
}

get [symbol] (): true {
return true
}

get [Symbol.toStringTag] () {
return '@libp2p/go-mdns-querier'
}

init (components: Components): void {
this.components = components
}
Expand Down
11 changes: 9 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { GoMulticastDNS } from './compat/index.js'
import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interfaces/peer-discovery'
import type { PeerInfo } from '@libp2p/interfaces/peer-info'
import { Components, Initializable } from '@libp2p/interfaces/components'
import { symbol } from '@libp2p/interfaces/peer-discovery'

const log = logger('libp2p:mdns')

Expand All @@ -20,8 +21,6 @@ export interface MulticastDNSOptions {
}

export class MulticastDNS extends EventEmitter<PeerDiscoveryEvents> implements PeerDiscovery, Initializable {
static tag = 'mdns'

public mdns?: multicastDNS.MulticastDNS

private readonly broadcast: boolean
Expand Down Expand Up @@ -53,6 +52,14 @@ export class MulticastDNS extends EventEmitter<PeerDiscoveryEvents> implements P
}
}

get [symbol] (): true {
return true
}

get [Symbol.toStringTag] () {
return '@libp2p/mdns'
}

init (components: Components): void {
this.components = components

Expand Down

0 comments on commit bbb0c62

Please sign in to comment.