mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-01-14 14:03:11 +00:00
* update local peer discovery, make it configurable for cache * move to separate file * up tests, remove local storage from tests * pass local peer cache options * add e2e tests * add aditional e2e tests for local cache * rename local-peer-cache into peer-cache * update tests, ci * prevent filterign ws addresses
53 lines
1.0 KiB
TypeScript
53 lines
1.0 KiB
TypeScript
/**
|
|
* Options for the discovery.
|
|
*/
|
|
export type DiscoveryOptions = {
|
|
peerExchange: boolean;
|
|
dns: boolean;
|
|
peerCache: boolean;
|
|
};
|
|
|
|
/**
|
|
* Partial peer information used to store in the cache.
|
|
*/
|
|
export type PartialPeerInfo = {
|
|
id: string;
|
|
multiaddrs: string[];
|
|
};
|
|
|
|
/**
|
|
* A cache interface for persisting peer information.
|
|
*/
|
|
export type PeerCache = {
|
|
/**
|
|
* Get the peer information from the cache.
|
|
*
|
|
* @returns The peer information from the cache or empty array if no peer information is found.
|
|
*/
|
|
get: () => PartialPeerInfo[];
|
|
|
|
/**
|
|
* Set the peer information in the cache.
|
|
*
|
|
* @param value The peer information to set in the cache.
|
|
*/
|
|
set: (value: PartialPeerInfo[]) => void;
|
|
|
|
/**
|
|
* Remove the peer information from the cache.
|
|
*/
|
|
remove: () => void;
|
|
};
|
|
|
|
/**
|
|
* Options for the peer cache discovery.
|
|
*/
|
|
export type PeerCacheDiscoveryOptions = {
|
|
/**
|
|
* The cache to use for getting and storing cached peer information.
|
|
*
|
|
* @default LocalStorage
|
|
*/
|
|
cache: PeerCache;
|
|
};
|