added theConnDesc message to the grpc protocol

This commit is contained in:
2025-02-20 00:59:00 +09:00
parent 1c49023c37
commit c7b7bfd25f
8 changed files with 240 additions and 120 deletions

View File

@ -128,6 +128,7 @@ type ServerConn struct {
S *Server
Id ConnId
Sid string // for logging
Token string // provided by client
RemoteAddr net.Addr // client address that created this structure
LocalAddr net.Addr // local address that the client is connected to
@ -744,6 +745,16 @@ func (cts *ServerConn) receive_from_stream(wg *sync.WaitGroup) {
cts.S.log.Write(cts.Sid, LOG_ERROR, "Invalid peer_data event from %s", cts.RemoteAddr)
}
case PACKET_KIND_CONN_DESC:
var x *Packet_Conn
var ok bool
x, ok = pkt.U.(*Packet_Conn)
if ok {
cts.Token = x.Conn.Token
} else {
cts.S.log.Write(cts.Sid, LOG_ERROR, "Invalid conn_desc event from %s", cts.RemoteAddr)
}
case PACKET_KIND_CONN_NOTICE:
// the connection from the client to a peer has been established
var x *Packet_Notice