nameserver

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2014 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxDuration = time.Duration(math.MaxInt64)
	MailboxSize = 16
)
View Source
const (
	CSendQuery       = iota
	CShutdown        = iota
	CMessageReceived = iota
)
View Source
const (
	LOCAL_DOMAIN = "weave.local."
	RDNS_DOMAIN  = "in-addr.arpa."
)

Variables

View Source
var (
	Debug   *log.Logger
	Info    *log.Logger
	Warning *log.Logger
	Error   *log.Logger
)

Functions

func InitLogging

func InitLogging(debugHandle io.Writer,
	infoHandle io.Writer,
	warningHandle io.Writer,
	errorHandle io.Writer)

func LinkLocalMulticastListener

func LinkLocalMulticastListener(ifi *net.Interface) (net.PacketConn, error)

func ListenHttp

func ListenHttp(domain string, db Zone, port int)

func StartServer

func StartServer(zone Zone, iface *net.Interface, dnsPort int, httpPort int, wait int) error

func StartUpdater

func StartUpdater(apiPath string, zone Zone) error

Types

type DuplicateError

type DuplicateError struct {
}

func (DuplicateError) Error

func (dup DuplicateError) Error() string

type LookupError

type LookupError string

func (LookupError) Error

func (ops LookupError) Error() string

type MDNSClient

type MDNSClient struct {
	// contains filtered or unexported fields
}

func NewMDNSClient

func NewMDNSClient() (*MDNSClient, error)

func (*MDNSClient) ResponseCallback

func (c *MDNSClient) ResponseCallback(r *dns.Msg)

Async - called from dns library multiplexer

func (*MDNSClient) SendQuery

func (c *MDNSClient) SendQuery(name string, querytype uint16, responseCh chan<- *ResponseA)

Async

func (*MDNSClient) Shutdown

func (c *MDNSClient) Shutdown()

Async

func (*MDNSClient) Start

func (c *MDNSClient) Start(ifi *net.Interface) error

type MDNSInteraction

type MDNSInteraction struct {
	// contains filtered or unexported fields
}

type MDNSServer

type MDNSServer struct {
	// contains filtered or unexported fields
}

func NewMDNSServer

func NewMDNSServer(zone Zone) (*MDNSServer, error)

func (*MDNSServer) Start

func (s *MDNSServer) Start(ifi *net.Interface) error

type Record

type Record struct {
	Ident string
	Name  string
	IP    net.IP
}

type ResponseA

type ResponseA struct {
	Name string
	Addr net.IP
	Err  error
}

type Zone

type Zone interface {
	AddRecord(ident string, name string, ip net.IP) error
	DeleteRecord(ident string, ip net.IP) error
	DeleteRecordsFor(ident string) error
	LookupLocal(name string) (net.IP, error)
	ReverseLookupLocal(ip net.IP) (string, error)
}

type ZoneDb

type ZoneDb struct {
	// contains filtered or unexported fields
}

Very simple data structure for now, with linear searching. TODO: make more sophisticated to improve performance.

func (*ZoneDb) AddRecord

func (zone *ZoneDb) AddRecord(ident string, name string, ip net.IP) error

func (*ZoneDb) DeleteRecord

func (zone *ZoneDb) DeleteRecord(ident string, ip net.IP) error

func (*ZoneDb) DeleteRecordsFor

func (zone *ZoneDb) DeleteRecordsFor(ident string) error

func (*ZoneDb) LookupLocal

func (zone *ZoneDb) LookupLocal(name string) (net.IP, error)

func (*ZoneDb) ReverseLookupLocal

func (zone *ZoneDb) ReverseLookupLocal(ip net.IP) (string, error)

Jump to

Keyboard shortcuts

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