Add dns support for the proxy

In the proxy, I swapped the 'flag' library for
'code.google.com/p/getopt', which uses double-dash flags.

proxy lets 'weave attach' do dns registration on container start

proxy needs to set DNSSearch if not specified
This commit is contained in:
Paul Bellamy committed 2015-05-19 10:34:45 +01:00
1 parent 444b1482fa
commit 96a69d2303
11 files changed
+229 -102

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
package proxy
import (
"os/exec"
"strings"
"github.com/fsouza/go-dockerclient"
. "github.com/weaveworks/weave/common"
)
func callWeave(args ...string) ([]byte, error) {
args = append([]string{"--local"}, args...)
Debug.Print("Calling weave", args)
cmd := exec.Command("./weave", args...)
cmd.Env = []string{"PROCFS=/hostproc", "PATH=/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}
out, err := cmd.CombinedOutput()
return out, err
}
func weaveCIDRsFromConfig(config *docker.Config) ([]string, bool) {
for _, e := range config.Env {
if strings.HasPrefix(e, "WEAVE_CIDR=") {
result := strings.Trim(e[11:], " ")
return strings.Split(strings.TrimSpace(result), " "), result != ""
}
}
return nil, false
}