feat(rustproxy-http): add protocol failure suppression, h3 fallback escalation, and protocol cache metrics exposure
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartproxy',
|
||||
version: '26.0.0',
|
||||
version: '26.1.0',
|
||||
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.'
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ export interface IMetrics {
|
||||
byBackend(): Map<string, IBackendMetrics>;
|
||||
protocols(): Map<string, string>;
|
||||
topByErrors(limit?: number): Array<{ backend: string; errors: number }>;
|
||||
detectedProtocols(): IProtocolCacheEntry[];
|
||||
};
|
||||
|
||||
// UDP metrics
|
||||
@@ -113,6 +114,26 @@ export interface IMetricsConfig {
|
||||
prometheusPrefix: string; // Default: smartproxy_
|
||||
}
|
||||
|
||||
/**
|
||||
* Protocol cache entry from the Rust proxy's auto-detection cache.
|
||||
* Shows which protocol (h1/h2/h3) is detected for each backend+domain pair,
|
||||
* including failure suppression state with escalating cooldowns.
|
||||
*/
|
||||
export interface IProtocolCacheEntry {
|
||||
host: string;
|
||||
port: number;
|
||||
domain: string | null;
|
||||
protocol: string;
|
||||
h3Port: number | null;
|
||||
ageSecs: number;
|
||||
h2Suppressed: boolean;
|
||||
h3Suppressed: boolean;
|
||||
h2CooldownRemainingSecs: number | null;
|
||||
h3CooldownRemainingSecs: number | null;
|
||||
h2ConsecutiveFailures: number | null;
|
||||
h3ConsecutiveFailures: number | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Per-backend metrics
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IMetrics, IBackendMetrics, IThroughputData, IThroughputHistoryPoint } from './models/metrics-types.js';
|
||||
import type { IMetrics, IBackendMetrics, IProtocolCacheEntry, IThroughputData, IThroughputHistoryPoint } from './models/metrics-types.js';
|
||||
import type { RustProxyBridge } from './rust-proxy-bridge.js';
|
||||
|
||||
/**
|
||||
@@ -216,6 +216,9 @@ export class RustMetricsAdapter implements IMetrics {
|
||||
result.sort((a, b) => b.errors - a.errors);
|
||||
return result.slice(0, limit);
|
||||
},
|
||||
detectedProtocols: (): IProtocolCacheEntry[] => {
|
||||
return this.cache?.detectedProtocols ?? [];
|
||||
},
|
||||
};
|
||||
|
||||
public udp = {
|
||||
|
||||
Reference in New Issue
Block a user