项目作者: mkuron

项目描述 :
A Discovery Proxy for Multicast DNS-Based Service Discovery written in Python
高级语言: Python
项目地址: git://github.com/mkuron/mdns-discovery-proxy.git
创建时间: 2020-08-03T21:15:37Z
项目社区:https://github.com/mkuron/mdns-discovery-proxy

开源协议:MIT License

下载


This is a Discovery Proxy for Multicast DNS-Based Service Discovery, written in pure Python. It makes use of zeroconf to obtain mDNS advertisements on the local network and Twisted to re-publish them as a unicast DNS service.

This kind of proxy is specified by RFC 8766. I did not actually follow the standard in implementing it, which means that it doesn’t abide by many of the finer details. Nevertheless, it works fine with clients like macOS 10.15 and iOS 13. Any violations of the standard are to be considered bugs and should be fixed over time.

Other implementations of discovery proxies are ohybridproxy and included with mDNSResponder. Since the former only runs on OpenWRT and mDNSResponder is not readily available on Linux, I decided to put together my own implementation in Python. Its dependencies are pure Python, so it should be possible to run it pretty much anywhere.

To use the discovery proxy, run it while specifying a domain to use and a port number to listen on:

  1. python3 proxy.py home.arpa 35353

Then, delegate that domain to the machine the proxy is running on (192.0.2.2 in the example below) and advertise it by adding the necessary records to your network’s DNS search domain (example.com in the example below). If you are using dnsmasq, this can be done using

  1. server=/home.arpa/192.0.2.2#35353
  2. ptr-record=b._dns-sd._udp.example.com,home.arpa
  3. ptr-record=lb._dns-sd._udp.example.com,home.arpa
  4. ptr-record=db._dns-sd._udp.example.com,home.arpa

To check whether it is working, you can try some of the following queries (assuming your computer is named yourcomputer and advertises an SSH service):

  1. dig yourcomputer.home.arpa
  2. dig _ssh._tcp.home.arpa ptr
  3. dig yourcomputer._ssh._tcp.home.arpa srv