test relay server
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 2m1s

This commit is contained in:
Smile Rex
2026-03-04 00:06:15 +03:00
parent e19ba4243c
commit c2163436a4
5 changed files with 119 additions and 10 deletions

31
internal/relay/relay.go Normal file
View File

@@ -0,0 +1,31 @@
package relay
import (
"sync"
"github.com/okdaichi/gomoqt/moqt"
)
type Relay struct {
mu sync.RWMutex
rooms map[string]*moqt.TrackMux
}
func New() *Relay {
return &Relay{
rooms: make(map[string]*moqt.TrackMux),
}
}
func (r *Relay) GetMux(room string) *moqt.TrackMux {
r.mu.Lock()
defer r.mu.Unlock()
if mux, ok := r.rooms[room]; ok {
return mux
}
mux := moqt.NewTrackMux()
r.rooms[room] = mux
return mux
}