Skip to content
Snippets Groups Projects
Commit 95f67bf7 authored by Richer Maximilien's avatar Richer Maximilien
Browse files

[c][p] Add ip as seen by platform

parent 7a912bbd
No related branches found
No related tags found
1 merge request!73[c][p] Local ip probing for clients
......@@ -156,7 +156,6 @@ func (m *SignatureManager) addPeer(user *pAPI.User) (ready bool, err error) {
// This is an certificate authentificated TLS connection
conn, err = net.Connect(addrPort, m.auth.Cert, m.auth.Key, m.auth.CA, user.KeyHash)
if err == nil {
break
}
}
......
package contract
import (
n "net"
"time"
"dfss/auth"
......@@ -20,7 +21,7 @@ import (
// There is no timeout, this function will shut down on stream disconnection or on error.
func JoinSignature(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, in *api.JoinSignatureRequest, stream api.Platform_JoinSignatureServer) {
ctx := stream.Context()
state, _, _ := net.GetTLSState(&ctx)
state, addr, _ := net.GetTLSState(&ctx)
hash := auth.GetCertificateHash(state.VerifiedChains[0][0])
if !checkJoinSignatureRequest(db, &stream, in.ContractUuid, hash) {
......@@ -41,10 +42,11 @@ func JoinSignature(db *mgdb.MongoManager, rooms *common.WaitingGroupMap, in *api
}
// Broadcast self identity
host, _, _ := n.SplitHostPort(addr.String())
rooms.Broadcast(roomID, &api.User{
KeyHash: hash,
Email: net.GetCN(&ctx),
Ip: in.Ip,
Ip: append(in.Ip, host),
Port: in.Port,
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment