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

[feature/multicast-dns] Added support for custom DNS server IP #142

Merged
merged 5 commits into from
Oct 18, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface MulticastDNSOptions {
interval?: number
serviceTag?: string
port?: number
ip?: string
compat?: boolean
compatQueryPeriod?: number
compatQueryInterval?: number
Expand All @@ -27,6 +28,7 @@ export class MulticastDNS extends EventEmitter<PeerDiscoveryEvents> implements P
private readonly interval: number
private readonly serviceTag: string
private readonly port: number
private readonly ip: string
rennokki marked this conversation as resolved.
Show resolved Hide resolved
private _queryInterval: ReturnType<typeof setInterval> | null
private readonly _goMdns?: GoMulticastDNS
private components: Components = new Components()
Expand Down Expand Up @@ -80,7 +82,7 @@ export class MulticastDNS extends EventEmitter<PeerDiscoveryEvents> implements P
return
}

this.mdns = multicastDNS({ port: this.port })
this.mdns = multicastDNS({ port: this.port, ip: this.ip })
this.mdns.on('query', this._onMdnsQuery)
this.mdns.on('response', this._onMdnsResponse)

Expand Down