changed it to do both tcp and udp

This commit is contained in:
2025-11-25 15:27:01 +02:00
parent 5e992810ea
commit e7564371ed
2 changed files with 15 additions and 1 deletions

13
.env.example Normal file
View File

@@ -0,0 +1,13 @@
ROUTER_HOST=192.168.0.1
ROUTER_USER=username
ROUTER_PASS=password
WEBHOOK_SECRET=secret
ROUTER_WAN_IF=gi0
BIND_ADDRESS=192.168.0.2
ADMIN_PASS=password
PORT=3000

View File

@@ -26,7 +26,8 @@ export function enqueueNatAdd(ip, port, proto='tcp') {
info(`NAT ADD ${proto} ${ip}:${port}`); info(`NAT ADD ${proto} ${ip}:${port}`);
await runRouterCmds([ await runRouterCmds([
'conf t', 'conf t',
`ip nat inside source static ${proto} ${ip} ${port} interface ${process.env.ROUTER_WAN_IF || 'gi0'} ${port}`, `ip nat inside source static tcp ${ip} ${port} interface ${process.env.ROUTER_WAN_IF || 'gi0'} ${port}`,
`ip nat inside source static udp ${ip} ${port} interface ${process.env.ROUTER_WAN_IF || 'gi0'} ${port}`,
'end', 'end',
'wr mem' 'wr mem'
]); ]);