Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add GossiperMaker, GetGossip(), and UTs #119

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
properly support ipv6
  • Loading branch information
britterm-cisco committed Mar 27, 2020
commit 1dc4b1037ee0c9eb1f5972e3969f603e31ed963d
5 changes: 3 additions & 2 deletions connection_maker.go
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import (
"fmt"
"math/rand"
"net"
"strconv"
"time"
"unicode"
)
@@ -93,7 +94,7 @@ func (cm *connectionMaker) InitiateConnections(peers []string, replace bool) []e
}
if host == "" || !isAlnum(port) {
errors = append(errors, fmt.Errorf("invalid peer name %q, should be host[:port]", peer))
} else if addr, err := net.ResolveTCPAddr("tcp", fmt.Sprintf("%s:%s", host, port)); err != nil {
} else if addr, err := net.ResolveTCPAddr("tcp", net.JoinHostPort(host, port)); err != nil {
errors = append(errors, err)
} else {
addrs[peer] = addr
@@ -331,7 +332,7 @@ func (cm *connectionMaker) addPeerTargets(ourConnectedPeers peerNameSet, addTarg
// ephemeral) remote port of an inbound connection
// that some peer has. Let's try to connect on the
// weave port instead.
addTarget(fmt.Sprintf("%s:%d", ip, cm.port))
addTarget(net.JoinHostPort(ip, strconv.Itoa(cm.port)))
}
}
})