Implement pubkeys in API functions

This commit is contained in:
Neil Alexander 2020-02-16 23:09:24 +00:00
parent a101fc0556
commit c107f891d2
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
4 changed files with 49 additions and 11 deletions

View file

@ -353,13 +353,15 @@ 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 crypto.GetNodeID(&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 {
// RemoteAddr is set during the dial or accept, and isn't changed, so it's safe to access directly
return c.nodeID
if c.session != nil {
return c.session.theirPermPub
}
return nil
}
// SetDeadline is equivalent to calling both SetReadDeadline and