MCPcopy Index your code
hub / github.com/livekit/livekit / createMultiNodeServer

Function createMultiNodeServer

test/integration_helpers.go:197–227  ·  view source on GitHub ↗
(nodeID string, port uint32, configUpdater func(*config.Config))

Source from the content-addressed store, hash-verified

195}
196
197func createMultiNodeServer(nodeID string, port uint32, configUpdater func(*config.Config)) *service.LivekitServer {
198 var err error
199 conf, err := config.NewConfig("", true, nil, nil)
200 if err != nil {
201 panic(fmt.Sprintf("could not create config: %v", err))
202 }
203 conf.Port = port
204 conf.RTC.UDPPort = rtcconfig.PortRange{Start: int(port) + 1}
205 conf.RTC.TCPPort = port + 2
206 conf.Redis.Address = "localhost:6379"
207 conf.Keys = map[string]string{testApiKey: testApiSecret}
208 conf.EnableDataTracks = true
209 if configUpdater != nil {
210 configUpdater(conf)
211 }
212
213 currentNode, err := routing.NewLocalNode(conf)
214 if err != nil {
215 panic(err)
216 }
217 currentNode.SetNodeID(livekit.NodeID(nodeID))
218
219 // redis routing and store
220 s, err := service.InitializeServer(conf, currentNode)
221 if err != nil {
222 panic(fmt.Sprintf("could not create server: %v", err))
223 }
224
225 roomClient = livekit.NewRoomServiceJSONClient(fmt.Sprintf("http://localhost:%d", port), &http.Client{})
226 return s
227}
228
229type testRTCServicePath int
230

Callers 1

Calls 5

SetNodeIDMethod · 0.95
NewConfigFunction · 0.92
NewLocalNodeFunction · 0.92
InitializeServerFunction · 0.92
NodeIDMethod · 0.65

Tested by

no test coverage detected