mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-03-22 06:43:14 +00:00
chore: wrap option in a type
This commit is contained in:
parent
79d7e16bc3
commit
a69d0c252a
@ -90,12 +90,14 @@ export class BaseProtocol implements IBaseProtocolCore {
|
|||||||
* @returns A list of peers that support the protocol sorted by latency.
|
* @returns A list of peers that support the protocol sorted by latency.
|
||||||
*/
|
*/
|
||||||
public async getPeers(
|
public async getPeers(
|
||||||
{ prioritizeLatency, numPeers, maxBootstrapPeers }: GetPeersOptions = {
|
options: GetPeersOptions = {
|
||||||
prioritizeLatency: true,
|
prioritizeLatency: true,
|
||||||
maxBootstrapPeers: 1,
|
maxBootstrapPeers: 1,
|
||||||
numPeers: 0
|
numPeers: 0
|
||||||
}
|
}
|
||||||
): Promise<Peer[]> {
|
): Promise<Peer[]> {
|
||||||
|
const { maxBootstrapPeers, numPeers, prioritizeLatency } = options;
|
||||||
|
|
||||||
const activeConnections =
|
const activeConnections =
|
||||||
this.components.connectionManager.getConnections();
|
this.components.connectionManager.getConnections();
|
||||||
|
|
||||||
|
|||||||
@ -120,6 +120,10 @@ export type ProtocolCreateOptions = {
|
|||||||
* Defaults to 3.
|
* Defaults to 3.
|
||||||
*/
|
*/
|
||||||
numPeersToUse?: number;
|
numPeersToUse?: number;
|
||||||
|
/**
|
||||||
|
* Prioritize latency over decentralization when selecting peers.
|
||||||
|
*/
|
||||||
|
prioritizeLatency?: boolean;
|
||||||
/**
|
/**
|
||||||
* Byte array used as key for the noise protocol used for connection encryption
|
* Byte array used as key for the noise protocol used for connection encryption
|
||||||
* by [`Libp2p.create`](https://github.com/libp2p/js-libp2p/blob/master/doc/API.md#create)
|
* by [`Libp2p.create`](https://github.com/libp2p/js-libp2p/blob/master/doc/API.md#create)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user