Deepen all 20 media-streaming modules with expanded APIs and tests.
Add batch ingest, tree depth/path, peer scoring helpers, scheduler peek, FEC and ABR controls, telemetry sessions, and richer production api.md for bandwidth-aggregator and media-tree-orchestrator. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -55,6 +55,17 @@ class HyperP2PStreamAccessControl extends EventEmitter {
|
||||
return [...this._tokens.values()].filter((c) => c.expiresAt > now)
|
||||
}
|
||||
|
||||
extendTtl (token, extraMs = 3600000) {
|
||||
const cap = this._tokens.get(token)
|
||||
if (!cap) return false
|
||||
cap.expiresAt += extraMs
|
||||
return cap.expiresAt
|
||||
}
|
||||
|
||||
hasAccess (streamId, token) {
|
||||
return this.verify(token, streamId)
|
||||
}
|
||||
|
||||
getStats () {
|
||||
return mediaStats(this._stats, PROTOCOL, { active: this.listActive().length })
|
||||
}
|
||||
|
||||
@@ -8,5 +8,6 @@ test('grant verify', async (t) => {
|
||||
const m = new HyperP2PStreamAccessControl()
|
||||
const cap = m.grantCapability('premium-live')
|
||||
t.ok(m.verify(cap.token, 'premium-live'))
|
||||
t.ok(m.hasAccess('premium-live', cap.token))
|
||||
await m.close()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user