From 63936c11b500bb06285980591aeba590f86661d6 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 16 Feb 2020 23:21:58 +0000 Subject: [PATCH] Update tuntap module, return pointers --- src/tuntap/tun.go | 3 ++- src/yggdrasil/conn.go | 4 ++-- src/yggdrasil/listener.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tuntap/tun.go b/src/tuntap/tun.go index 53a17466..656ecca7 100644 --- a/src/tuntap/tun.go +++ b/src/tuntap/tun.go @@ -251,7 +251,8 @@ func (tun *TunAdapter) _wrap(conn *yggdrasil.Conn) (c *tunConn, err error) { } c = &s // Get the remote address and subnet of the other side - remoteNodeID := conn.RemoteAddr().(*crypto.NodeID) + remotePubKey := conn.RemoteAddr().(*crypto.BoxPubKey) + remoteNodeID := crypto.GetNodeID(remotePubKey) s.addr = *address.AddrForNodeID(remoteNodeID) s.snet = *address.SubnetForNodeID(remoteNodeID) // Work out if this is already a destination we already know about diff --git a/src/yggdrasil/conn.go b/src/yggdrasil/conn.go index 078dca35..d18f196d 100644 --- a/src/yggdrasil/conn.go +++ b/src/yggdrasil/conn.go @@ -353,13 +353,13 @@ func (c *Conn) Close() (err error) { // LocalAddr returns the complete node ID of the local side of the connection. // This is always going to return your own node's node ID. func (c *Conn) LocalAddr() net.Addr { - return c.core.boxPub + return &c.core.boxPub } // RemoteAddr returns the complete node ID of the remote side of the connection. func (c *Conn) RemoteAddr() net.Addr { if c.session != nil { - return c.session.theirPermPub + return &c.session.theirPermPub } return nil } diff --git a/src/yggdrasil/listener.go b/src/yggdrasil/listener.go index 1b908b42..74ef3e88 100644 --- a/src/yggdrasil/listener.go +++ b/src/yggdrasil/listener.go @@ -41,5 +41,5 @@ func (l *Listener) Close() (err error) { // Addr returns the address of the listener func (l *Listener) Addr() net.Addr { - return l.core.boxPub + return &l.core.boxPub }