helixdns

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2014 License: MIT Imports: 8 Imported by: 0

README

HelixDNS

Build Status

A simple dns server to read records from etcd. See this blog post for more information.

Build Instructions

go get github.com/mrwilson/helixdns
make install

Uses

hdns
  -port=<port-to-run-on>
  -etcd-address=<address-of-etcd-instance>
  -forward=<address-of-forwarding-nameserver>

SRV Records

SRV records have multiple pieces of information to serve, so the values stored in etcd under /helix/com/example/_<protocol>/_<service>/SRV should be in the form of a list of JSON objects, as below.

[
  {"Priority":10,"Weight":60,"Port":5060,"Target":"bigbox.example.com."},
  {"Priority":10,"Weight":20,"Port":5060,"Target":"smallbox1.example.com."},
  {"Priority":10,"Weight":10,"Port":5060,"Target":"smallbox2.example.com."},
  {"Priority":10,"Weight":10,"Port":5066,"Target":"smallbox2.example.com."},
  {"Priority":20,"Weight":0, "Port":5060,"Target":"backupbox.example.com."}
]

TODO

  • Other types of record that aren't A, AAAA, CNAME, PTR, or SRV.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Get(path string) (Response, error)
	WatchForChanges()
}

func NewEtcdClient

func NewEtcdClient(instanceUrl string) Client

type DNSClient

type DNSClient interface {
	Lookup(*dns.Msg) (*dns.Msg, error)
	GetAddress() string
}

type EtcdClient

type EtcdClient struct {
	InstanceUrl string
	Client      *etcd.Client
}

func (EtcdClient) Get

func (c EtcdClient) Get(path string) (Response, error)

func (EtcdClient) WatchForChanges

func (c EtcdClient) WatchForChanges()

type EtcdResponse

type EtcdResponse struct {
	Response *etcd.Response
}

func (EtcdResponse) Value

func (r EtcdResponse) Value() string

type ForwardingDNSClient

type ForwardingDNSClient struct {
	Address string
}

func (ForwardingDNSClient) GetAddress

func (c ForwardingDNSClient) GetAddress() string

func (ForwardingDNSClient) Lookup

func (c ForwardingDNSClient) Lookup(req *dns.Msg) (*dns.Msg, error)

type HelixServer

type HelixServer struct {
	Port      int
	Client    Client
	DNSClient DNSClient
}

func ForwardingServer

func ForwardingServer(port int, etcdurl, dnsServerUrl string) *HelixServer

func Server

func Server(port int, etcdurl string) *HelixServer

func (HelixServer) Handler

func (s HelixServer) Handler(w dns.ResponseWriter, req *dns.Msg)

func (HelixServer) Start

func (s HelixServer) Start()

type Response

type Response interface {
	Value() string
}

type SrvRecord

type SrvRecord struct {
	Priority uint16
	Weight   uint16
	Port     uint16
	Target   string
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL