@streamr/dht 0.0.1-tatum.7 → 100.0.0-pretestnet.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/dist/src/connection/ConnectionLockRpcRemote.d.ts +10 -0
  2. package/dist/src/connection/{RemoteConnectionLocker.js → ConnectionLockRpcRemote.js} +20 -35
  3. package/dist/src/connection/ConnectionLockRpcRemote.js.map +1 -0
  4. package/dist/src/connection/ConnectionManager.d.ts +0 -1
  5. package/dist/src/connection/ConnectionManager.js +27 -25
  6. package/dist/src/connection/ConnectionManager.js.map +1 -1
  7. package/dist/src/connection/ConnectivityChecker.js +4 -4
  8. package/dist/src/connection/ConnectivityChecker.js.map +1 -1
  9. package/dist/src/connection/ConnectorFacade.d.ts +1 -1
  10. package/dist/src/connection/ConnectorFacade.js +5 -8
  11. package/dist/src/connection/ConnectorFacade.js.map +1 -1
  12. package/dist/src/connection/Handshaker.d.ts +1 -2
  13. package/dist/src/connection/Handshaker.js +1 -4
  14. package/dist/src/connection/Handshaker.js.map +1 -1
  15. package/dist/src/connection/ManagedConnection.d.ts +1 -2
  16. package/dist/src/connection/ManagedConnection.js +4 -5
  17. package/dist/src/connection/ManagedConnection.js.map +1 -1
  18. package/dist/src/connection/ManagedWebRtcConnection.d.ts +1 -1
  19. package/dist/src/connection/ManagedWebRtcConnection.js +2 -2
  20. package/dist/src/connection/ManagedWebRtcConnection.js.map +1 -1
  21. package/dist/src/connection/Simulator/SimulatorConnector.d.ts +1 -2
  22. package/dist/src/connection/Simulator/SimulatorConnector.js +3 -4
  23. package/dist/src/connection/Simulator/SimulatorConnector.js.map +1 -1
  24. package/dist/src/connection/WebRTC/NodeWebRtcConnection.d.ts +1 -1
  25. package/dist/src/connection/WebRTC/{WebRtcConnector.d.ts → WebRtcConnectorRpcLocal.d.ts} +9 -9
  26. package/dist/src/connection/WebRTC/{WebRtcConnector.js → WebRtcConnectorRpcLocal.js} +38 -30
  27. package/dist/src/connection/WebRTC/WebRtcConnectorRpcLocal.js.map +1 -0
  28. package/dist/src/connection/WebRTC/WebRtcConnectorRpcRemote.d.ts +11 -0
  29. package/dist/src/connection/WebRTC/WebRtcConnectorRpcRemote.js +55 -0
  30. package/dist/src/connection/WebRTC/WebRtcConnectorRpcRemote.js.map +1 -0
  31. package/dist/src/connection/WebRTC/iceServerAsString.d.ts +1 -1
  32. package/dist/src/connection/WebSocket/{WebSocketConnector.d.ts → WebSocketConnectorRpcLocal.d.ts} +6 -7
  33. package/dist/src/connection/WebSocket/{WebSocketConnector.js → WebSocketConnectorRpcLocal.js} +20 -20
  34. package/dist/src/connection/WebSocket/WebSocketConnectorRpcLocal.js.map +1 -0
  35. package/dist/src/connection/WebSocket/WebSocketConnectorRpcRemote.d.ts +8 -0
  36. package/dist/src/connection/WebSocket/{RemoteWebSocketConnector.js → WebSocketConnectorRpcRemote.js} +11 -16
  37. package/dist/src/connection/WebSocket/WebSocketConnectorRpcRemote.js.map +1 -0
  38. package/dist/src/dht/DhtNode.d.ts +6 -7
  39. package/dist/src/dht/DhtNode.js +22 -23
  40. package/dist/src/dht/DhtNode.js.map +1 -1
  41. package/dist/src/dht/{RemoteExternalApi.d.ts → ExternalApiRpcRemote.d.ts} +2 -2
  42. package/dist/src/dht/{RemoteExternalApi.js → ExternalApiRpcRemote.js} +5 -6
  43. package/dist/src/dht/ExternalApiRpcRemote.js.map +1 -0
  44. package/dist/src/dht/discovery/PeerDiscovery.d.ts +1 -1
  45. package/dist/src/dht/discovery/PeerDiscovery.js +3 -2
  46. package/dist/src/dht/discovery/PeerDiscovery.js.map +1 -1
  47. package/dist/src/dht/find/RecursiveFindSession.d.ts +5 -5
  48. package/dist/src/dht/find/RecursiveFindSession.js +7 -7
  49. package/dist/src/dht/find/RecursiveFindSession.js.map +1 -1
  50. package/dist/src/dht/find/RecursiveFinder.d.ts +7 -7
  51. package/dist/src/dht/find/RecursiveFinder.js +24 -24
  52. package/dist/src/dht/find/RecursiveFinder.js.map +1 -1
  53. package/dist/src/dht/find/RemoteRecursiveFindSession.d.ts +1 -1
  54. package/dist/src/dht/find/RemoteRecursiveFindSession.js +4 -4
  55. package/dist/src/dht/find/RemoteRecursiveFindSession.js.map +1 -1
  56. package/dist/src/dht/registerExternalApiRpcMethods.js +4 -3
  57. package/dist/src/dht/registerExternalApiRpcMethods.js.map +1 -1
  58. package/dist/src/dht/routing/Router.d.ts +2 -2
  59. package/dist/src/dht/routing/Router.js +2 -4
  60. package/dist/src/dht/routing/Router.js.map +1 -1
  61. package/dist/src/dht/routing/{RemoteRouter.d.ts → RouterRpcRemote.d.ts} +2 -2
  62. package/dist/src/dht/routing/{RemoteRouter.js → RouterRpcRemote.js} +4 -4
  63. package/dist/src/dht/routing/RouterRpcRemote.js.map +1 -0
  64. package/dist/src/dht/routing/RoutingSession.js +2 -2
  65. package/dist/src/dht/routing/RoutingSession.js.map +1 -1
  66. package/dist/src/dht/store/{DataStore.d.ts → StoreRpcLocal.d.ts} +4 -4
  67. package/dist/src/dht/store/{DataStore.js → StoreRpcLocal.js} +27 -27
  68. package/dist/src/dht/store/StoreRpcLocal.js.map +1 -0
  69. package/dist/src/dht/store/{RemoteStore.d.ts → StoreRpcRemote.d.ts} +2 -2
  70. package/dist/src/dht/store/{RemoteStore.js → StoreRpcRemote.js} +4 -4
  71. package/dist/src/dht/store/StoreRpcRemote.js.map +1 -0
  72. package/dist/src/exports.d.ts +1 -1
  73. package/dist/src/helpers/protoClasses.js +2 -2
  74. package/dist/src/helpers/protoClasses.js.map +1 -1
  75. package/dist/src/proto/packages/dht/protos/DhtRpc.client.d.ts +29 -29
  76. package/dist/src/proto/packages/dht/protos/DhtRpc.client.js +39 -39
  77. package/dist/src/proto/packages/dht/protos/DhtRpc.client.js.map +1 -1
  78. package/dist/src/proto/packages/dht/protos/DhtRpc.d.ts +49 -158
  79. package/dist/src/proto/packages/dht/protos/DhtRpc.js +46 -86
  80. package/dist/src/proto/packages/dht/protos/DhtRpc.js.map +1 -1
  81. package/dist/src/proto/packages/dht/protos/DhtRpc.server.d.ts +15 -15
  82. package/dist/src/transport/RoutingRpcCommunicator.js +1 -0
  83. package/dist/src/transport/RoutingRpcCommunicator.js.map +1 -1
  84. package/package.json +4 -4
  85. package/protos/DhtRpc.proto +30 -59
  86. package/src/connection/ConnectionLockRpcRemote.ts +62 -0
  87. package/src/connection/ConnectionManager.ts +33 -32
  88. package/src/connection/ConnectivityChecker.ts +1 -1
  89. package/src/connection/ConnectorFacade.ts +7 -10
  90. package/src/connection/Handshaker.ts +0 -5
  91. package/src/connection/ManagedConnection.ts +3 -6
  92. package/src/connection/ManagedWebRtcConnection.ts +0 -2
  93. package/src/connection/Simulator/SimulatorConnector.ts +2 -7
  94. package/src/connection/WebRTC/BrowserWebRtcConnection.ts +1 -1
  95. package/src/connection/WebRTC/NodeWebRtcConnection.ts +1 -1
  96. package/src/connection/WebRTC/{WebRtcConnector.ts → WebRtcConnectorRpcLocal.ts} +46 -34
  97. package/src/connection/WebRTC/WebRtcConnectorRpcRemote.ts +71 -0
  98. package/src/connection/WebRTC/iceServerAsString.ts +1 -1
  99. package/src/connection/WebSocket/{WebSocketConnector.ts → WebSocketConnectorRpcLocal.ts} +26 -26
  100. package/src/connection/WebSocket/{RemoteWebSocketConnector.ts → WebSocketConnectorRpcRemote.ts} +13 -18
  101. package/src/dht/DhtNode.ts +32 -33
  102. package/src/dht/{RemoteExternalApi.ts → ExternalApiRpcRemote.ts} +3 -4
  103. package/src/dht/discovery/PeerDiscovery.ts +4 -3
  104. package/src/dht/find/RecursiveFindSession.ts +11 -11
  105. package/src/dht/find/RecursiveFinder.ts +29 -30
  106. package/src/dht/find/RemoteRecursiveFindSession.ts +6 -6
  107. package/src/dht/registerExternalApiRpcMethods.ts +7 -4
  108. package/src/dht/routing/Router.ts +4 -6
  109. package/src/dht/routing/{RemoteRouter.ts → RouterRpcRemote.ts} +2 -2
  110. package/src/dht/routing/RoutingSession.ts +6 -6
  111. package/src/dht/store/{DataStore.ts → StoreRpcLocal.ts} +31 -31
  112. package/src/dht/store/{RemoteStore.ts → StoreRpcRemote.ts} +2 -2
  113. package/src/exports.ts +1 -1
  114. package/src/helpers/protoClasses.ts +4 -4
  115. package/src/proto/packages/dht/protos/DhtRpc.client.ts +54 -54
  116. package/src/proto/packages/dht/protos/DhtRpc.server.ts +15 -15
  117. package/src/proto/packages/dht/protos/DhtRpc.ts +76 -210
  118. package/src/transport/RoutingRpcCommunicator.ts +1 -0
  119. package/test/integration/{RemoteRouter.test.ts → RouterRpcRemote.test.ts} +8 -8
  120. package/test/integration/{RemoteStore.test.ts → StoreRpcRemote.test.ts} +13 -13
  121. package/test/integration/WebRtcConnectorRpc.test.ts +11 -24
  122. package/test/integration/WebSocketConnectorRpc.test.ts +8 -12
  123. package/test/unit/RecursiveFinder.test.ts +5 -6
  124. package/test/unit/{WebSocketConnector.test.ts → WebSocketConnectorRpcLocal.test.ts} +3 -3
  125. package/test/unit/webrtcReplaceInternalIpWithExternalIp.test.ts +1 -1
  126. package/test/utils/utils.ts +16 -26
  127. package/dist/src/connection/RemoteConnectionLocker.d.ts +0 -13
  128. package/dist/src/connection/RemoteConnectionLocker.js.map +0 -1
  129. package/dist/src/connection/WebRTC/RemoteWebrtcConnector.d.ts +0 -12
  130. package/dist/src/connection/WebRTC/RemoteWebrtcConnector.js +0 -74
  131. package/dist/src/connection/WebRTC/RemoteWebrtcConnector.js.map +0 -1
  132. package/dist/src/connection/WebRTC/WebRtcConnector.js.map +0 -1
  133. package/dist/src/connection/WebSocket/RemoteWebSocketConnector.d.ts +0 -9
  134. package/dist/src/connection/WebSocket/RemoteWebSocketConnector.js.map +0 -1
  135. package/dist/src/connection/WebSocket/WebSocketConnector.js.map +0 -1
  136. package/dist/src/dht/RemoteExternalApi.js.map +0 -1
  137. package/dist/src/dht/routing/RemoteRouter.js.map +0 -1
  138. package/dist/src/dht/store/DataStore.js.map +0 -1
  139. package/dist/src/dht/store/RemoteStore.js.map +0 -1
  140. package/src/connection/RemoteConnectionLocker.ts +0 -85
  141. package/src/connection/WebRTC/RemoteWebrtcConnector.ts +0 -93
