-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcamera-proxy.js
More file actions
48 lines (39 loc) · 1.12 KB
/
camera-proxy.js
File metadata and controls
48 lines (39 loc) · 1.12 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
37
38
39
40
41
42
43
44
45
46
47
// Camera Proxy Server
// Runs on your Mac to proxy camera requests from VPS via Tailscale
import express from 'express';
import { createProxyMiddleware } from 'http-proxy-middleware';
const app = express();
console.log('=== Camera Proxy Server ===');
console.log('This proxies camera requests from VPS to local cameras');
// Proxy RTSP requests to cameras
app.use('/robot', createProxyMiddleware({
target: 'rtsp://192.168.4.181:554',
changeOrigin: true,
logLevel: 'info'
}));
app.use('/table', createProxyMiddleware({
target: 'rtsp://192.168.4.182:554',
changeOrigin: true,
logLevel: 'info'
}));
app.use('/ceiling', createProxyMiddleware({
target: 'rtsp://192.168.4.183:554',
changeOrigin: true,
logLevel: 'info'
}));
// Health check
app.get('/health', (req, res) => {
res.json({
status: 'ok',
cameras: {
robot: '192.168.4.181:554',
table: '192.168.4.182:554',
ceiling: '192.168.4.183:554'
}
});
});
const PORT = 554;
app.listen(PORT, '0.0.0.0', () => {
console.log(`Camera proxy listening on port ${PORT}`);
console.log('VPS can now access cameras via Tailscale IP');
});