diff --git a/src/service/p2p.ts b/src/service/p2p.ts index 698c871..cf69567 100644 --- a/src/service/p2p.ts +++ b/src/service/p2p.ts @@ -31,24 +31,34 @@ export class P2PService { private logger: Logger; private nodeKeyPair: KeyPairEd25519; private localNodeId?: NodeId; - private networkId?: string; private nodesDb?: AbstractSublevel< AbstractLevel, Uint8Array, string, Uint8Array >; - private hashQueryRoutingTable: Map> = new Map(); constructor(node: S5Node) { this._node = node; - this.networkId = node.config.p2p?.network; + this._networkId = node.config.p2p?.network; this.nodeKeyPair = node.config.keyPair; this.logger = node.logger; node.config.services.p2p = this; } + private _hashQueryRoutingTable: Map> = new Map(); + + get hashQueryRoutingTable(): Map> { + return this._hashQueryRoutingTable; + } + + private _networkId?: string; + + get networkId(): string { + return this._networkId as string; + } + private _node: S5Node; get node(): S5Node { @@ -92,8 +102,8 @@ export class P2PService { const initialAuthPayloadPacker = new Packer(); initialAuthPayloadPacker.packInt(protocolMethodHandshakeOpen); initialAuthPayloadPacker.packBinary(Buffer.from(peer.challenge)); - if (this.networkId) { - initialAuthPayloadPacker.packString(this.networkId); + if (this._networkId) { + initialAuthPayloadPacker.packString(this._networkId); } const completer = defer();