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
10
apps/modules/all/all.go
Normal file
10
apps/modules/all/all.go
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// Package all links every app module into the binary. Importing it for side
|
||||
// effects is what makes `--app <name>` work; adding a provider means adding one
|
||||
// line here.
|
||||
package all
|
||||
|
||||
import (
|
||||
_ "drmdecryption/modules/bbc"
|
||||
_ "drmdecryption/modules/rte"
|
||||
_ "drmdecryption/modules/tg4"
|
||||
)
|
||||
72
apps/modules/all/all_test.go
Normal file
72
apps/modules/all/all_test.go
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
package all
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"testing"
|
||||
|
||||
appreg "drmdecryption/app"
|
||||
)
|
||||
|
||||
// Every module must be constructible with no module.yaml present — a fresh clone
|
||||
// has none, and the binary still has to start and list its providers.
|
||||
func TestAllModulesRegisterAndConstruct(t *testing.T) {
|
||||
names := appreg.Names()
|
||||
if len(names) == 0 {
|
||||
t.Fatal("no app modules registered — check the blank imports in all.go")
|
||||
}
|
||||
for _, n := range names {
|
||||
a, err := appreg.Get(n)
|
||||
if err != nil {
|
||||
t.Fatalf("construct %s: %v", n, err)
|
||||
}
|
||||
if a.Name() != n {
|
||||
t.Errorf("%s: Name() = %q", n, a.Name())
|
||||
}
|
||||
switch a.KeyMode() {
|
||||
case "raw", "modulardrm", "none":
|
||||
default:
|
||||
t.Errorf("%s: KeyMode() = %q, want raw, modulardrm, or none", n, a.KeyMode())
|
||||
}
|
||||
if a.CAHash() == "" {
|
||||
t.Errorf("%s: CAHash() empty", n)
|
||||
}
|
||||
if a.ProxyBin() == "" {
|
||||
t.Errorf("%s: ProxyBin() empty", n)
|
||||
}
|
||||
if a.MPDRewriter() == nil {
|
||||
t.Errorf("%s: MPDRewriter() nil", n)
|
||||
}
|
||||
if a.CaptureHints().RemoteLog == "" {
|
||||
t.Errorf("%s: CaptureHints has no remote log", n)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Flag binding must not construct any app, so overrides land before config load.
|
||||
func TestBindFlagsRegistersOverrides(t *testing.T) {
|
||||
fs := flag.NewFlagSet("test", flag.ContinueOnError)
|
||||
appreg.BindFlags(fs)
|
||||
count := 0
|
||||
fs.VisitAll(func(*flag.Flag) { count++ })
|
||||
if count == 0 {
|
||||
t.Fatal("no module override flags registered")
|
||||
}
|
||||
}
|
||||
|
||||
// A module declaring a rewriter must have registered it under that name.
|
||||
func TestDeclaredRewritersAreRegistered(t *testing.T) {
|
||||
for _, a := range appreg.All() {
|
||||
sd, ok := a.(appreg.StreamDefaults)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
name := sd.RewriterName()
|
||||
if name == "" || name == "none" {
|
||||
continue
|
||||
}
|
||||
if a.MPDRewriter().Name() != name {
|
||||
t.Errorf("%s: RewriterName()=%q but MPDRewriter().Name()=%q",
|
||||
a.Name(), name, a.MPDRewriter().Name())
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue