fix(rustproxy-http): improve HTTP/3 connection reuse and clean up stale proxy state

This commit is contained in:
2026-03-26 07:05:57 +00:00
parent 437d1a3329
commit a3d8a3a388
14 changed files with 185 additions and 225 deletions

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartproxy',
version: '26.2.3',
version: '26.2.4',
description: 'A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.'
}

View File

@@ -26,6 +26,8 @@ interface IDatagramRelayMessage {
* - TS→Rust: { type: "reply", sourceIp, sourcePort, destPort, payloadBase64 }
*/
export class DatagramHandlerServer {
private static readonly MAX_BUFFER_SIZE = 50 * 1024 * 1024; // 50 MB
private server: plugins.net.Server | null = null;
private connection: plugins.net.Socket | null = null;
private socketPath: string;
@@ -100,6 +102,11 @@ export class DatagramHandlerServer {
socket.on('data', (chunk: Buffer) => {
this.readBuffer = Buffer.concat([this.readBuffer, chunk]);
if (this.readBuffer.length > DatagramHandlerServer.MAX_BUFFER_SIZE) {
logger.log('error', `DatagramHandlerServer: buffer exceeded ${DatagramHandlerServer.MAX_BUFFER_SIZE} bytes, resetting`);
this.readBuffer = Buffer.alloc(0);
return;
}
this.processFrames();
});

View File

@@ -128,6 +128,7 @@ export class SmartProxy extends plugins.EventEmitter {
}
// Handle unexpected exit (only emits error if not intentionally stopping)
this.bridge.removeAllListeners('exit');
this.bridge.on('exit', (code: number | null, signal: string | null) => {
if (this.stopping) return;
logger.log('error', `RustProxy exited unexpectedly (code=${code}, signal=${signal})`, { component: 'smart-proxy' });