new weave status, weave status ..., and weave report

This commit is contained in:
Adam Harrison authored and Matthias Radestock committed 2015-08-11 12:15:13 +01:00
1 parent 00ecff09f7
commit fc9a1c8664
27 files changed
+784 -493

No files matched your search

-17
View File
@@ -185,23 +185,6 @@ func (n *Nameserver) deleteTombstones() {
})
}
func (n *Nameserver) String() string {
n.RLock()
defer n.RUnlock()
var buf bytes.Buffer
for _, entry := range n.entries {
if entry.Tombstone > 0 {
continue
}
containerid := entry.ContainerID
if len(containerid) > 12 {
containerid = containerid[:12]
}
fmt.Fprintf(&buf, "%s: %s [%s]\n", containerid, entry.Hostname, entry.Addr.String())
}
return buf.String()
}
func (n *Nameserver) Gossip() router.GossipData {
n.RLock()
defer n.RUnlock()
+43
View File
@@ -0,0 +1,43 @@
package nameserver
type Status struct {
Domain string
Address string
TTL uint32
Entries []EntryStatus
}
type EntryStatus struct {
Hostname string
Origin string
ContainerID string
Address string
Version int
Tombstone int64
}
func NewStatus(ns *Nameserver, dnsServer *DNSServer) *Status {
if dnsServer == nil {
return nil
}
ns.RLock()
defer ns.RUnlock()
var entryStatusSlice []EntryStatus
for _, entry := range ns.entries {
entryStatusSlice = append(entryStatusSlice, EntryStatus{
entry.Hostname,
entry.Origin.String(),
entry.ContainerID,
entry.Addr.String(),
entry.Version,
entry.Tombstone})
}
return &Status{
dnsServer.domain,
dnsServer.address,
dnsServer.ttl,
entryStatusSlice}
}