module XMPP::DnsSrv

Overview

Minimal DNS SRV (RFC 2782) resolver used by XEP-0368 connection discovery. Crystal's stdlib resolves only A/AAAA records via Socket::Addrinfo, so this hand-rolled resolver issues a UDP SRV query through the system resolver configured in /etc/resolv.conf.

Defined in:

xmpp/dns_srv.cr

Class Method Summary

Class Method Detail

def self.resolve(service : String, domain : String, timeout : Float64 = 2.0) : Array(SRVRecord) #

Resolves SRV records for the given service and domain.

service is the underscore-prefixed service name, e.g. "_xmpps-client". domain is the XMPP service domain, e.g. "example.org".

Returns the records sorted by RFC 2782 priority, with weighted randomization applied within equal priorities. Returns an empty array when no records exist, the query fails, or no resolver is configured.


[View source]
def self.stub_nameservers(servers : Array(String), &) #

[View source]