Small program that reads lines from a file and creates a new CNAME entry using mDNS
C++ Python
Latest commit 3742658 Jun 14, 2014 @bertjwregeer Add files
Permalink
Failed to load latest commit information.
src
.gitignore
CHANGES
LICENSE
README
test.domains
waf
wscript

README

mdns-announce
=============

This is a tool that will use mDNS (Bonjour) to advertise a CNAME record.

For developing web applications, it can be handy to have the ability to create
various fake DNS entries that can be used with virtual hosting.

This was mainly developed to help build github.com/usingnamespace which uses
virtual hosting to differentiate between different blogs.

Requirements for building
-------------------------

You will need the following dependencies installed:

 Mac OS X:

   - Compiler with C++11 support (clang is default)
   - libev

       brew install libev

 Other:

   - Compiler with C++11 support
   - libev
   - dns_sd (Avahi or other)

Building
--------

  ./waf configure
  ./waf build_release

If you want to build using GCC (the build defaults to clang):

  ./waf configure --compiler=gcc
  ./waf build_release

Running
-------

  ./build/release/src/mdns-announce test.domains

Now if you open a new terminal in the same directory, you can run the following
to see that they are being announced as set in the file.

  for I in `cat test.domains | awk -F : '{ print $1 }'`; do
    dig @224.0.0.251 -p 5353 -t CNAME $I | grep CNAME | grep -v ";"
  done

File Format
-----------

The file format is very simple:

  <local domain>:<cname pointer>

For example:

  com.example.local:example.com
  net.example.local:example.net

If you want to allow the file to easily be transferred from system to system
(such as when working on an application with others, you can use $self to refer
to the current system).

$self will get replaced with the current systems hostname as returned by
gethostname(3).

  test.local:$self
  www.test.local:$self

Developing
----------

  - Fork the project.
  - Make your feature addition or bug fix.
  - Commit
  - Send me a pull request. Bonus points for topic branches.

Debug builds can be created like this:

  ./waf build

This will drop a debug binary in ./build/debug/src/mdns-announce.