Initial commit: Null DRM Official
Capture, decrypt, and restream toolkit with compiled-in app modules (RTE, TG4, BBC), on-device MITM proxy, streamd control plane, and www. BBC module.yaml is published (clear streams); other module values stay local.
This commit is contained in:
commit
2fa8f2435f
121 changed files with 17802 additions and 0 deletions
80
apps/modules/bbc/bbc_test.go
Normal file
80
apps/modules/bbc/bbc_test.go
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
package bbc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
appreg "drmdecryption/app"
|
||||
"drmdecryption/capture"
|
||||
"drmdecryption/modcfg"
|
||||
"drmdecryption/modules/provider"
|
||||
"drmdecryption/mpd"
|
||||
)
|
||||
|
||||
var (
|
||||
_ appreg.App = (*App)(nil)
|
||||
_ appreg.StreamDefaults = (*App)(nil)
|
||||
_ appreg.TransparentMITM = (*App)(nil)
|
||||
)
|
||||
|
||||
func testApp(t *testing.T) *App {
|
||||
t.Helper()
|
||||
cfg := Config{
|
||||
Channels: map[string]Channel{
|
||||
"bbcone": {Label: "BBC One", VPID: "bbc_one_london"},
|
||||
"bbctwo": {Label: "BBC Two", VPID: "bbc_two_england"},
|
||||
},
|
||||
Common: provider.Common{
|
||||
Package: "bbc.iplayer.android",
|
||||
Aliases: map[string]string{"one": "bbcone", "bbc1": "bbcone"},
|
||||
Score: capture.ScoreCfg{
|
||||
Hosts: []string{"open.live.bbc.co.uk", "vs-cmaf-push-uk"},
|
||||
},
|
||||
},
|
||||
}.withDefaults()
|
||||
labels := map[string]string{}
|
||||
for id, ch := range cfg.Channels {
|
||||
labels[id] = ch.Label
|
||||
}
|
||||
return &App{Base: provider.New(Name, cfg.Common, labels, modcfg.Result{Path: "test"}), cfg: cfg}
|
||||
}
|
||||
|
||||
func TestNoHardcodedSecrets(t *testing.T) {
|
||||
cfg := Config{}.withDefaults()
|
||||
if cfg.Package != "" || cfg.LicenseURL != "" {
|
||||
t.Fatalf("empty config must not invent package/license: %+v", cfg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestKeyModeNoneAndMPDOnly(t *testing.T) {
|
||||
a := testApp(t)
|
||||
if a.KeyMode() != "none" {
|
||||
t.Fatalf("KeyMode = %q, want none", a.KeyMode())
|
||||
}
|
||||
h := a.CaptureHints()
|
||||
if len(h.Require) != 1 || h.Require[0] != "mpd" {
|
||||
t.Fatalf("Require = %v, want [mpd]", h.Require)
|
||||
}
|
||||
if !a.UseTransparentMITM() {
|
||||
t.Fatal("BBC must use transparent MITM (UK VPN)")
|
||||
}
|
||||
if _, ok := a.MPDRewriter().(mpd.Passthrough); !ok {
|
||||
t.Fatal("expected Passthrough rewriter")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAliases(t *testing.T) {
|
||||
a := testApp(t)
|
||||
id, err := a.Resolve("one")
|
||||
if err != nil || id != "bbcone" {
|
||||
t.Fatalf("Resolve(one) = %q %v", id, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCaptureHintsScoreHosts(t *testing.T) {
|
||||
a := testApp(t)
|
||||
h := a.CaptureHints()
|
||||
u := "https://vs-cmaf-push-uk.live.fastly.md.bbci.co.uk/x/mobile.mpd"
|
||||
if h.Score.Score(u) <= 0 {
|
||||
t.Fatalf("expected positive score for %s (score=%d)", u, h.Score.Score(u))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue