mDNS utilities
The purpose of the built-in mDNS/DNS-SD utilities are solely for easy network setup/testing/debugging, therefor they are generally more verbose and have much slower (but more complete) defaults than e.g. avahi
does.
Discover services
qft mdns discover --service-label googlecast --service-protocol tcp
Example Output
INFO Browsing for _googlecast._tcp.local.
INFO Resolved a new service: SERVICE_NAME._googlecast._tcp.local.
INFO Discovered 1 service!
Hostname: SERVICE_NAME.local.
Type Name: _googlecast._tcp.local.
Full Name: SERVICE_NAME._googlecast._tcp.local.
IP(s): fe80::d912:463a:8c88:deca
192.168.121.21
Resolve mDNS hostname
Resolves hostname IP(s), all of the following forms are valid.
qft mdns resolve foo
qft mdns resolve foo.local
qft mdns resolve foo.local.
Example output
INFO Resolving address for foo.local.
Hostname: foo.local.
IP(s): fe80::d912:463a:8c88:deca
192.168.121.21
Register mDNS service (for testing or transferring by addressing the registered hostname)
qft mdns register --hostname foo-name --service-label bar-label --service-protocol tcp --keep-alive-ms 123456
INFO Registering:
Hostname: foo-name.local.
Type: _bar-label._tcp.local.
Full Name: test_inst._bar-label._tcp.local.
INFO Keeping alive for: 123.456s
You can the find it using the qft mdns
subcommands or e.g. with avahi
:
avahi-resolve --name foo-name.local
# foo-name.local 172.17.0.1
But that only outputs the first received address. Using qft mdns resolve
will output all the associated IPs. If you need speed use the --short-circuit
flag to return as soon as the first IP associated with the hostname is resolved e.g.
qft mdns resolve foo-name[.local.] --short-circuit