Merge branch 'master' into 29_unknown_peer

This commit is contained in:
Bryan Boreham committed 2014-09-17 12:59:30 +01:00
commit a25ccbb261
12 files changed
+228 -108

No files matched your search

+11
View File
@@ -97,3 +97,14 @@ func (lop ListOfPeers) Swap(i, j int) {
func (lop ListOfPeers) Less(i, j int) bool {
return lop[i].Name < lop[i].Name
}
// given an address like '1.2.3.4:567', return the address if it has a port,
// otherwise return the address with weave's standard port number
func NormalisePeerAddr(peerAddr string) string {
_, _, err := net.SplitHostPort(peerAddr)
if err == nil {
return peerAddr
} else {
return fmt.Sprintf("%s:%d", peerAddr, Port)
}
}