mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-27 12:05:23 +00:00
use address only not port
This commit is contained in:
parent
3c4fee0492
commit
5e23185ddc
@ -38,8 +38,8 @@ type tcpInterface struct {
|
|||||||
type tcpInfo struct {
|
type tcpInfo struct {
|
||||||
box boxPubKey
|
box boxPubKey
|
||||||
sig sigPubKey
|
sig sigPubKey
|
||||||
localAddr net.Addr
|
localAddr string
|
||||||
remoteAddr net.Addr
|
remoteAddr string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (iface *tcpInterface) init(core *Core, addr string) (err error) {
|
func (iface *tcpInterface) init(core *Core, addr string) (err error) {
|
||||||
@ -131,8 +131,8 @@ func (iface *tcpInterface) handler(sock net.Conn) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Check if we already have a connection to this node, close and block if yes
|
// Check if we already have a connection to this node, close and block if yes
|
||||||
info.localAddr = sock.LocalAddr()
|
info.localAddr, _, _ = net.SplitHostPort(sock.LocalAddr().String())
|
||||||
info.remoteAddr = sock.RemoteAddr()
|
info.remoteAddr, _, _ = net.SplitHostPort(sock.RemoteAddr().String())
|
||||||
iface.mutex.Lock()
|
iface.mutex.Lock()
|
||||||
if blockChan, isIn := iface.conns[info]; isIn {
|
if blockChan, isIn := iface.conns[info]; isIn {
|
||||||
iface.mutex.Unlock()
|
iface.mutex.Unlock()
|
||||||
@ -233,7 +233,7 @@ func (iface *tcpInterface) handler(sock net.Conn) {
|
|||||||
p.core.peers.mutex.Unlock()
|
p.core.peers.mutex.Unlock()
|
||||||
close(linkIn)
|
close(linkIn)
|
||||||
}()
|
}()
|
||||||
them := sock.RemoteAddr()
|
them, _, _ := net.SplitHostPort(sock.RemoteAddr().String())
|
||||||
themNodeID := getNodeID(&info.box)
|
themNodeID := getNodeID(&info.box)
|
||||||
themAddr := address_addrForNodeID(themNodeID)
|
themAddr := address_addrForNodeID(themNodeID)
|
||||||
themAddrString := net.IP(themAddr[:]).String()
|
themAddrString := net.IP(themAddr[:]).String()
|
||||||
|
Loading…
Reference in New Issue
Block a user