Merge pull request #111 from zettio/93_fqdn_peers

permit peers to be specified by name - fixes #93
This commit is contained in:
Bryan Boreham committed 2014-10-10 12:43:58 +01:00
commit f79496ddcb
3 files changed
+17 -5

No files matched your search

+3 -2
View File
@@ -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;
+9 -2
View File
@@ -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
+5 -1
View File
@@ -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)