use signal dispatcher + refactor

This commit is contained in:
Pascal Fischer
2024-08-01 18:27:32 +02:00
parent 9d2047a08a
commit 2ddccdbf73
4 changed files with 121 additions and 81 deletions

View File

@@ -18,16 +18,20 @@ type Peer struct {
StreamID int64
//a gRpc connection stream to the Peer
// a gRpc connection stream to the Peer
Stream proto.SignalExchange_ConnectStreamServer
// registration time
RegisteredAt time.Time
}
// NewPeer creates a new instance of a connected Peer
func NewPeer(id string, stream proto.SignalExchange_ConnectStreamServer) *Peer {
return &Peer{
Id: id,
Stream: stream,
StreamID: time.Now().UnixNano(),
Id: id,
Stream: stream,
StreamID: time.Now().UnixNano(),
RegisteredAt: time.Now(),
}
}