5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-09-20 00:12:33 +00:00

Update tuntap module, return pointers

This commit is contained in:
Neil Alexander 2020-02-16 23:21:58 +00:00
parent c107f891d2
commit 63936c11b5
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944
3 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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
}