Giter Site home page Giter Site logo

launchdns's Introduction

launchdns

A launchd friendly development DNS server.

launchdns [-spt46]

Installation

$ make
$ make install [PREFIX=<prefix>]

Usage

Start DNS server on port 55353.

$ launchdns -p 55353

Options

  • -s <name>, --socket=<name>

Name of key in Launchd Sockets dictionary to bind to. If name is set, the --port option is ignored.

  • -p <num>, --port=<num>

Port number to bind to. Defaults to 55353.

  • -t <num>, --timeout=<num>

Number of seconds to run for. Will run indefinitely by default.

  • -4 <addr>, --a=<addr>

IPv4 address for all A responses. Defaults to 127.0.0.1.

  • -6 <addr>, --aaaa=<addr>

IPv6 address for all AAAA responses. Defaults to ::1.

Launch Agent configuration

The most basic setup is running an agent that binds to the default port.

~/Library/LaunchAgents/com.github.josh.launchdns.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>com.github.josh.launchdns</string>
	<key>RunAtLoad</key>
	<true/>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/bin/launchdns</string>
	</array>
</dict>
</plist>

This will keep launchdns running on port 55353 anytime you log into your computer.

Though, the preferred way to configure the server is to run on demand.

~/Library/LaunchAgents/com.github.josh.launchdns.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>com.github.josh.launchdns</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/bin/launchdns</string>
		<string>--socket=Listeners</string>
		<string>--timeout=30</string>
	</array>
	<key>Sockets</key>
	<dict>
		<key>Listeners</key>
		<dict>
			<key>SockType</key>
			<string>dgram</string>
			<key>SockNodeName</key>
			<string>127.0.0.1</string>
			<key>SockServiceName</key>
			<string>55353</string>
		</dict>
	</dict>
</dict>
</plist>

Instead of the server being started at load, it will automatically start on demand when theres activity on 127.0.0.1:55353. And after 30 seconds, it will quit until it needs to be launched again. Note the --socket name matches the Listeners name of the Socket dictionary key.

Last, configure your system's resolver to use the nameserver for whatever TLDs you wish, for an example .localhost.

/etc/resolver/localhost

nameserver 127.0.0.1
port 55353

See Also

launchd(8), launchctl(1), launchd.plist(5), launch(3), resolver(5)

launchdns's People

Contributors

brntbeer avatar josh avatar mikemcquaid avatar

Watchers

 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.