Files
qgo-server/internal/relay/relay.go
Smile Rex c2163436a4
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 2m1s
test relay server
2026-03-04 00:06:15 +03:00

32 lines
433 B
Go

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
}