diff --git a/src/client.go b/src/client.go index e0db03ae..819fc12f 100644 --- a/src/client.go +++ b/src/client.go @@ -203,6 +203,7 @@ func (c *Croc) processState(cd channelData) (err error) { // copy over the rest of the state c.cs.channel.Ports = cd.Ports c.cs.channel.EncryptedFileMetaData = cd.EncryptedFileMetaData + c.cs.channel.Addresses = cd.Addresses // update the Pake if cd.Pake != nil && cd.Pake.Role != c.cs.channel.Role { diff --git a/src/models.go b/src/models.go index 83c8ee86..42775c95 100644 --- a/src/models.go +++ b/src/models.go @@ -128,6 +128,8 @@ type channelData struct { ReadyToRead bool `json:"ready_to_read"` // Error is sent if there is an error Error string `json:"error"` + // Addresses of the sender and recipient, as determined by the relay + Addresses [2]string `json:"addresses"` // Sent on initialization, specific to a single user // UUID is sent out only to one person at a time diff --git a/src/server.go b/src/server.go index f0ab41d8..bbacc62e 100644 --- a/src/server.go +++ b/src/server.go @@ -149,6 +149,8 @@ func (c *Croc) joinChannel(ws *websocket.Conn, cd channelData) (channel string, c.rs.channel[cd.Channel].Curve = "p256" } c.rs.channel[cd.Channel].websocketConn[cd.Role] = ws + // assign the name + c.rs.channel[cd.Channel].Addresses[cd.Role] = ws.RemoteAddr().String() log.Debugf("assigned role %d in channel '%s'", cd.Role, cd.Channel) return