fix _device-info._tcp
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=DNS-SD Proxy
|
||||
After=network.target network.service
|
||||
[Service]
|
||||
ExecStart=/usr/bin/python3 /home/sysadmin/dns-sd-proxy/proxy.py mdns.home.kuron-germany.de 35353
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
Type=simple
|
||||
User=sysadmin
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from zeroconf import Zeroconf, ServiceBrowser, ServiceStateChange, DNSQuestion, DNSOutgoing, RecordUpdateListener, _TYPE_A, _CLASS_IN, _FLAGS_QR_QUERY
|
||||
from zeroconf import Zeroconf, ServiceBrowser, ServiceStateChange, ServiceInfo, DNSQuestion, DNSOutgoing, RecordUpdateListener, _TYPE_A, _CLASS_IN, _FLAGS_QR_QUERY
|
||||
import sys
|
||||
import time
|
||||
from twisted.internet import reactor, defer, threads
|
||||
@@ -47,7 +47,13 @@ class DynamicResolver(object):
|
||||
return answers, [], []
|
||||
|
||||
def txt(localname):
|
||||
info = self.zeroconf.get_service_info(localname, localname)
|
||||
if localname.endswith('._device-info._tcp.local.'):
|
||||
info = ServiceInfo(localname, localname)
|
||||
info.request(self.zeroconf, timeout*1000)
|
||||
if not info.text:
|
||||
return [], [], []
|
||||
else:
|
||||
info = self.zeroconf.get_service_info(localname, localname, timeout*1000)
|
||||
if info is None:
|
||||
return [], [], []
|
||||
|
||||
@@ -58,7 +64,7 @@ class DynamicResolver(object):
|
||||
return answers, [], []
|
||||
|
||||
def srv(localname):
|
||||
info = self.zeroconf.get_service_info(localname, localname)
|
||||
info = self.zeroconf.get_service_info(localname, localname, timeout*1000)
|
||||
if info is None:
|
||||
return [], [], []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user