nameserver

package
v0.0.0-...-9f00f78 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultListenAddress = "0.0.0.0:53"
	DefaultTTL           = 1
	DefaultClientTimeout = 5 * time.Second
)
View Source
const (

	// Used by prog/weaver/main.go and proxy/create_container_interceptor.go
	DefaultDomain = "weave.local."
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CaseInsensitive

type CaseInsensitive Entries

func (CaseInsensitive) Get

func (es CaseInsensitive) Get(i int) Entry

func (CaseInsensitive) Len

func (es CaseInsensitive) Len() int

... but we store entries in a case insensitive order.

func (CaseInsensitive) Less

func (es CaseInsensitive) Less(i, j int) bool

func (CaseInsensitive) Swap

func (es CaseInsensitive) Swap(i, j int)

type CaseSensitive

type CaseSensitive Entries

func (CaseSensitive) Get

func (es CaseSensitive) Get(i int) Entry

func (CaseSensitive) Len

func (es CaseSensitive) Len() int

Gossip messages are sorted in a case sensitive order...

func (CaseSensitive) Less

func (es CaseSensitive) Less(i, j int) bool

func (CaseSensitive) Swap

func (es CaseSensitive) Swap(i, j int)

type DNSServer

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

func NewDNSServer

func NewDNSServer(ns *Nameserver, domain, address string, upstream Upstream, ttl uint32, clientTimeout time.Duration) (*DNSServer, error)

func (*DNSServer) ActivateAndServe

func (d *DNSServer) ActivateAndServe()

func (*DNSServer) Stop

func (d *DNSServer) Stop() error

func (*DNSServer) String

func (d *DNSServer) String() string

type Entries

type Entries []Entry

type Entry

type Entry struct {
	ContainerID string
	Origin      mesh.PeerName
	Addr        address.Address
	Hostname    string // as supplied

	Version   int
	Tombstone int64 // timestamp of when it was deleted
	// contains filtered or unexported fields
}

func (*Entry) String

func (e1 *Entry) String() string

type EntryStatus

type EntryStatus struct {
	Hostname    string
	Origin      string
	ContainerID string
	Address     string
	Version     int
	Tombstone   int64
}

type GossipData

type GossipData struct {
	Timestamp int64
	Entries
}

func (*GossipData) Decode

func (g *GossipData) Decode(msg []byte) error

func (*GossipData) Encode

func (g *GossipData) Encode() [][]byte

func (*GossipData) Merge

type Nameserver

type Nameserver struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Nameserver: gossip-based, in memory nameserver. - Holds a sorted list of (hostname, peer, container id, ip) tuples for the whole cluster. - This list is gossiped & merged around the cluser. - Lookup-by-hostname are O(nlogn), and return a (copy of a) slice of the entries - Update is O(n) for now

func New

func New(ourName mesh.PeerName, domain string, isKnownPeer func(mesh.PeerName) bool) *Nameserver

func (*Nameserver) AddEntry

func (n *Nameserver) AddEntry(hostname, containerid string, origin mesh.PeerName, addr address.Address)

func (*Nameserver) AddEntryFQDN

func (n *Nameserver) AddEntryFQDN(fqdn, containerid string, origin mesh.PeerName, addr address.Address)

func (*Nameserver) ContainerDestroyed

func (n *Nameserver) ContainerDestroyed(ident string)

func (*Nameserver) ContainerDied

func (n *Nameserver) ContainerDied(ident string)

func (*Nameserver) ContainerStarted

func (n *Nameserver) ContainerStarted(ident string)

func (*Nameserver) Delete

func (n *Nameserver) Delete(hostname, containerid, ipStr string, ip address.Address)

func (*Nameserver) Gossip

func (n *Nameserver) Gossip() mesh.GossipData

func (*Nameserver) HandleHTTP

func (n *Nameserver) HandleHTTP(router *mux.Router, dockerCli *docker.Client)

func (*Nameserver) Lookup

func (n *Nameserver) Lookup(hostname string) []address.Address

func (*Nameserver) OnGossip

func (n *Nameserver) OnGossip(msg []byte) (mesh.GossipData, error)

merge received data into state and return "everything new I've just learnt", or nil if nothing in the received data was new

func (*Nameserver) OnGossipBroadcast

func (n *Nameserver) OnGossipBroadcast(_ mesh.PeerName, msg []byte) (mesh.GossipData, error)

merge received data into state and return a representation of the received data, for further propagation

func (*Nameserver) OnGossipUnicast

func (n *Nameserver) OnGossipUnicast(sender mesh.PeerName, msg []byte) error

func (*Nameserver) PeerGone

func (n *Nameserver) PeerGone(peer mesh.PeerName)

func (*Nameserver) ReverseLookup

func (n *Nameserver) ReverseLookup(ip address.Address) (string, error)

func (*Nameserver) SetGossip

func (n *Nameserver) SetGossip(gossip mesh.Gossip)

func (*Nameserver) Start

func (n *Nameserver) Start()

func (*Nameserver) Stop

func (n *Nameserver) Stop()

type SortableEntries

type SortableEntries interface {
	sort.Interface
	Get(i int) Entry
}

type Status

type Status struct {
	Domain   string
	Upstream []string
	Address  string
	TTL      uint32
	Entries  []EntryStatus
}

func NewStatus

func NewStatus(ns *Nameserver, dnsServer *DNSServer) *Status

type Upstream

type Upstream interface {
	Config() (*dns.ClientConfig, error)
}

func NewUpstream

func NewUpstream(resolvConf, filterAddress string) Upstream

Jump to

Keyboard shortcuts

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