File size: 620 Bytes
0bfe2e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
export * from './base';
export * from './mediaflow';
export * from './stremthru';

import { constants } from '../utils';
import { BaseProxy } from './base';
import { MediaFlowProxy } from './mediaflow';
import { StremThruProxy } from './stremthru';
import { StreamProxyConfig } from '../db';

export function createProxy(config: StreamProxyConfig): BaseProxy {
  switch (config.id) {
    case constants.MEDIAFLOW_SERVICE:
      return new MediaFlowProxy(config);
    case constants.STREMTHRU_SERVICE:
      return new StremThruProxy(config);
    default:
      throw new Error(`Unknown proxy type: ${config.id}`);
  }
}