mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-30 13:35:19 +00:00
Update tuntap module, return pointers
This commit is contained in:
parent
c107f891d2
commit
63936c11b5
@ -251,7 +251,8 @@ func (tun *TunAdapter) _wrap(conn *yggdrasil.Conn) (c *tunConn, err error) {
|
|||||||
}
|
}
|
||||||
c = &s
|
c = &s
|
||||||
// Get the remote address and subnet of the other side
|
// 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.addr = *address.AddrForNodeID(remoteNodeID)
|
||||||
s.snet = *address.SubnetForNodeID(remoteNodeID)
|
s.snet = *address.SubnetForNodeID(remoteNodeID)
|
||||||
// Work out if this is already a destination we already know about
|
// Work out if this is already a destination we already know about
|
||||||
|
@ -353,13 +353,13 @@ func (c *Conn) Close() (err error) {
|
|||||||
// LocalAddr returns the complete node ID of the local side of the connection.
|
// 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.
|
// This is always going to return your own node's node ID.
|
||||||
func (c *Conn) LocalAddr() net.Addr {
|
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.
|
// RemoteAddr returns the complete node ID of the remote side of the connection.
|
||||||
func (c *Conn) RemoteAddr() net.Addr {
|
func (c *Conn) RemoteAddr() net.Addr {
|
||||||
if c.session != nil {
|
if c.session != nil {
|
||||||
return c.session.theirPermPub
|
return &c.session.theirPermPub
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -41,5 +41,5 @@ func (l *Listener) Close() (err error) {
|
|||||||
|
|
||||||
// Addr returns the address of the listener
|
// Addr returns the address of the listener
|
||||||
func (l *Listener) Addr() net.Addr {
|
func (l *Listener) Addr() net.Addr {
|
||||||
return l.core.boxPub
|
return &l.core.boxPub
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user