-
Notifications
You must be signed in to change notification settings - Fork 283
Expand file tree
/
Copy pathtest-m3u8-server.js
More file actions
36 lines (31 loc) · 1.05 KB
/
test-m3u8-server.js
File metadata and controls
36 lines (31 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* 简单的 M3U8 代理服务器测试
* 用于测试指定的 M3U8 URL
*/
import Fastify from 'fastify';
import m3u8ProxyController from '../controllers/m3u8-proxy.js';
const fastify = Fastify({
logger: true,
disableRequestLogging: false
});
// 注册 M3U8 代理控制器
await fastify.register(m3u8ProxyController);
// 启动服务器
const start = async () => {
try {
await fastify.listen({ port: 3002, host: '0.0.0.0' });
console.log('🚀 M3U8 代理服务器已启动');
console.log('📡 服务地址: http://0.0.0.0:3002');
console.log('');
console.log('📋 可用接口:');
console.log(' GET /m3u8-proxy/health - 健康检查');
console.log(' GET /m3u8-proxy/status - 服务状态');
console.log(' GET /m3u8-proxy/proxy?url=<url>&auth=drpys - 统一代理接口');
console.log(' HEAD /m3u8-proxy/proxy?url=<url>&auth=drpys - HEAD 请求测试');
console.log('');
} catch (err) {
fastify.log.error(err);
process.exit(1);
}
};
start();