@push.rocks/smartproxy
Version:
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.
37 lines (36 loc) • 1.05 kB
TypeScript
import type { IThroughputData, IThroughputHistoryPoint } from './models/metrics-types.js';
/**
* Tracks throughput data using time-series sampling
*/
export declare class ThroughputTracker {
private samples;
private readonly maxSamples;
private accumulatedBytesIn;
private accumulatedBytesOut;
private lastSampleTime;
constructor(retentionSeconds?: number);
/**
* Record bytes transferred (called on every data transfer)
*/
recordBytes(bytesIn: number, bytesOut: number): void;
/**
* Take a sample of accumulated bytes (called every second)
*/
takeSample(): void;
/**
* Get throughput rate over specified window (bytes per second)
*/
getRate(windowSeconds: number): IThroughputData;
/**
* Get throughput history for specified duration
*/
getHistory(durationSeconds: number): IThroughputHistoryPoint[];
/**
* Clear all samples
*/
clear(): void;
/**
* Get sample count for debugging
*/
getSampleCount(): number;
}