···189189 if err != nil {
190190 return n, fmt.Errorf("Error joining: %v\n", err)
191191 }
192192- // TODO: when joining fails, we don't get an error here - serf & memberlist
193193- // just print to stdout and serf.Join returns without issue.
194192 return n, err
195193}
196194
+1-1
agent/config.go
···66)
7788const DefaultBindPort int = 4443
99-const DefaultClientPort int = 4443
99+const DefaultClientPort int = 4444
10101111func DefaultConfig() *Config {
1212 hostname, err := os.Hostname()
+34
ipaddr/ipaddr.go
···11+package ipaddr
22+33+import (
44+ "log"
55+ "net"
66+ "strconv"
77+ "strings"
88+)
99+1010+// resolveHost will take a single host string and convert it to a list of TCPAddrs
1111+// This will process any port in the input as well as looking up the hostname using
1212+// normal DNS resolution.
1313+func ParseIPPort(IPPort string) *net.TCPAddr {
1414+ var addr net.TCPAddr
1515+ ip, portStr, err := net.SplitHostPort(IPPort)
1616+ if err != nil {
1717+ if strings.Contains(err.Error(), "missing port in address") {
1818+ ip = IPPort
1919+ } else {
2020+ log.Printf("error splitting ip+port '%s' into IP and port: %s\n", IPPort, err)
2121+ return &addr
2222+ }
2323+ } else {
2424+ addr.Port, err = strconv.Atoi(portStr)
2525+ if err != nil {
2626+ log.Printf("Parsed port '%s' is not an integer: %s\n", portStr, err)
2727+ return &addr
2828+ }
2929+ }
3030+3131+ addr.IP = net.ParseIP(ip)
3232+3333+ return &addr
3434+}