import type { PrivateKey } from "@libp2p/interface";
import { LoggerNode } from "@lodestar/logger/node";
import { SubnetID } from "@lodestar/types";
import { IClock } from "../../util/clock.js";
import { NetworkCoreMetrics } from "../core/metrics.js";
import { Discv5Worker } from "../discv5/index.js";
import { LodestarDiscv5Opts } from "../discv5/types.js";
import { Libp2p } from "../interface.js";
import { SubnetType } from "../metadata.js";
import { NetworkConfig } from "../networkConfig.js";
import { IPeerRpcScoreStore } from "./score/index.js";
import { type CustodyGroupQueries } from "./utils/prioritizePeers.js";
export type PeerDiscoveryOpts = {
    discv5FirstQueryDelayMs: number;
    discv5: LodestarDiscv5Opts;
    connectToDiscv5Bootnodes?: boolean;
};
export type PeerDiscoveryModules = {
    privateKey: PrivateKey;
    networkConfig: NetworkConfig;
    libp2p: Libp2p;
    clock: IClock;
    peerRpcScores: IPeerRpcScoreStore;
    metrics: NetworkCoreMetrics | null;
    logger: LoggerNode;
};
export declare enum DiscoveredPeerStatus {
    bad_score = "bad_score",
    already_connected = "already_connected",
    already_dialing = "already_dialing",
    error = "error",
    attempt_dial = "attempt_dial",
    cached = "cached",
    dropped = "dropped",
    no_multiaddrs = "no_multiaddrs",
    transport_incompatible = "transport_incompatible",
    peer_cooling_down = "peer_cooling_down"
}
export declare enum NotDialReason {
    not_contain_requested_sampling_groups = "not_contain_requested_sampling_groups",
    not_contain_requested_attnet_syncnet_subnets = "not_contain_requested_attnet_syncnet_subnets",
    no_multiaddrs = "no_multiaddrs"
}
type UnixMs = number;
export type SubnetDiscvQueryMs = {
    subnet: SubnetID;
    type: SubnetType;
    toUnixMs: UnixMs;
    maxPeersToDiscover: number;
};
/**
 * PeerDiscovery discovers and dials new peers, and executes discv5 queries.
 * Currently relies on discv5 automatic periodic queries.
 */
export declare class PeerDiscovery {
    readonly discv5: Discv5Worker;
    private libp2p;
    private readonly clock;
    private peerRpcScores;
    private metrics;
    private logger;
    private config;
    private cachedENRs;
    private randomNodeQuery;
    private peersToConnect;
    private subnetRequests;
    private transports;
    private custodyGroupQueries;
    private discv5StartMs;
    private discv5FirstQueryDelayMs;
    private connectToDiscv5BootnodesOnStart;
    constructor(modules: PeerDiscoveryModules, opts: PeerDiscoveryOpts, discv5: Discv5Worker);
    static init(modules: PeerDiscoveryModules, opts: PeerDiscoveryOpts): Promise<PeerDiscovery>;
    stop(): Promise<void>;
    /**
     * Request to find peers, both on specific subnets and in general
     * pre-fulu custodyGroupRequests is empty
     */
    discoverPeers(peersToConnect: number, custodyGroupRequests: CustodyGroupQueries, subnetRequests?: SubnetDiscvQueryMs[]): void;
    private runFindRandomNodeQuery;
    /**
     * Progressively called by libp2p as a result of peer discovery or updates to its peer store
     */
    private onDiscoveredPeer;
    /**
     * Progressively called by discv5 as a result of any query.
     */
    private onDiscoveredENR;
    /**
     * Progressively called by peer discovery as a result of any query.
     */
    private handleDiscoveredPeer;
    private shouldDialPeer;
    private dialPeer;
    /** Check if there is 1+ open connection with this peer */
    private isPeerConnected;
}
export {};
//# sourceMappingURL=discover.d.ts.map