View Source Exagon.Zeroconf.Mdns.Dnssd (Exagon Zeroconf v0.2.0)

DNS-SD service discovery.

provides DNS service discrovery over multicast DNS. It uses Exagon.Zeroconf.Mdns.Dnssd.Server to listen for DNS-SD relevand records and build a list of discovred services.

Link to this section Summary

Functions

Register a new DNS-SD service.

Returns a specification to start this module under a supervisor.

Dump list of Service discovered by the server.

Callback implementation for GenServer.init/1.

Returns the list of currently discovered services.

Register a process for receiving notifications on added, removed or changed services

Link to this section Functions

@spec add_service(Exagon.Zeroconf.Mdns.Dnssd.Service.t()) :: :ok

Register a new DNS-SD service.

Registering a DNS-SD service adds new authoritative resources to the Mdns.Server which are then broadcasted to the network

Returns a specification to start this module under a supervisor.

See Supervisor.

Dump list of Service discovered by the server.

List of service if organized inside a map under each service domain. The list may contain partially discovered services. Use query/1 to get a list of services with completed discovery.

@spec init(any()) ::
  {:ok, %Exagon.Zeroconf.Mdns.Dnssd.State{mdns_domain: any(), services: map()}}

Callback implementation for GenServer.init/1.

Link to this function

query(namespace \\ ".local")

View Source
@spec query(String.t()) :: list()

Returns the list of currently discovered services.

List can be filtered by providing a domain list. Example:

Exagon.Zeroconf.Mdns.Dnssd.query("_http._tcp.local")

Register a process for receiving notifications on added, removed or changed services

Notifications use Phoenix PubSub.

Listeners will receive:

  • {:service_changed, old_service, service}, when a service DNS data are updated
  • {:service_added, service}, when a new service is discovered