* ingress: add opt-in support for udp:// URL pull ingress URL pull ingress previously accepted only http, https and srt source URLs. Add udp:// as an accepted scheme, gated behind a new `ingress.enable_udp_url_pull` config option that defaults to false, so unauthenticated UDP sources are not reachable unless the operator opts in. Also add a counterfeiter fake for IngressLauncher and a test covering the scheme validation matrix. The ingress handler binds a local socket on the caller supplied address and port instead of connecting out like the http and srt sources do. Spell out what that means for operators in both the config field doc comment and config-sample.yaml: caller controlled local port binding, unauthenticated and spoofable input, and multicast relaying of traffic on the handler's local network. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
119 lines
3.8 KiB
Go
119 lines
3.8 KiB
Go
// Code generated by counterfeiter. DO NOT EDIT.
|
|
package servicefakes
|
|
|
|
import (
|
|
"context"
|
|
"sync"
|
|
|
|
"github.com/livekit/livekit-server/pkg/service"
|
|
"github.com/livekit/protocol/livekit"
|
|
)
|
|
|
|
type FakeIngressLauncher struct {
|
|
LaunchPullIngressStub func(context.Context, *livekit.IngressInfo) (*livekit.IngressInfo, error)
|
|
launchPullIngressMutex sync.RWMutex
|
|
launchPullIngressArgsForCall []struct {
|
|
arg1 context.Context
|
|
arg2 *livekit.IngressInfo
|
|
}
|
|
launchPullIngressReturns struct {
|
|
result1 *livekit.IngressInfo
|
|
result2 error
|
|
}
|
|
launchPullIngressReturnsOnCall map[int]struct {
|
|
result1 *livekit.IngressInfo
|
|
result2 error
|
|
}
|
|
invocations map[string][][]interface{}
|
|
invocationsMutex sync.RWMutex
|
|
}
|
|
|
|
func (fake *FakeIngressLauncher) LaunchPullIngress(arg1 context.Context, arg2 *livekit.IngressInfo) (*livekit.IngressInfo, error) {
|
|
fake.launchPullIngressMutex.Lock()
|
|
ret, specificReturn := fake.launchPullIngressReturnsOnCall[len(fake.launchPullIngressArgsForCall)]
|
|
fake.launchPullIngressArgsForCall = append(fake.launchPullIngressArgsForCall, struct {
|
|
arg1 context.Context
|
|
arg2 *livekit.IngressInfo
|
|
}{arg1, arg2})
|
|
stub := fake.LaunchPullIngressStub
|
|
fakeReturns := fake.launchPullIngressReturns
|
|
fake.recordInvocation("LaunchPullIngress", []interface{}{arg1, arg2})
|
|
fake.launchPullIngressMutex.Unlock()
|
|
if stub != nil {
|
|
return stub(arg1, arg2)
|
|
}
|
|
if specificReturn {
|
|
return ret.result1, ret.result2
|
|
}
|
|
return fakeReturns.result1, fakeReturns.result2
|
|
}
|
|
|
|
func (fake *FakeIngressLauncher) LaunchPullIngressCallCount() int {
|
|
fake.launchPullIngressMutex.RLock()
|
|
defer fake.launchPullIngressMutex.RUnlock()
|
|
return len(fake.launchPullIngressArgsForCall)
|
|
}
|
|
|
|
func (fake *FakeIngressLauncher) LaunchPullIngressCalls(stub func(context.Context, *livekit.IngressInfo) (*livekit.IngressInfo, error)) {
|
|
fake.launchPullIngressMutex.Lock()
|
|
defer fake.launchPullIngressMutex.Unlock()
|
|
fake.LaunchPullIngressStub = stub
|
|
}
|
|
|
|
func (fake *FakeIngressLauncher) LaunchPullIngressArgsForCall(i int) (context.Context, *livekit.IngressInfo) {
|
|
fake.launchPullIngressMutex.RLock()
|
|
defer fake.launchPullIngressMutex.RUnlock()
|
|
argsForCall := fake.launchPullIngressArgsForCall[i]
|
|
return argsForCall.arg1, argsForCall.arg2
|
|
}
|
|
|
|
func (fake *FakeIngressLauncher) LaunchPullIngressReturns(result1 *livekit.IngressInfo, result2 error) {
|
|
fake.launchPullIngressMutex.Lock()
|
|
defer fake.launchPullIngressMutex.Unlock()
|
|
fake.LaunchPullIngressStub = nil
|
|
fake.launchPullIngressReturns = struct {
|
|
result1 *livekit.IngressInfo
|
|
result2 error
|
|
}{result1, result2}
|
|
}
|
|
|
|
func (fake *FakeIngressLauncher) LaunchPullIngressReturnsOnCall(i int, result1 *livekit.IngressInfo, result2 error) {
|
|
fake.launchPullIngressMutex.Lock()
|
|
defer fake.launchPullIngressMutex.Unlock()
|
|
fake.LaunchPullIngressStub = nil
|
|
if fake.launchPullIngressReturnsOnCall == nil {
|
|
fake.launchPullIngressReturnsOnCall = make(map[int]struct {
|
|
result1 *livekit.IngressInfo
|
|
result2 error
|
|
})
|
|
}
|
|
fake.launchPullIngressReturnsOnCall[i] = struct {
|
|
result1 *livekit.IngressInfo
|
|
result2 error
|
|
}{result1, result2}
|
|
}
|
|
|
|
func (fake *FakeIngressLauncher) Invocations() map[string][][]interface{} {
|
|
fake.invocationsMutex.RLock()
|
|
defer fake.invocationsMutex.RUnlock()
|
|
copiedInvocations := map[string][][]interface{}{}
|
|
for key, value := range fake.invocations {
|
|
copiedInvocations[key] = value
|
|
}
|
|
return copiedInvocations
|
|
}
|
|
|
|
func (fake *FakeIngressLauncher) recordInvocation(key string, args []interface{}) {
|
|
fake.invocationsMutex.Lock()
|
|
defer fake.invocationsMutex.Unlock()
|
|
if fake.invocations == nil {
|
|
fake.invocations = map[string][][]interface{}{}
|
|
}
|
|
if fake.invocations[key] == nil {
|
|
fake.invocations[key] = [][]interface{}{}
|
|
}
|
|
fake.invocations[key] = append(fake.invocations[key], args)
|
|
}
|
|
|
|
var _ service.IngressLauncher = new(FakeIngressLauncher)
|