/** * Copyright 2023 Fluence Labs Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { PeerIdB58 } from "@fluencelabs/interfaces"; import { Subject } from "rxjs"; import { IConnection } from "../connection/interfaces.js"; import { Particle } from "../particle/Particle.js"; interface EphemeralConfig { peers: Readonly>; } export declare const defaultConfig: { readonly peers: readonly [{ readonly peerId: "12D3KooWJankP2PcEDYCZDdJ26JsU8BMRfdGWyGqbtFiWyoKVtmx"; readonly sk: "dWNAHhDVuFj9bEieILMu6TcCFRxBJdOPIvAWmf4sZQI="; }, { readonly peerId: "12D3KooWSBTB5sYxdwayUyTnqopBwABsnGFY3p4dTx5hABYDtJjV"; readonly sk: "dOmaxAeu4Th+MJ22vRDLMFTNbiDgKNXar9fW9ofAMgQ="; }, { readonly peerId: "12D3KooWQjwf781DJ41moW5RrZXypLdnTbo6aMsoA8QLctGGX8RB"; readonly sk: "TgzaLlxXuOMDNuuuTKEHUKsW0jM4AmX0gahFvkB1KgE="; }, { readonly peerId: "12D3KooWCXWTLFyY1mqKnNAhLQTsjW1zqDzCMbUs8M4a8zdz28HK"; readonly sk: "hiO2Ta8g2ibMQ7iu5yj9CfN+qQCwE8oRShjr7ortKww="; }, { readonly peerId: "12D3KooWPmZpf4ng6GMS39HLagxsXbjiTPLH5CFJpFAHyN6amw6V"; readonly sk: "LzJtOHTqxfrlHDW40BKiLfjai8JU4yW6/s2zrXLCcQE="; }, { readonly peerId: "12D3KooWKrx8PZxM1R9A8tp2jmrFf6c6q1ZQiWfD4QkNgh7fWSoF"; readonly sk: "XMhlk/xr1FPcp7sKQhS18doXlq1x16EMhBC2NGW2LQ4="; }, { readonly peerId: "12D3KooWCbJHvnzSZEXjR1UJmtSUozuJK13iRiCYHLN1gjvm4TZZ"; readonly sk: "KXPAIqxrSHr7v0ngv3qagcqivFvnQ0xd3s1/rKmi8QU="; }, { readonly peerId: "12D3KooWEvKe7WQHp42W4xhHRgTAWQjtDWyH38uJbLHAsMuTtYvD"; readonly sk: "GCYMAshGnsrNtrHhuT7ayzh5uCzX99J03PmAXoOcCgw="; }, { readonly peerId: "12D3KooWSznSHN3BGrSykBXkLkFsqo9SYB73wVauVdqeuRt562cC"; readonly sk: "UP+SEuznS0h259VbFquzyOJAQ4W5iIwhP+hd1PmUQQ0="; }, { readonly peerId: "12D3KooWF57jwbShfnT3c4dNfRDdGjr6SQ3B71m87UVpEpSWHFwi"; readonly sk: "8dl+Crm5RSh0eh+LqLKwX8/Eo4QLpvIjfD8L0wzX4A4="; }, { readonly peerId: "12D3KooWBWrzpSg9nwMLBCa2cJubUjTv63Mfy6PYg9rHGbetaV5C"; readonly sk: "qolc1FcpJ+vHDon0HeXdUYnstjV1wiVx2p0mjblrfAg="; }, { readonly peerId: "12D3KooWNkLVU6juM8oyN2SVq5nBd2kp7Rf4uzJH1hET6vj6G5j6"; readonly sk: "vN6QzWILTM7hSHp+iGkKxiXcqs8bzlnH3FPaRaDGSQY="; }, { readonly peerId: "12D3KooWKo1YwGL5vivPiKJMJS7wjtB6B2nJNdSXPkSABT4NKBUU"; readonly sk: "YbDQ++bsor2kei7rYAsu2SbyoiOYPRzFRZWnNRUpBgQ="; }, { readonly peerId: "12D3KooWLUyBKmmNCyxaPkXoWcUFPcy5qrZsUo2E1tyM6CJmGJvC"; readonly sk: "ptB9eSFMKudAtHaFgDrRK/1oIMrhBujxbMw2Pzwx/wA="; }, { readonly peerId: "12D3KooWAEZXME4KMu9FvLezsJWDbYFe2zyujyMnDT1AgcAxgcCk"; readonly sk: "xtwTOKgAbDIgkuPf7RKiR7gYyZ1HY4mOgFMv3sOUcAQ="; }, { readonly peerId: "12D3KooWEhXetsFVAD9h2dRz9XgFpfidho1TCZVhFrczX8h8qgzY"; readonly sk: "1I2MGuiKG1F4FDMiRihVOcOP2mxzOLWJ99MeexK27A4="; }, { readonly peerId: "12D3KooWDBfVNdMyV3hPEF4WLBmx9DwD2t2SYuqZ2mztYmDzZWM1"; readonly sk: "eqJ4Bp7iN4aBXgPH0ezwSg+nVsatkYtfrXv9obI0YQ0="; }, { readonly peerId: "12D3KooWSyY7wiSiR4vbXa1WtZawi3ackMTqcQhEPrvqtagoWPny"; readonly sk: "UVM3SBJhPYIY/gafpnd9/q/Fn9V4BE9zkgrvF1T7Pgc="; }, { readonly peerId: "12D3KooWFZmBMGG9PxTs9s6ASzkLGKJWMyPheA5ruaYc2FDkDTmv"; readonly sk: "8RbZfEVpQhPVuhv64uqxENDuSoyJrslQoSQJznxsTQ0="; }, { readonly peerId: "12D3KooWBbhUaqqur6KHPunnKxXjY1daCtqJdy4wRji89LmAkVB4"; readonly sk: "RbgKmG6soWW9uOi7yRedm+0Qck3f3rw6MSnDP7AcBQs="; }]; }; export interface IEphemeralConnection extends IConnection { readonly selfPeerId: PeerIdB58; readonly connections: Map; receiveParticle(particle: Particle): void; } export declare class EphemeralConnection implements IEphemeralConnection { readonly selfPeerId: PeerIdB58; readonly connections: Map; constructor(selfPeerId: PeerIdB58); start(): Promise; stop(): Promise; connectToOther(other: IEphemeralConnection): void; disconnectFromOther(other: IEphemeralConnection): void; disconnectFromAll(): void; particleSource: Subject; receiveParticle(particle: Particle): void; sendParticle(nextPeerIds: string[], particle: Particle): Promise; getRelayPeerId(): string; supportsRelay(): boolean; } /** * Ephemeral network implementation. * Ephemeral network is a virtual network which runs locally and focuses on p2p interaction by removing connectivity layer out of the equation. */ export declare class EphemeralNetwork { readonly config: EphemeralConfig; private peers; constructor(config: EphemeralConfig); /** * Starts the Ephemeral network up */ up(): Promise; /** * Shuts the ephemeral network down. Will disconnect all connected peers. */ down(): Promise; /** * Gets a relay connection to the specified peer. */ getRelayConnection(peerId: PeerIdB58, relayPeerId: PeerIdB58): IConnection; } export {};