weavedns

package
v0.0.0-...-5102045 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 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 EnsureInterface

func EnsureInterface(ifaceName string, wait int) (iface *net.Interface, err error)

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 {
	Name    string
	WeaveIP net.IP
	Ident   string
}

func (DuplicateError) Error

func (err 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) SendResponse

func (s *MDNSServer) SendResponse(m *dns.Msg) error

func (*MDNSServer) Start

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

type Record

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

type ResponseA

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

type Zone

type Zone interface {
	AddRecord(ident string, name string, localIP net.IP, weaveIP net.IP) error
	DeleteRecord(ident string, weaveIp net.IP) error
	DeleteRecordsFor(ident string) error
	MatchLocal(name string) (net.IP, error)
	MatchLocalIP(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, localIP net.IP, weaveIP net.IP) error

func (*ZoneDb) DeleteRecord

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

func (*ZoneDb) DeleteRecordsFor

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

func (*ZoneDb) MatchLocal

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

func (*ZoneDb) MatchLocalIP

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

Jump to

Keyboard shortcuts

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