Circuit Self-managed infrastructure, programmatic monitoring and orchestration

Example: Make a DNS server element

Circuit allows you to create and dynamically configure one or more DNS server elements on any circuit server.

As before, pick an available circuit server, say X88550014d4c82e4d. Create a new DNS server element, like so

	circuit mkdns /X88550014d4c82e4d/mydns

This will start a new DNS server on the host of the given circuit server, binding it to an available port. Alternatively, you can supply an IP address argument specifying the bind address, as in

	circuit mkdns /X88550014d4c82e4d/mydns 127.0.0.1:7711

Either way, you can always retrieve the address on which the DNS server is listening by peeking into the corresponding circuit element:

	circuit peek /X88550014d4c82e4d/mydns

This command will produce an output similar to this

	{
	    "Address": "127.0.0.1:7711",
	    "Records": {}
	}

Once the DNS server element has been created, you can add resource records to it, one at a time, using

	circuit set /X88550014d4c82e4d/mydns "miek.nl. 3600 IN MX 10 mx.miek.nl."

Resource records use the canonical syntax, described in various RFCs. You can find a list of such RFCs as well as examples in the DNS Go library that underlies our implementation: github.com/miekg/dns/dns.go

All records, associated with a given name can be removed with a single command:

	circuit unset /X88550014d4c82e4d/mydns miek.nl.

The current set of active records can be retrieved by peeking into the element:

	circuit peek /X88550014d4c82e4d/mydns

Assuming that a name has multiple records associated with it, peeking would produce an output similar to this one:

	{
		"Address": "127.0.0.1:7711",
		"Records": {
			"miek.nl.": [
				"miek.nl.\t3600\tIN\tMX\t10 mx.miek.nl.",
				"miek.nl.\t3600\tIN\tMX\t20 mx2.miek.nl."
			]
		}
	}