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

MDNS server implementation See https://www.rfc-editor.org/rfc/rfc6762.html for specifications

Reference documentation:

Link to this section Summary

Functions

Add a list of DNS.Resource to the list of this server authoritative records

Returns a specification to start this module under a supervisor.

Dump list of DNS.Resource received by the server. Each instance contains DNS record information.

Callback implementation for GenServer.init/1.

Pretty print of DNS records known by the server.

Start a new MDNS server.

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

Link to this section Functions

Link to this function

add_resources(resources)

View Source
@spec add_resources(DNS.Resource.t()) :: :ok

Add a list of DNS.Resource to the list of this server authoritative records

Authoritative records are broadcasted on the MDNS network.

Returns a specification to start this module under a supervisor.

See Supervisor.

Dump list of DNS.Resource received by the server. Each instance contains DNS record information.

Callback implementation for GenServer.init/1.

Pretty print of DNS records known by the server.

Start a new MDNS server.

The server is started with a set of socket parameter compatible with MDNS specification. Two sockets are opened on IPv4 (224.0.0.51) and IPv6 (ff02::fb) with port 5353. Parameters can be overriden with options from :gen_udp.open/2 (https://www.erlang.org/doc/man/gen_udp.html#open-2)

@spec subscribe() :: :ok | {:error, {:already_registered, pid()}}

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

Notifications use Phoenix PubSub.

Listeners will receive:

  • {:record_removed, old_record}, when a DNS record is removed after timeout. old_record contains the removed record data
  • {:record_changed, old_resource, resource}, when a DNS record data are updated (before timeout refresh for example)
  • {:record_added, resource}, when a DNS record is added