2023-08-16 20:18:13 +05:30
|
|
|
import type { PeerId } from "@libp2p/interface/peer-id";
|
|
|
|
|
import type { PeerStore } from "@libp2p/interface/peer-store";
|
|
|
|
|
import type { ConnectionManager } from "@libp2p/interface-internal/connection-manager";
|
2022-12-05 17:00:24 +11:00
|
|
|
|
2022-12-13 12:31:27 +11:00
|
|
|
import { IEnr } from "./enr.js";
|
2023-07-25 02:17:52 +02:00
|
|
|
import { IBaseProtocol } from "./protocols.js";
|
2022-12-05 17:00:24 +11:00
|
|
|
|
2023-07-25 02:17:52 +02:00
|
|
|
export interface IPeerExchange extends IBaseProtocol {
|
2023-03-16 12:22:14 +11:00
|
|
|
query(params: PeerExchangeQueryParams): Promise<PeerInfo[] | undefined>;
|
2022-12-05 17:00:24 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface PeerExchangeQueryParams {
|
|
|
|
|
numPeers: number;
|
2023-01-04 14:35:44 +05:30
|
|
|
peerId?: PeerId;
|
2022-12-05 17:00:24 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface PeerExchangeResponse {
|
|
|
|
|
peerInfos: PeerInfo[];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface PeerInfo {
|
2022-12-13 12:31:27 +11:00
|
|
|
ENR?: IEnr;
|
2022-12-05 17:00:24 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface PeerExchangeComponents {
|
|
|
|
|
connectionManager: ConnectionManager;
|
|
|
|
|
peerStore: PeerStore;
|
|
|
|
|
}
|