Commit graph

17 commits

Author SHA1 Message Date
Thomas Becker
878e549211 fix: use true connection timeout instead of idle timeout
socket.setTimeout() is an idle timeout in Node.js (node docs)[https://nodejs.org/api/net.html#socketsettimeouttimeout-callback]
- it fires after N ms of inactivity, not N ms after the connection attempt. This
caused false timeout errors after successful data transfers when connections
went idle for longer than the timeout period.

Replace with JS setTimeout() that:
- Fires N ms after connection attempt starts
- Gets cleared on successful connect
- Return 504 Gateway Timeout (more accurate than 502)

Also adds proper close event handlers for socket cleanup.

Fixes #228
2025-12-18 12:53:49 +01:00
Sander Declerck
40650e7912
Add tests for: not shortcircuiting timeout on imds endpoint. 2025-12-09 15:46:37 +01:00
Sander Declerck
afc68618c6
Only timeout for imds endpoints 2025-12-09 15:25:19 +01:00
Sander Declerck
e421414b8a
Don't repeatedly call isImdsEndpoint 2025-12-05 12:12:22 +01:00
Sander Declerck
57a0e88fa4
Add tests and clarifying comments 2025-12-05 12:09:19 +01:00
Sander Declerck
a9ebec14f6
Remove 192.0.2.1 2025-12-04 15:21:47 +01:00
Sander Declerck
47ea989bbd
Reduce connect timeout for tunnel for known instance metadata hosts 2025-12-04 15:20:47 +01:00
Sander Declerck
14c4c4997e
Remove @ts-expect-error suppressions 2025-11-03 13:57:29 +01:00
Hans Ott
c88b1a624f Type check safe-chain package 2025-11-01 13:06:06 +01:00
Sander Declerck
78fd93b72a
End clientsocket without 502 in case of proxySocket error 2025-10-31 11:41:39 +01:00
Sander Declerck
4dc14397ad
Use correct event name in comment (error) 2025-10-31 11:40:01 +01:00
Sander Declerck
65c9ca62de
Subscribe to more error events to prevent the process from crashing 2025-10-31 09:39:16 +01:00
Sander Declerck
a377fd6caa
Listen to error events on sockets 2025-10-10 13:55:39 +02:00
Sander Declerck
219a189993
Check if a socket is writable before writing to it 2025-10-08 19:32:25 +02:00
Sander Declerck
16c76de0f3
Add comment on how safe-chain works with the system proxy. 2025-10-08 11:38:21 +02:00
Sander Declerck
a6980d5108
Add upstream proxy support 2025-10-02 09:06:35 +02:00
Sander Declerck
e2afcb16e3
Implement a proxy blocking tarball requests for packages containing malware. 2025-09-30 13:52:21 +02:00