From 5e23185ddcbb6f7ecdfde05853a690040bb64b85 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Fri, 20 Apr 2018 08:41:09 -0400 Subject: [PATCH] use address only not port --- src/yggdrasil/tcp.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/yggdrasil/tcp.go b/src/yggdrasil/tcp.go index 23fa712d..563178f9 100644 --- a/src/yggdrasil/tcp.go +++ b/src/yggdrasil/tcp.go @@ -38,8 +38,8 @@ type tcpInterface struct { type tcpInfo struct { box boxPubKey sig sigPubKey - localAddr net.Addr - remoteAddr net.Addr + localAddr string + remoteAddr string } func (iface *tcpInterface) init(core *Core, addr string) (err error) { @@ -131,8 +131,8 @@ func (iface *tcpInterface) handler(sock net.Conn) { return } // Check if we already have a connection to this node, close and block if yes - info.localAddr = sock.LocalAddr() - info.remoteAddr = sock.RemoteAddr() + info.localAddr, _, _ = net.SplitHostPort(sock.LocalAddr().String()) + info.remoteAddr, _, _ = net.SplitHostPort(sock.RemoteAddr().String()) iface.mutex.Lock() if blockChan, isIn := iface.conns[info]; isIn { iface.mutex.Unlock() @@ -233,7 +233,7 @@ func (iface *tcpInterface) handler(sock net.Conn) { p.core.peers.mutex.Unlock() close(linkIn) }() - them := sock.RemoteAddr() + them, _, _ := net.SplitHostPort(sock.RemoteAddr().String()) themNodeID := getNodeID(&info.box) themAddr := address_addrForNodeID(themNodeID) themAddrString := net.IP(themAddr[:]).String()