@@ -161,26 +161,26 @@ export interface ClosestPeersResponse {
161
161
  requestId: string;
162
162
  }
163
163
  /**
164
- * @generated from protobuf message dht.RecursiveFindRequest
164
+ * @generated from protobuf message dht.FindRequest
165
165
  */
166
- export interface RecursiveFindRequest {
166
+ export interface FindRequest {
167
167
  /**
168
- * @generated from protobuf field: string recursiveFindSessionId = 1;
168
+ * @generated from protobuf field: string sessionId = 1;
169
169
  */
170
- recursiveFindSessionId: string;
170
+ sessionId: string;
171
171
  /**
172
- * @generated from protobuf field: dht.FindMode findMode = 2;
172
+ * @generated from protobuf field: bool fetchData = 2;
173
173
  */
174
- findMode: FindMode;
174
+ fetchData: boolean;
175
175
  }
176
176
  /**
177
- * @generated from protobuf message dht.RecursiveFindReport
177
+ * @generated from protobuf message dht.FindResponse
178
178
  */
179
- export interface RecursiveFindReport {
179
+ export interface FindResponse {
180
180
  /**
181
- * @generated from protobuf field: repeated dht.PeerDescriptor nodes = 1;
181
+ * @generated from protobuf field: repeated dht.PeerDescriptor closestConnectedPeers = 1;
182
182
  */
183
- nodes: PeerDescriptor[];
183
+ closestConnectedPeers: PeerDescriptor[];
184
184
  /**
185
185
  * @generated from protobuf field: repeated dht.DataEntry dataEntries = 2;
186
186
  */
@@ -309,19 +309,11 @@ export interface RouteMessageWrapper {
309
309
  */
310
310
  export interface RouteMessageAck {
311
311
  /**
312
- * @generated from protobuf field: dht.PeerDescriptor sourcePeer = 1;
313
- */
314
- sourcePeer?: PeerDescriptor;
315
- /**
316
- * @generated from protobuf field: string requestId = 2;
312
+ * @generated from protobuf field: string requestId = 1;
317
313
  */
318
314
  requestId: string;
319
315
  /**
320
- * @generated from protobuf field: dht.PeerDescriptor destinationPeer = 3;
321
- */
322
- destinationPeer?: PeerDescriptor;
323
- /**
324
- * @generated from protobuf field: string error = 4;
316
+ * @generated from protobuf field: string error = 2;
325
317
  */
326
318
  error: string;
327
319
  }
@@ -374,11 +366,7 @@ export interface HandshakeRequest {
374
366
  */
375
367
  sourceId: Uint8Array;
376
368
  /**
377
- * @generated from protobuf field: string protocolVersion = 2;
378
- */
379
- protocolVersion: string;
380
- /**
381
- * @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 3;
369
+ * @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 2;
382
370
  */
383
371
  peerDescriptor?: PeerDescriptor;
384
372
  }
@@ -391,15 +379,11 @@ export interface HandshakeResponse {
391
379
  */
392
380
  sourceId: Uint8Array;
393
381
  /**
394
- * @generated from protobuf field: string protocolVersion = 2;
395
- */
396
- protocolVersion: string;
397
- /**
398
- * @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 3;
382
+ * @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 2;
399
383
  */
400
384
  peerDescriptor?: PeerDescriptor;
401
385
  /**
402
- * @generated from protobuf field: optional string responseError = 4;
386
+ * @generated from protobuf field: optional string responseError = 3;
403
387
  */
404
388
  responseError?: string;
405
389
  }
@@ -461,11 +445,11 @@ export interface Message {
461
445
  */
462
446
  rpcMessage: RpcMessage;
463
447
  } | {
464
- oneofKind: "recursiveFindRequest";
448
+ oneofKind: "findRequest";
465
449
  /**
466
- * @generated from protobuf field: dht.RecursiveFindRequest RecursiveFindRequest = 11 [json_name = "RecursiveFindRequest"];
450
+ * @generated from protobuf field: dht.FindRequest findRequest = 11;
467
451
  */
468
- recursiveFindRequest: RecursiveFindRequest;
452
+ findRequest: FindRequest;
469
453
  } | {
470
454
  oneofKind: undefined;
471
455
  };
@@ -479,19 +463,11 @@ export interface Message {
479
463
  */
480
464
  export interface WebSocketConnectionRequest {
481
465
  /**
482
- * @generated from protobuf field: dht.PeerDescriptor requester = 1;
483
- */
484
- requester?: PeerDescriptor;
485
- /**
486
- * @generated from protobuf field: dht.PeerDescriptor target = 2;
487
- */
488
- target?: PeerDescriptor;
489
- /**
490
- * @generated from protobuf field: string ip = 3;
466
+ * @generated from protobuf field: string ip = 1;
491
467
  */
492
468
  ip: string;
493
469
  /**
494
- * @generated from protobuf field: uint32 port = 4;
470
+ * @generated from protobuf field: uint32 port = 2;
495
471
  */
496
472
  port: number;
497
473
  }
@@ -500,19 +476,11 @@ export interface WebSocketConnectionRequest {
500
476
  */
501
477
  export interface WebSocketConnectionResponse {
502
478
  /**
503
- * @generated from protobuf field: dht.PeerDescriptor requester = 1;
504
- */
505
- requester?: PeerDescriptor;
506
- /**
507
- * @generated from protobuf field: dht.PeerDescriptor target = 2;
508
- */
509
- target?: PeerDescriptor;
510
- /**
511
- * @generated from protobuf field: bool accepted = 3;
479
+ * @generated from protobuf field: bool accepted = 1;
512
480
  */
513
481
  accepted: boolean;
514
482
  /**
515
- * @generated from protobuf field: optional string reason = 4;
483
+ * @generated from protobuf field: optional string reason = 2;
516
484
  */
517
485
  reason?: string;
518
486
  }
@@ -523,15 +491,7 @@ export interface WebSocketConnectionResponse {
523
491
  */
524
492
  export interface WebRtcConnectionRequest {
525
493
  /**
526
- * @generated from protobuf field: dht.PeerDescriptor requester = 1;
527
- */
528
- requester?: PeerDescriptor;
529
- /**
530
- * @generated from protobuf field: dht.PeerDescriptor target = 2;
531
- */
532
- target?: PeerDescriptor;
533
- /**
534
- * @generated from protobuf field: string connectionId = 3;
494
+ * @generated from protobuf field: string connectionId = 1;
535
495
  */
536
496
  connectionId: string;
537
497
  }
@@ -540,19 +500,11 @@ export interface WebRtcConnectionRequest {
540
500
  */
541
501
  export interface RtcOffer {
542
502
  /**
543
- * @generated from protobuf field: dht.PeerDescriptor requester = 1;
544
- */
545
- requester?: PeerDescriptor;
546
- /**
547
- * @generated from protobuf field: dht.PeerDescriptor target = 2;
548
- */
549
- target?: PeerDescriptor;
550
- /**
551
- * @generated from protobuf field: string description = 3;
503
+ * @generated from protobuf field: string description = 1;
552
504
  */
553
505
  description: string;
554
506
  /**
555
- * @generated from protobuf field: string connectionId = 4;
507
+ * @generated from protobuf field: string connectionId = 2;
556
508
  */
557
509
  connectionId: string;
558
510
  }
@@ -561,19 +513,11 @@ export interface RtcOffer {
561
513
  */
562
514
  export interface RtcAnswer {
563
515
  /**
564
- * @generated from protobuf field: dht.PeerDescriptor requester = 1;
565
- */
566
- requester?: PeerDescriptor;
567
- /**
568
- * @generated from protobuf field: dht.PeerDescriptor target = 2;
569
- */
570
- target?: PeerDescriptor;
571
- /**
572
- * @generated from protobuf field: string description = 3;
516
+ * @generated from protobuf field: string description = 1;
573
517
  */
574
518
  description: string;
575
519
  /**
576
- * @generated from protobuf field: string connectionId = 4;
520
+ * @generated from protobuf field: string connectionId = 2;
577
521
  */
578
522
  connectionId: string;
579
523
  }
@@ -593,29 +537,13 @@ export interface IceCandidate {
593
537
  * @generated from protobuf field: string connectionId = 3;
594
538
  */
595
539
  connectionId: string;
596
- /**
597
- * @generated from protobuf field: dht.PeerDescriptor requester = 4;
598
- */
599
- requester?: PeerDescriptor;
600
- /**
601
- * @generated from protobuf field: dht.PeerDescriptor target = 5;
602
- */
603
- target?: PeerDescriptor;
604
540
  }
605
541
  /**
606
542
  * @generated from protobuf message dht.LockRequest
607
543
  */
608
544
  export interface LockRequest {
609
545
  /**
610
- * @generated from protobuf field: string protocolVersion = 1;
611
- */
612
- protocolVersion: string;
613
- /**
614
- * @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 2;
615
- */
616
- peerDescriptor?: PeerDescriptor;
617
- /**
618
- * @generated from protobuf field: string serviceId = 3;
546
+ * @generated from protobuf field: string serviceId = 1;
619
547
  */
620
548
  serviceId: string;
621
549
  }
@@ -624,15 +552,7 @@ export interface LockRequest {
624
552
  */
625
553
  export interface UnlockRequest {
626
554
  /**
627
- * @generated from protobuf field: string protocolVersion = 1;
628
- */
629
- protocolVersion: string;
630
- /**
631
- * @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 2;
632
- */
633
- peerDescriptor?: PeerDescriptor;
634
- /**
635
- * @generated from protobuf field: string serviceId = 3;
555
+ * @generated from protobuf field: string serviceId = 1;
636
556
  */
637
557
  serviceId: string;
638
558
  }
@@ -654,26 +574,14 @@ export interface LockResponse {
654
574
  */
655
575
  export interface DisconnectNotice {
656
576
  /**
657
- * @generated from protobuf field: string protocolVersion = 1;
658
- */
659
- protocolVersion: string;
660
- /**
661
- * @generated from protobuf field: dht.PeerDescriptor peerDescriptor = 2;
577
+ * @generated from protobuf field: dht.DisconnectMode disconnectMode = 1;
662
578
  */
663
- peerDescriptor?: PeerDescriptor;
664
- /**
665
- * @generated from protobuf field: dht.DisconnectMode disconnecMode = 3;
666
- */
667
- disconnecMode: DisconnectMode;
579
+ disconnectMode: DisconnectMode;
668
580
  }
669
581
  /**
670
582
  * @generated from protobuf message dht.DisconnectNoticeResponse
671
583
  */
672
584
  export interface DisconnectNoticeResponse {
673
- /**
674
- * @generated from protobuf field: string protocolVersion = 1;
675
- */
676
- protocolVersion: string;
677
585
  }
678
586
  /**
679
587
  * @generated from protobuf message dht.FindDataRequest
@@ -683,10 +591,6 @@ export interface FindDataRequest {
683
591
  * @generated from protobuf field: bytes kademliaId = 1;
684
592
  */
685
593
  kademliaId: Uint8Array;
686
- /**
687
- * @generated from protobuf field: dht.PeerDescriptor requestor = 2;
688
- */
689
- requestor?: PeerDescriptor;
690
594
  }
691
595
  /**
692
596
  * @generated from protobuf message dht.FindDataResponse
@@ -701,19 +605,6 @@ export interface FindDataResponse {
701
605
  */
702
606
  error?: string;
703
607
  }
704
- /**
705
- * @generated from protobuf enum dht.FindMode
706
- */
707
- export enum FindMode {
708
- /**
709
- * @generated from protobuf enum value: NODE = 0;
710
- */
711
- NODE = 0,
712
- /**
713
- * @generated from protobuf enum value: DATA = 1;
714
- */
715
- DATA = 1
716
- }
717
608
  /**
718
609
  * @generated from protobuf enum dht.NodeType
719
610
  */
@@ -942,23 +833,23 @@ class ClosestPeersResponse$Type extends MessageType$<ClosestPeersResponse> {
942
833
  */
943
834
  export const ClosestPeersResponse = new ClosestPeersResponse$Type();
944
835
  // @generated message type with reflection information, may provide speed optimized methods
945
- class RecursiveFindRequest$Type extends MessageType$<RecursiveFindRequest> {
836
+ class FindRequest$Type extends MessageType$<FindRequest> {
946
837
  constructor() {
947
- super("dht.RecursiveFindRequest", [
948
- { no: 1, name: "recursiveFindSessionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
949
- { no: 2, name: "findMode", kind: "enum", T: () => ["dht.FindMode", FindMode] }
838
+ super("dht.FindRequest", [
839
+ { no: 1, name: "sessionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
840
+ { no: 2, name: "fetchData", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
950
841
  ]);
951
842
  }
952
843
  }
953
844
  /**
954
- * @generated MessageType for protobuf message dht.RecursiveFindRequest
845
+ * @generated MessageType for protobuf message dht.FindRequest
955
846
  */
956
- export const RecursiveFindRequest = new RecursiveFindRequest$Type();
847
+ export const FindRequest = new FindRequest$Type();
957
848
  // @generated message type with reflection information, may provide speed optimized methods
958
- class RecursiveFindReport$Type extends MessageType$<RecursiveFindReport> {
849
+ class FindResponse$Type extends MessageType$<FindResponse> {
959
850
  constructor() {
960
- super("dht.RecursiveFindReport", [
961
- { no: 1, name: "nodes", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor },
851
+ super("dht.FindResponse", [
852
+ { no: 1, name: "closestConnectedPeers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor },
962
853
  { no: 2, name: "dataEntries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => DataEntry },
963
854
  { no: 3, name: "noCloserNodesFound", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ },
964
855
  { no: 4, name: "routingPath", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => PeerDescriptor }
@@ -966,9 +857,9 @@ class RecursiveFindReport$Type extends MessageType$<RecursiveFindReport> {
966
857
  }
967
858
  }
968
859
  /**
969
- * @generated MessageType for protobuf message dht.RecursiveFindReport
860
+ * @generated MessageType for protobuf message dht.FindResponse
970
861
  */
971
- export const RecursiveFindReport = new RecursiveFindReport$Type();
862
+ export const FindResponse = new FindResponse$Type();
972
863
  // @generated message type with reflection information, may provide speed optimized methods
973
864
  class PingRequest$Type extends MessageType$<PingRequest> {
974
865
  constructor() {
@@ -1059,10 +950,8 @@ export const RouteMessageWrapper = new RouteMessageWrapper$Type();
1059
950
  class RouteMessageAck$Type extends MessageType$<RouteMessageAck> {
1060
951
  constructor() {
1061
952
  super("dht.RouteMessageAck", [
1062
- { no: 1, name: "sourcePeer", kind: "message", T: () => PeerDescriptor },
1063
- { no: 2, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1064
- { no: 3, name: "destinationPeer", kind: "message", T: () => PeerDescriptor },
1065
- { no: 4, name: "error", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
953
+ { no: 1, name: "requestId", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
954
+ { no: 2, name: "error", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1066
955
  ]);
1067
956
  }
1068
957
  }
@@ -1104,8 +993,7 @@ class HandshakeRequest$Type extends MessageType$<HandshakeRequest> {
1104
993
  constructor() {
1105
994
  super("dht.HandshakeRequest", [
1106
995
  { no: 1, name: "sourceId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
1107
- { no: 2, name: "protocolVersion", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1108
- { no: 3, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor }
996
+ { no: 2, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor }
1109
997
  ]);
1110
998
  }
1111
999
  }
@@ -1118,9 +1006,8 @@ class HandshakeResponse$Type extends MessageType$<HandshakeResponse> {
1118
1006
  constructor() {
1119
1007
  super("dht.HandshakeResponse", [
1120
1008
  { no: 1, name: "sourceId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
1121
- { no: 2, name: "protocolVersion", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1122
- { no: 3, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor },
1123
- { no: 4, name: "responseError", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }
1009
+ { no: 2, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor },
1010
+ { no: 3, name: "responseError", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }
1124
1011
  ]);
1125
1012
  }
1126
1013
  }
@@ -1142,7 +1029,7 @@ class Message$Type extends MessageType$<Message> {
1142
1029
  { no: 8, name: "handshakeRequest", kind: "message", oneof: "body", T: () => HandshakeRequest },
1143
1030
  { no: 9, name: "handshakeResponse", kind: "message", oneof: "body", T: () => HandshakeResponse },
1144
1031
  { no: 10, name: "rpcMessage", kind: "message", oneof: "body", T: () => RpcMessage },
1145
- { no: 11, name: "RecursiveFindRequest", kind: "message", jsonName: "RecursiveFindRequest", oneof: "body", T: () => RecursiveFindRequest }
1032
+ { no: 11, name: "findRequest", kind: "message", oneof: "body", T: () => FindRequest }
1146
1033
  ]);
1147
1034
  }
1148
1035
  }
@@ -1154,10 +1041,8 @@ export const Message = new Message$Type();
1154
1041
  class WebSocketConnectionRequest$Type extends MessageType$<WebSocketConnectionRequest> {
1155
1042
  constructor() {
1156
1043
  super("dht.WebSocketConnectionRequest", [
1157
- { no: 1, name: "requester", kind: "message", T: () => PeerDescriptor },
1158
- { no: 2, name: "target", kind: "message", T: () => PeerDescriptor },
1159
- { no: 3, name: "ip", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1160
- { no: 4, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }
1044
+ { no: 1, name: "ip", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1045
+ { no: 2, name: "port", kind: "scalar", T: 13 /*ScalarType.UINT32*/ }
1161
1046
  ]);
1162
1047
  }
1163
1048
  }
@@ -1169,10 +1054,8 @@ export const WebSocketConnectionRequest = new WebSocketConnectionRequest$Type();
1169
1054
  class WebSocketConnectionResponse$Type extends MessageType$<WebSocketConnectionResponse> {
1170
1055
  constructor() {
1171
1056
  super("dht.WebSocketConnectionResponse", [
1172
- { no: 1, name: "requester", kind: "message", T: () => PeerDescriptor },
1173
- { no: 2, name: "target", kind: "message", T: () => PeerDescriptor },
1174
- { no: 3, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
1175
- { no: 4, name: "reason", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }
1057
+ { no: 1, name: "accepted", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
1058
+ { no: 2, name: "reason", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }
1176
1059
  ]);
1177
1060
  }
1178
1061
  }
@@ -1184,9 +1067,7 @@ export const WebSocketConnectionResponse = new WebSocketConnectionResponse$Type(
1184
1067
  class WebRtcConnectionRequest$Type extends MessageType$<WebRtcConnectionRequest> {
1185
1068
  constructor() {
1186
1069
  super("dht.WebRtcConnectionRequest", [
1187
- { no: 1, name: "requester", kind: "message", T: () => PeerDescriptor },
1188
- { no: 2, name: "target", kind: "message", T: () => PeerDescriptor },
1189
- { no: 3, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1070
+ { no: 1, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1190
1071
  ]);
1191
1072
  }
1192
1073
  }
@@ -1198,10 +1079,8 @@ export const WebRtcConnectionRequest = new WebRtcConnectionRequest$Type();
1198
1079
  class RtcOffer$Type extends MessageType$<RtcOffer> {
1199
1080
  constructor() {
1200
1081
  super("dht.RtcOffer", [
1201
- { no: 1, name: "requester", kind: "message", T: () => PeerDescriptor },
1202
- { no: 2, name: "target", kind: "message", T: () => PeerDescriptor },
1203
- { no: 3, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1204
- { no: 4, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1082
+ { no: 1, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1083
+ { no: 2, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1205
1084
  ]);
1206
1085
  }
1207
1086
  }
@@ -1213,10 +1092,8 @@ export const RtcOffer = new RtcOffer$Type();
1213
1092
  class RtcAnswer$Type extends MessageType$<RtcAnswer> {
1214
1093
  constructor() {
1215
1094
  super("dht.RtcAnswer", [
1216
- { no: 1, name: "requester", kind: "message", T: () => PeerDescriptor },
1217
- { no: 2, name: "target", kind: "message", T: () => PeerDescriptor },
1218
- { no: 3, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1219
- { no: 4, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1095
+ { no: 1, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1096
+ { no: 2, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1220
1097
  ]);
1221
1098
  }
1222
1099
  }
@@ -1230,9 +1107,7 @@ class IceCandidate$Type extends MessageType$<IceCandidate> {
1230
1107
  super("dht.IceCandidate", [
1231
1108
  { no: 1, name: "candidate", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1232
1109
  { no: 2, name: "mid", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1233
- { no: 3, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1234
- { no: 4, name: "requester", kind: "message", T: () => PeerDescriptor },
1235
- { no: 5, name: "target", kind: "message", T: () => PeerDescriptor }
1110
+ { no: 3, name: "connectionId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1236
1111
  ]);
1237
1112
  }
1238
1113
  }
@@ -1244,9 +1119,7 @@ export const IceCandidate = new IceCandidate$Type();
1244
1119
  class LockRequest$Type extends MessageType$<LockRequest> {
1245
1120
  constructor() {
1246
1121
  super("dht.LockRequest", [
1247
- { no: 1, name: "protocolVersion", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1248
- { no: 2, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor },
1249
- { no: 3, name: "serviceId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1122
+ { no: 1, name: "serviceId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1250
1123
  ]);
1251
1124
  }
1252
1125
  }
@@ -1258,9 +1131,7 @@ export const LockRequest = new LockRequest$Type();
1258
1131
  class UnlockRequest$Type extends MessageType$<UnlockRequest> {
1259
1132
  constructor() {
1260
1133
  super("dht.UnlockRequest", [
1261
- { no: 1, name: "protocolVersion", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1262
- { no: 2, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor },
1263
- { no: 3, name: "serviceId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1134
+ { no: 1, name: "serviceId", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1264
1135
  ]);
1265
1136
  }
1266
1137
  }
@@ -1285,9 +1156,7 @@ export const LockResponse = new LockResponse$Type();
1285
1156
  class DisconnectNotice$Type extends MessageType$<DisconnectNotice> {
1286
1157
  constructor() {
1287
1158
  super("dht.DisconnectNotice", [
1288
- { no: 1, name: "protocolVersion", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1289
- { no: 2, name: "peerDescriptor", kind: "message", T: () => PeerDescriptor },
1290
- { no: 3, name: "disconnecMode", kind: "enum", T: () => ["dht.DisconnectMode", DisconnectMode] }
1159
+ { no: 1, name: "disconnectMode", kind: "enum", T: () => ["dht.DisconnectMode", DisconnectMode] }
1291
1160
  ]);
1292
1161
  }
1293
1162
  }
@@ -1298,9 +1167,7 @@ export const DisconnectNotice = new DisconnectNotice$Type();
1298
1167
  // @generated message type with reflection information, may provide speed optimized methods
1299
1168
  class DisconnectNoticeResponse$Type extends MessageType$<DisconnectNoticeResponse> {
1300
1169
  constructor() {
1301
- super("dht.DisconnectNoticeResponse", [
1302
- { no: 1, name: "protocolVersion", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1303
- ]);
1170
+ super("dht.DisconnectNoticeResponse", []);
1304
1171
  }
1305
1172
  }
1306
1173
  /**
@@ -1311,8 +1178,7 @@ export const DisconnectNoticeResponse = new DisconnectNoticeResponse$Type();
1311
1178
  class FindDataRequest$Type extends MessageType$<FindDataRequest> {
1312
1179
  constructor() {
1313
1180
  super("dht.FindDataRequest", [
1314
- { no: 1, name: "kademliaId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ },
1315
- { no: 2, name: "requestor", kind: "message", T: () => PeerDescriptor }
1181
+ { no: 1, name: "kademliaId", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
1316
1182
  ]);
1317
1183
  }
1318
1184
  }
@@ -1342,17 +1208,17 @@ export const DhtRpcService = new ServiceType("dht.DhtRpcService", [
1342
1208
  { name: "leaveNotice", options: {}, I: LeaveNotice, O: Empty }
1343
1209
  ]);
1344
1210
  /**
1345
- * @generated ServiceType for protobuf service dht.RoutingService
1211
+ * @generated ServiceType for protobuf service dht.RouterRpc
1346
1212
  */
1347
- export const RoutingService = new ServiceType("dht.RoutingService", [
1213
+ export const RouterRpc = new ServiceType("dht.RouterRpc", [
1348
1214
  { name: "routeMessage", options: {}, I: RouteMessageWrapper, O: RouteMessageAck },
1349
1215
  { name: "forwardMessage", options: {}, I: RouteMessageWrapper, O: RouteMessageAck },
1350
1216
  { name: "findRecursively", options: {}, I: RouteMessageWrapper, O: RouteMessageAck }
1351
1217
  ]);
1352
1218
  /**
1353
- * @generated ServiceType for protobuf service dht.StoreService
1219
+ * @generated ServiceType for protobuf service dht.StoreRpc
1354
1220
  */
1355
- export const StoreService = new ServiceType("dht.StoreService", [
1221
+ export const StoreRpc = new ServiceType("dht.StoreRpc", [
1356
1222
  { name: "storeData", options: {}, I: StoreDataRequest, O: StoreDataResponse },
1357
1223
  { name: "migrateData", options: {}, I: MigrateDataRequest, O: MigrateDataResponse },
1358
1224
  { name: "deleteData", options: {}, I: DeleteDataRequest, O: DeleteDataResponse }
@@ -1361,35 +1227,35 @@ export const StoreService = new ServiceType("dht.StoreService", [
1361
1227
  * @generated ServiceType for protobuf service dht.RecursiveFindSessionService
1362
1228
  */
1363
1229
  export const RecursiveFindSessionService = new ServiceType("dht.RecursiveFindSessionService", [
1364
- { name: "reportRecursiveFindResult", options: {}, I: RecursiveFindReport, O: Empty }
1230
+ { name: "sendFindResponse", options: {}, I: FindResponse, O: Empty }
1365
1231
  ]);
1366
1232
  /**
1367
- * @generated ServiceType for protobuf service dht.WebSocketConnectorService
1233
+ * @generated ServiceType for protobuf service dht.WebSocketConnectorRpc
1368
1234
  */
1369
- export const WebSocketConnectorService = new ServiceType("dht.WebSocketConnectorService", [
1235
+ export const WebSocketConnectorRpc = new ServiceType("dht.WebSocketConnectorRpc", [
1370
1236
  { name: "requestConnection", options: {}, I: WebSocketConnectionRequest, O: WebSocketConnectionResponse }
1371
1237
  ]);
1372
1238
  /**
1373
- * @generated ServiceType for protobuf service dht.WebRtcConnectorService
1239
+ * @generated ServiceType for protobuf service dht.WebRtcConnectorRpc
1374
1240
  */
1375
- export const WebRtcConnectorService = new ServiceType("dht.WebRtcConnectorService", [
1241
+ export const WebRtcConnectorRpc = new ServiceType("dht.WebRtcConnectorRpc", [
1376
1242
  { name: "requestConnection", options: {}, I: WebRtcConnectionRequest, O: Empty },
1377
1243
  { name: "rtcOffer", options: {}, I: RtcOffer, O: Empty },
1378
1244
  { name: "rtcAnswer", options: {}, I: RtcAnswer, O: Empty },
1379
1245
  { name: "iceCandidate", options: {}, I: IceCandidate, O: Empty }
1380
1246
  ]);
1381
1247
  /**
1382
- * @generated ServiceType for protobuf service dht.ConnectionLocker
1248
+ * @generated ServiceType for protobuf service dht.ConnectionLockRpc
1383
1249
  */
1384
- export const ConnectionLocker = new ServiceType("dht.ConnectionLocker", [
1250
+ export const ConnectionLockRpc = new ServiceType("dht.ConnectionLockRpc", [
1385
1251
  { name: "lockRequest", options: {}, I: LockRequest, O: LockResponse },
1386
1252
  { name: "unlockRequest", options: {}, I: UnlockRequest, O: Empty },
1387
1253
  { name: "gracefulDisconnect", options: {}, I: DisconnectNotice, O: DisconnectNoticeResponse }
1388
1254
  ]);
1389
1255
  /**
1390
- * @generated ServiceType for protobuf service dht.ExternalApiService
1256
+ * @generated ServiceType for protobuf service dht.ExternalApiRpc
1391
1257
  */
1392
- export const ExternalApiService = new ServiceType("dht.ExternalApiService", [
1258
+ export const ExternalApiRpc = new ServiceType("dht.ExternalApiRpc", [
1393
1259
  { name: "findData", options: {}, I: FindDataRequest, O: FindDataResponse },
1394
1260
  { name: "externalStoreData", options: {}, I: ExternalStoreDataRequest, O: ExternalStoreDataResponse }
1395
1261
  ]);
@@ -53,6 +53,7 @@ export class RoutingRpcCommunicator extends RpcCommunicator {
53
53
  if (message.serviceId == this.ownServiceId && message.body.oneofKind === 'rpcMessage') {
54
54
  const context = new DhtCallContext()
55
55
  context.incomingSourceDescriptor = message.sourceDescriptor
56
+ context.incomingTargetDescriptor = message.targetDescriptor
56
57
  this.handleIncomingMessage(message.body.rpcMessage, context)
57
58
  }
58
59
  }
@@ -1,13 +1,13 @@
1
1
  import { RpcCommunicator, toProtoRpcClient } from '@streamr/proto-rpc'
2
- import { RemoteRouter } from '../../src/dht/routing/RemoteRouter'
2
+ import { RouterRpcRemote } from '../../src/dht/routing/RouterRpcRemote'
3
3
  import { Message, MessageType, NodeType, PeerDescriptor, RouteMessageAck, RouteMessageWrapper } from '../../src/proto/packages/dht/protos/DhtRpc'
4
- import { RoutingServiceClient } from '../../src/proto/packages/dht/protos/DhtRpc.client'
4
+ import { RouterRpcClient } from '../../src/proto/packages/dht/protos/DhtRpc.client'
5
5
  import { RpcMessage } from '../../src/proto/packages/proto-rpc/protos/ProtoRpc'
6
- import { createWrappedClosestPeersRequest, generateId, MockRoutingService } from '../utils/utils'
6
+ import { createWrappedClosestPeersRequest, generateId, mockRouterRpc } from '../utils/utils'
7
7
 
8
8
  describe('RemoteRouter', () => {
9
9
 
10
- let remoteRouter: RemoteRouter
10
+ let remoteRouter: RouterRpcRemote
11
11
  let clientRpcCommunicator: RpcCommunicator
12
12
  let serverRpcCommunicator: RpcCommunicator
13
13
  const serviceId = 'test'
@@ -23,15 +23,15 @@ describe('RemoteRouter', () => {
23
23
  beforeEach(() => {
24
24
  clientRpcCommunicator = new RpcCommunicator()
25
25
  serverRpcCommunicator = new RpcCommunicator()
26
- serverRpcCommunicator.registerRpcMethod(RouteMessageWrapper, RouteMessageAck, 'routeMessage', MockRoutingService.routeMessage)
26
+ serverRpcCommunicator.registerRpcMethod(RouteMessageWrapper, RouteMessageAck, 'routeMessage', mockRouterRpc.routeMessage)
27
27
  clientRpcCommunicator.on('outgoingMessage', (message: RpcMessage) => {
28
28
  serverRpcCommunicator.handleIncomingMessage(message)
29
29
  })
30
30
  serverRpcCommunicator.on('outgoingMessage', (message: RpcMessage) => {
31
31
  clientRpcCommunicator.handleIncomingMessage(message)
32
32
  })
33
- const client = toProtoRpcClient(new RoutingServiceClient(clientRpcCommunicator.getRpcClientTransport()))
34
- remoteRouter = new RemoteRouter(clientPeerDescriptor, serverPeerDescriptor, serviceId, client)
33
+ const client = toProtoRpcClient(new RouterRpcClient(clientRpcCommunicator.getRpcClientTransport()))
34
+ remoteRouter = new RouterRpcRemote(clientPeerDescriptor, serverPeerDescriptor, serviceId, client)
35
35
  })
36
36
 
37
37
  it('routeMessage happy path', async () => {
@@ -57,7 +57,7 @@ describe('RemoteRouter', () => {
57
57
  })
58
58
 
59
59
  it('routeMessage error path', async () => {
60
- serverRpcCommunicator.registerRpcMethod(RouteMessageWrapper, RouteMessageAck, 'routeMessage', MockRoutingService.throwRouteMessageError)
60
+ serverRpcCommunicator.registerRpcMethod(RouteMessageWrapper, RouteMessageAck, 'routeMessage', mockRouterRpc.throwRouteMessageError)
61
61
  const rpcWrapper = createWrappedClosestPeersRequest(clientPeerDescriptor)
62
62
  const routed: Message = {
63
63
  serviceId,