import { EventEmitter } from '../utils/EventEmitter'; import { NetworkStats, PeerInfo } from '../Types'; import { GunDataProvider } from '../data/GunDataProvider'; export declare class NetworkMonitor extends EventEmitter { private isOnline; private stats; private checkInterval; private baseInterval; private maxInterval; private currentInterval; private intervalId; private logger; private gunDataProvider; private lastInboundBytes; private lastOutboundBytes; private lastCheckTime; private latencyHistory; private pingEndpoint; private bandwidthLimit; /** * Creates a new NetworkMonitor instance * @param gunDataProvider The GunDataProvider instance * @param checkInterval The initial check interval in milliseconds * @param pingEndpoint The endpoint to use for ping checks */ constructor(gunDataProvider: GunDataProvider, checkInterval?: number, pingEndpoint?: string); private init; private handleOnline; private handleOffline; private startMonitoring; private checkNetwork; private incrementCheckInterval; private calculateRollingAverageLatency; private updateStats; private getPeerCount; private getInboundTraffic; private getOutboundTraffic; /** * Gets the current network stats * @returns The current NetworkStats */ getStats(): NetworkStats; /** * Checks if the network is currently online * @returns True if online, false otherwise */ isNetworkOnline(): boolean; /** * Sets the check interval * @param interval The new check interval in milliseconds */ setCheckInterval(interval: number): void; /** * Stops the network monitoring */ stopMonitoring(): void; /** * Cleans up the NetworkMonitor instance */ destroy(): void; /** * Simulates network latency * @param latency The latency to simulate in milliseconds */ simulateLatency(latency: number): void; /** * Sets a bandwidth limit for simulation purposes * @param limit The bandwidth limit in bytes per second, or null to remove the limit */ setBandwidthLimit(limit: number | null): void; /** * Gets detailed information about connected peers * @returns An array of PeerInfo objects */ getPeerInfo(): PeerInfo[]; /** * Sets a custom ping endpoint * @param endpoint The new ping endpoint */ setPingEndpoint(endpoint: string): void; }