Revert "Move a couple of commmon bits of code out to utils.go"

This reverts commit c1856e1ff1.
This commit is contained in:
Bryan Boreham committed 2014-09-09 13:07:55 +01:00
1 parent c1856e1ff1
commit dc927314ba
3 files changed
+22 -23

No files matched your search

-19
View File
@@ -97,22 +97,3 @@ func (lop ListOfPeers) Swap(i, j int) {
func (lop ListOfPeers) Less(i, j int) bool {
return lop[i].Name < lop[i].Name
}
func StripPortFromAddr(address string) string {
// If we've been given a port number, take it off
if addrHost, _, err := net.SplitHostPort(address); err == nil {
return addrHost
}
return address
}
// 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)
}
}