Giter VIP home page Giter VIP logo

mdnsresolver's Introduction

mDNS Resolver Build Status

An Arduino library that resolves mDNS (bonjour) names. It doesn't do any discovery, it just resolves names.

Compatibility

  • Hardware: ESP8266. I don't believe the stock Arduino UDP library supports multicast (Please correct me if I'm wrong), so only the ESP8266 is supported at the moment
  • Software: Tested against avahi and avahi-alias which adds CNAMEs. Post a bug report if it doesn't work with a server that you are using.

Why?

My home automation projects don't need discovery - I just wanted to be able to enter the name of my MQTT server when configuring my devices. There are other libraries out there that do discovery of services, but they didn't do name resolution easily - And they introduced more code than I needed.

Installation

Clone this code in to your Arduino directory.

cd ~/Arduino/libraries
git clone https://github.com/daniele-athome/mDNSResolver.git

Restart your IDE. You can now include

#include <mDNSResolver.h>

in your sketch.

Usage

IPAddress ip = resolver.search("test.local");

Returns INADDR_NONE if the name can't be found.

See the examples folder for the full setup details

Advanced Customisation

You can change a few settings by defining some constants before including the mDNSResolver header file, but only if you really know what you are doing

#define MDNS_RETRY    1000      # Number of milliseconds between rebroadcasting a name query
#define MDNS_ATTEMPTS 5         # Number of times to try a resolving before giving up
#define UDP_TIMEOUT   255       # Amount of time (in milliseconds) before giving up on the UDP packet
#define MDNS_TLD      ".local"  # Top-level domain to search for. This can technically be anything, but pretty much everyone says leave it as .local

#include <mDNSResolver.h>

Testing

The library has a suite of specs, which you can run on any machine that supports g++ (requires c++11 support).

The specs are written using Catch, written in BDD style.

make test

Contributing

Issues and bugs can be raised on the Issue tracker on GitHub

For code and documentation fixes, clone the code, make the fix, write and run the tests, and submit a pull request.

Feature branches with lots of small commits (especially titled "oops", "fix typo", "forgot to add file", etc.) should be squashed before opening a pull request. At the same time, please refrain from putting multiple unrelated changes into a single pull request.

License

See LICENSE.txt

Credits

Much inspiration, and some parts of the code have been taken (or modified from) https://github.com/mrdunk/esp8266_mdns

mdnsresolver's People

Contributors

daniele-athome avatar lobradov avatar madpilot avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.