Commit 95f67bf7 authored by Richer Maximilien's avatar Richer Maximilien

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

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