Пример #1
0
// NewWeave returns a new Weave tagger based on the Weave router at
// address. The address should be an IP or FQDN, no port.
func NewWeave(hostID string, client weave.Client) *Weave {
	w := &Weave{
		client:  client,
		hostID:  hostID,
		psCache: map[string]weave.PSEntry{},
	}

	w.backoff = backoff.New(w.status, "collecting weave status")
	w.backoff.SetInitialBackoff(5 * time.Second)
	go w.backoff.Start()

	w.psBackoff = backoff.New(w.ps, "collecting weave ps")
	w.psBackoff.SetInitialBackoff(10 * time.Second)
	go w.psBackoff.Start()

	return w
}
Пример #2
0
// NewWeavePublisher makes a new Weave.
func NewWeavePublisher(weaveClient WeaveClient, dockerClient DockerClient, interfaces InterfaceFunc, hostname, containerName string) *WeavePublisher {
	w := &WeavePublisher{
		containerName: containerName,
		hostname:      hostname,
		dockerClient:  dockerClient,
		weaveClient:   weaveClient,
		interfaces:    interfaces,
	}
	w.backoff = backoff.New(w.updateDNS, "updating weaveDNS")
	go w.backoff.Start()
	return w
}