class Matter::MDNS::Responder

Overview

mDNS Responder for advertising Matter services

Handles:

Included Modules

Defined in:

matter/mdns/responder.cr

Constant Summary

ANNOUNCEMENT_INTERVAL = 30.seconds
DEFAULT_TTL = 120.seconds
MDNS_IPV4 = Socket::IPAddress.new("224.0.0.251", MDNS_PORT)
MDNS_IPV6 = Socket::IPAddress.new("ff02::fb", MDNS_PORT)
MDNS_PORT = 5353

Constructors

Instance Method Summary

Instance methods inherited from module Matter::MDNS::ResponderInterface

advertise_commissioning(info : CommissioningInfo, port : Int32 = 5540, ttl : Time::Span = 120.seconds) : Nil advertise_commissioning, advertise_operational(info : OperationalInfo, port : Int32 = 5540, ttl : Time::Span = 120.seconds) : Nil advertise_operational, stop_commissioning : Nil stop_commissioning, stop_operational_advertisement : Nil stop_operational_advertisement

Constructor Detail

def self.new(port : Int32 = MDNS_PORT, hostname : String = "matter-device.local", ip_addresses : Array(Socket::IPAddress) = [] of Socket::IPAddress) #

[View source]

Instance Method Detail

def close : Nil #

Close responder


[View source]
def commissioning_instance_name : String | Nil #

Returns the current commissioning DNS-SD instance name (e.g. DD200C20D25AE5F7._matterc._udp.local) if commissioning is currently being advertised.


[View source]
def hostname : String #

[View source]
def ip_addresses : Array(Socket::IPAddress) #

[View source]
def on_query : Proc(DNS::Packet, Socket::IPAddress, Nil) | Nil #

Callback for received queries Signature: (query : DNS::Packet, peer_address : Socket::IPAddress) -> Nil


[View source]
def on_query=(on_query : Proc(DNS::Packet, Socket::IPAddress, Nil) | Nil) #

Callback for received queries Signature: (query : DNS::Packet, peer_address : Socket::IPAddress) -> Nil


[View source]
def port : Int32 #

[View source]
def respond_to_query(query : DNS::Packet, service_type : ServiceType, instance : String, port : Int32, txt_records : Hash(String, String), hostname : String) : Nil #

Respond to a specific query with explicit hostname (SRV target).


[View source]
def respond_to_query(query : DNS::Packet, service_type : ServiceType, instance : String, port : Int32, txt_records : Hash(String, String)) : Nil #

Respond to a specific query


[View source]
def send_goodbye(service_type : ServiceType, instance : String) : Nil #

Send goodbye announcement (TTL=0) to remove service


[View source]
def socket_ipv4 : UDPSocket | Nil #

[View source]
def socket_ipv6 : UDPSocket | Nil #

[View source]
def start : Nil #

Start listening for mDNS queries


[View source]
def stop : Nil #

Stop listening


[View source]
def stop_commissioning : Nil #

Stop all commissioning advertisements


[View source]
def stop_operational_advertisement : Nil #

Stop all operational advertisements


[View source]
def update_commissioning_hostname(hostname : String) : Nil #

Updates the default commissioning target hostname (SRV target) and re-announces any active commissioning advertisements without changing the commissioning instance name.


[View source]