diff --git a/README.md b/README.md index 64e6db41..18f3c38c 100644 --- a/README.md +++ b/README.md @@ -85,8 +85,9 @@ We repeat similar steps on $HOST2... The only difference, apart from the choice of IP addresses for the weave router and the application container, is that we tell our weave that it should peer with the weave on $HOST1 (specified as the IP -address by which $HOST2 can reach it). NB: if there is a firewall -between $HOST1 and $HOST2, you must open port 6783 for TCP and UDP. +address or hostname by which $HOST2 can reach it). NB: if there is a +firewall between $HOST1 and $HOST2, you must open port 6783 for TCP +and UDP. Note that we could instead have told the weave on $HOST1 to connect to $HOST2, or told both about each other. Order does not matter here; diff --git a/weaver/Makefile b/weaver/Makefile index 772730c7..e5b53486 100644 --- a/weaver/Makefile +++ b/weaver/Makefile @@ -6,8 +6,15 @@ SUDO=sudo all: docker-image weaver: ../*.go main.go - go get - go build -ldflags '-extldflags "-static"' + go get -tags netgo + go build -ldflags '-extldflags "-static"' -tags netgo + @strings $@ | grep cgo_stub\\\.go >/dev/null || { \ + rm $@; \ + echo "\nYour go standard library was built without the 'netgo' build tag."; \ + echo "To fix that, run"; \ + echo " sudo go install -a -tags netgo std"; \ + false; \ + } .PHONY: docker-image docker-image: /var/tmp/weave.tar diff --git a/weaver/main.go b/weaver/main.go index 3ca078db..1f351255 100644 --- a/weaver/main.go +++ b/weaver/main.go @@ -127,7 +127,11 @@ func main() { router := weave.NewRouter(iface, ourName, []byte(password), connLimit, bufSz*1024*1024, logFrame) router.Start() for _, peer := range peers { - router.ConnectionMaker.InitiateConnection(peer) + if addr, err := net.ResolveTCPAddr("tcp4", weave.NormalisePeerAddr(peer)); err == nil { + router.ConnectionMaker.InitiateConnection(addr.String()) + } else { + log.Fatal(err) + } } go handleHttp(router) handleSignals(router)