/// <reference types="node" />
import { EventEmitter } from 'events';
import * as dgram from 'dgram';
export interface INode {
    id: string;
    address: string;
    unicastPort: number;
    hostName: string;
    isMaster: boolean;
    isMasterEligible: boolean;
    weight: number;
    advertisement: any;
}
export declare class DiscoverOptions {
    helloInterval?: number;
    checkInterval?: number;
    nodeTimeout?: number;
    masterTimeout?: number;
    mastersRequired?: number;
    address?: string;
    port?: number;
    key?: string;
    reuseAddr?: boolean;
    dictionary?: string[];
    broadcast?: string;
    multicast?: string;
    multicastTTL?: number;
    unicastPort?: number;
    weight?: number;
    isMasterEligible?: boolean;
}
export declare class Discover extends EventEmitter {
    private helloInterval;
    private checkInterval;
    private resetInterval;
    private nodeTimeout;
    private masterTimeout;
    private mastersRequired;
    private me;
    private bondToAddress;
    private running;
    private checkId;
    private helloId;
    private resetId;
    private nodes;
    private channels;
    private instanceUuid;
    private broadcast;
    private broadcastHelloCounter;
    private multicast;
    private multicastHelloCounter;
    private dyunicast;
    constructor(options: DiscoverOptions, advertisement?: any);
    private static weight();
    start(): Promise<boolean>;
    stop(): false | undefined;
    setAdvertisement(advertisement?: any): Promise<void>;
    setMasterEligible(): Promise<void>;
    promote(): Promise<void>;
    demote(permanent: boolean): Promise<void>;
    readonly isMaster: boolean;
    readonly id: string;
    hello(): Promise<void>;
    eachNode(fn: (node: INode) => void): void;
    join(channel: string, fn?: (data: any[], obj: any, rinfo: dgram.RemoteInfo) => void): boolean;
    leave(channel: string): boolean;
    send(channel: string, ...obj: any[]): Promise<boolean>;
    sendTo(id: string, maxRetries: number, ...obj: any[]): Promise<boolean>;
    private onHello(data, obj, rinfo, mode);
}
