/// <reference types="socket.io" />
/// <reference types="node" />
/// <reference types="node" />
import { AppHeader } from '@shardeum-foundation/lib-net/build/src/types';
import { EventEmitter } from 'events';
import { Application, Handler } from 'express';
import Log4js from 'log4js';
import Logger from '../logger';
import * as Shardus from '../shardus/shardus-types';
/** TYPES */
export interface IPInfo {
    internalPort: number;
    internalIp: string;
    externalPort: number;
    externalIp: string;
}
export declare let ipInfo: IPInfo;
/** CLASS */
export declare class NetworkClass extends EventEmitter {
    app: Application;
    io: SocketIO.Server;
    sn: any;
    logger: Logger;
    mainLogger: Log4js.Logger;
    netLogger: Log4js.Logger;
    timeout: number;
    internalRoutes: {};
    externalRoutes: Array<(app: Application) => void>;
    extServer: any;
    intServer: any;
    verboseLogsNet: boolean;
    InternalTellCounter: number;
    InternalAskCounter: number;
    ipInfo: any;
    signingSecretKeyHex: string;
    shardusCryptoHashKey: string;
    externalCatchAll: any;
    debugNetworkDelay: number;
    statisticsInstance: any;
    useLruCacheForSocketMgmt: boolean;
    lruCacheSizeForSocketMgmt: number;
    payloadSizeLimitInBytes: number;
    headerSizeLimitInBytes: number;
    constructor(config: Shardus.StrictServerConfiguration, logger: Logger);
    setDebugNetworkDelay(delay: number): void;
    setStatisticsInstance(statistics: any): void;
    customSendJsonMiddleware(req: any, res: any, next: any): void;
    _setupExternal(): Promise<unknown>;
    _setupInternal(): Promise<void>;
    /**
     *
     * @param nodes
     * @param route
     * @param message
     * @param alreadyLogged this is so that gossip system can indicate that we already have recorded playback logs
     */
    tell(nodes: Shardus.Node[], route: string, message: any, alreadyLogged?: boolean, subRoute?: string): Promise<void>;
    tellBinary(nodes: Shardus.Node[] | Shardus.NodeWithRank[], route: string, message: Buffer, appHeader: AppHeader, trackerId: string, alreadyLogged?: boolean): Promise<void>;
    ask(node: any, route: any, message: any, alreadyLogged?: boolean, extraTime?: number): Promise<unknown>;
    askBinary(node: any, route: string, message: Buffer, appHeader: AppHeader, trackerId: string, alreadyLogged?: boolean, extraTime?: number): Promise<{
        res: Buffer;
        header?: AppHeader;
        sign?: Shardus.Sign;
    }>;
    evictCachedSockets(nodes: Shardus.Node[]): void;
    setup(ipInfo: IPInfo, signingSecretKeyHex: string): Promise<unknown>;
    shutdown(): Promise<void>;
    _registerExternal(method: string, route: string, responseHandler: Handler): any;
    _registerExternal(method: string, route: string, authHandler: Handler, responseHandler: Handler): any;
    _applyExternal(): void;
    setExternalCatchAll(handler: any): void;
    registerExternalGet(route: string, responseHandler: Handler): any;
    registerExternalGet(route: string, authHandler: Handler, responseHandler: Handler): any;
    registerExternalPost(route: string, responseHandler: Handler): any;
    registerExternalPost(route: string, authHandler: Handler, responseHandler: Handler): any;
    registerExternalPut(route: string, responseHandler: Handler): any;
    registerExternalPut(route: string, authHandler: Handler, responseHandler: Handler): any;
    registerExternalDelete(route: string, responseHandler: Handler): any;
    registerExternalDelete(route: string, authHandler: Handler, responseHandler: Handler): any;
    registerExternalPatch(route: string, responseHandler: Handler): any;
    registerExternalPatch(route: string, authHandler: Handler, responseHandler: Handler): any;
    registerInternal(route: string, handler: any): void;
    unregisterInternal(route: any): void;
}
/** FUNCTIONS */
export declare function init(): Promise<void>;
/**
 * Gets and offset time from NTP servers.  Returns false if not within
 * config.p2p.syncLimit although this is tuned wrong (too high)
 * and not used
 *
 * @param timeServers
 * @returns
 */
export declare function checkAndUpdateTimeSyncedOffset(timeServers: any): Promise<boolean>;
export declare function shardusGetTime(): number;
export declare function getNetworkTimeOffset(): number;
export declare function calculateFakeTimeOffset(shift: number, spread: number): number;
export declare function clearFakeTimeOffset(): number;
export declare function getFakeTimeOffset(): number;
export declare function getLastNTPObject(): any;
