libp2p 0.46.21 → 1.0.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 (301) hide show
  1. package/README.md +51 -47
  2. package/dist/index.min.js +40 -28
  3. package/dist/src/address-manager/index.d.ts +4 -5
  4. package/dist/src/address-manager/index.d.ts.map +1 -1
  5. package/dist/src/address-manager/index.js +3 -3
  6. package/dist/src/address-manager/index.js.map +1 -1
  7. package/dist/src/components.d.ts +4 -15
  8. package/dist/src/components.d.ts.map +1 -1
  9. package/dist/src/components.js +2 -2
  10. package/dist/src/components.js.map +1 -1
  11. package/dist/src/config/connection-gater.browser.d.ts +1 -1
  12. package/dist/src/config/connection-gater.browser.d.ts.map +1 -1
  13. package/dist/src/config/connection-gater.browser.js.map +1 -1
  14. package/dist/src/config/connection-gater.d.ts +1 -1
  15. package/dist/src/config/connection-gater.d.ts.map +1 -1
  16. package/dist/src/config.d.ts.map +1 -1
  17. package/dist/src/config.js +1 -2
  18. package/dist/src/config.js.map +1 -1
  19. package/dist/src/connection/index.d.ts +4 -6
  20. package/dist/src/connection/index.d.ts.map +1 -1
  21. package/dist/src/connection/index.js +11 -13
  22. package/dist/src/connection/index.js.map +1 -1
  23. package/dist/src/connection-manager/auto-dial.d.ts +3 -6
  24. package/dist/src/connection-manager/auto-dial.d.ts.map +1 -1
  25. package/dist/src/connection-manager/auto-dial.js +21 -21
  26. package/dist/src/connection-manager/auto-dial.js.map +1 -1
  27. package/dist/src/connection-manager/connection-pruner.d.ts +3 -5
  28. package/dist/src/connection-manager/connection-pruner.d.ts.map +1 -1
  29. package/dist/src/connection-manager/connection-pruner.js +8 -8
  30. package/dist/src/connection-manager/connection-pruner.js.map +1 -1
  31. package/dist/src/connection-manager/constants.defaults.d.ts +0 -4
  32. package/dist/src/connection-manager/constants.defaults.d.ts.map +1 -1
  33. package/dist/src/connection-manager/constants.defaults.js +0 -4
  34. package/dist/src/connection-manager/constants.defaults.js.map +1 -1
  35. package/dist/src/connection-manager/dial-queue.d.ts +3 -10
  36. package/dist/src/connection-manager/dial-queue.d.ts.map +1 -1
  37. package/dist/src/connection-manager/dial-queue.js +30 -38
  38. package/dist/src/connection-manager/dial-queue.js.map +1 -1
  39. package/dist/src/connection-manager/index.d.ts +3 -18
  40. package/dist/src/connection-manager/index.d.ts.map +1 -1
  41. package/dist/src/connection-manager/index.js +17 -18
  42. package/dist/src/connection-manager/index.js.map +1 -1
  43. package/dist/src/connection-manager/utils.js +1 -1
  44. package/dist/src/connection-manager/utils.js.map +1 -1
  45. package/dist/src/content-routing/index.d.ts +1 -5
  46. package/dist/src/content-routing/index.d.ts.map +1 -1
  47. package/dist/src/content-routing/index.js +2 -2
  48. package/dist/src/content-routing/index.js.map +1 -1
  49. package/dist/src/content-routing/utils.d.ts +1 -2
  50. package/dist/src/content-routing/utils.d.ts.map +1 -1
  51. package/dist/src/content-routing/utils.js +1 -1
  52. package/dist/src/content-routing/utils.js.map +1 -1
  53. package/dist/src/errors.d.ts +0 -2
  54. package/dist/src/errors.d.ts.map +1 -1
  55. package/dist/src/errors.js +0 -2
  56. package/dist/src/errors.js.map +1 -1
  57. package/dist/src/get-peer.d.ts +1 -1
  58. package/dist/src/get-peer.d.ts.map +1 -1
  59. package/dist/src/get-peer.js +1 -5
  60. package/dist/src/get-peer.js.map +1 -1
  61. package/dist/src/index.d.ts +5 -16
  62. package/dist/src/index.d.ts.map +1 -1
  63. package/dist/src/index.js.map +1 -1
  64. package/dist/src/libp2p.d.ts +4 -12
  65. package/dist/src/libp2p.d.ts.map +1 -1
  66. package/dist/src/libp2p.js +31 -65
  67. package/dist/src/libp2p.js.map +1 -1
  68. package/dist/src/peer-routing.d.ts +6 -6
  69. package/dist/src/peer-routing.d.ts.map +1 -1
  70. package/dist/src/peer-routing.js +12 -9
  71. package/dist/src/peer-routing.js.map +1 -1
  72. package/dist/src/registrar.d.ts +5 -7
  73. package/dist/src/registrar.d.ts.map +1 -1
  74. package/dist/src/registrar.js +4 -4
  75. package/dist/src/registrar.js.map +1 -1
  76. package/dist/src/transport-manager.d.ts +5 -9
  77. package/dist/src/transport-manager.d.ts.map +1 -1
  78. package/dist/src/transport-manager.js +12 -13
  79. package/dist/src/transport-manager.js.map +1 -1
  80. package/dist/src/upgrader.d.ts +8 -19
  81. package/dist/src/upgrader.d.ts.map +1 -1
  82. package/dist/src/upgrader.js +75 -38
  83. package/dist/src/upgrader.js.map +1 -1
  84. package/dist/src/version.d.ts +1 -1
  85. package/dist/src/version.d.ts.map +1 -1
  86. package/dist/src/version.js +1 -1
  87. package/dist/src/version.js.map +1 -1
  88. package/dist/typedoc-urls.json +8 -69
  89. package/package.json +37 -106
  90. package/src/address-manager/index.ts +6 -9
  91. package/src/components.ts +5 -16
  92. package/src/config/connection-gater.browser.ts +1 -1
  93. package/src/config/connection-gater.ts +1 -1
  94. package/src/config.ts +1 -2
  95. package/src/connection/index.ts +12 -17
  96. package/src/connection-manager/auto-dial.ts +23 -26
  97. package/src/connection-manager/connection-pruner.ts +10 -12
  98. package/src/connection-manager/constants.defaults.ts +0 -5
  99. package/src/connection-manager/dial-queue.ts +31 -46
  100. package/src/connection-manager/index.ts +19 -36
  101. package/src/connection-manager/utils.ts +1 -1
  102. package/src/content-routing/index.ts +3 -7
  103. package/src/content-routing/utils.ts +2 -3
  104. package/src/errors.ts +0 -2
  105. package/src/get-peer.ts +2 -7
  106. package/src/index.ts +6 -17
  107. package/src/libp2p.ts +32 -80
  108. package/src/peer-routing.ts +16 -15
  109. package/src/registrar.ts +8 -12
  110. package/src/transport-manager.ts +15 -22
  111. package/src/upgrader.ts +110 -64
  112. package/src/version.ts +1 -1
  113. package/dist/src/autonat/constants.d.ts +0 -18
  114. package/dist/src/autonat/constants.d.ts.map +0 -1
  115. package/dist/src/autonat/constants.js +0 -18
  116. package/dist/src/autonat/constants.js.map +0 -1
  117. package/dist/src/autonat/index.d.ts +0 -62
  118. package/dist/src/autonat/index.d.ts.map +0 -1
  119. package/dist/src/autonat/index.js +0 -447
  120. package/dist/src/autonat/index.js.map +0 -1
  121. package/dist/src/autonat/pb/index.d.ts +0 -57
  122. package/dist/src/autonat/pb/index.d.ts.map +0 -1
  123. package/dist/src/autonat/pb/index.js +0 -250
  124. package/dist/src/autonat/pb/index.js.map +0 -1
  125. package/dist/src/circuit-relay/constants.d.ts +0 -50
  126. package/dist/src/circuit-relay/constants.d.ts.map +0 -1
  127. package/dist/src/circuit-relay/constants.js +0 -56
  128. package/dist/src/circuit-relay/constants.js.map +0 -1
  129. package/dist/src/circuit-relay/index.d.ts +0 -55
  130. package/dist/src/circuit-relay/index.d.ts.map +0 -1
  131. package/dist/src/circuit-relay/index.js +0 -38
  132. package/dist/src/circuit-relay/index.js.map +0 -1
  133. package/dist/src/circuit-relay/pb/index.d.ts +0 -93
  134. package/dist/src/circuit-relay/pb/index.d.ts.map +0 -1
  135. package/dist/src/circuit-relay/pb/index.js +0 -425
  136. package/dist/src/circuit-relay/pb/index.js.map +0 -1
  137. package/dist/src/circuit-relay/server/advert-service.d.ts +0 -43
  138. package/dist/src/circuit-relay/server/advert-service.d.ts.map +0 -1
  139. package/dist/src/circuit-relay/server/advert-service.js +0 -73
  140. package/dist/src/circuit-relay/server/advert-service.js.map +0 -1
  141. package/dist/src/circuit-relay/server/index.d.ts +0 -65
  142. package/dist/src/circuit-relay/server/index.d.ts.map +0 -1
  143. package/dist/src/circuit-relay/server/index.js +0 -312
  144. package/dist/src/circuit-relay/server/index.js.map +0 -1
  145. package/dist/src/circuit-relay/server/reservation-store.d.ts +0 -49
  146. package/dist/src/circuit-relay/server/reservation-store.d.ts.map +0 -1
  147. package/dist/src/circuit-relay/server/reservation-store.js +0 -65
  148. package/dist/src/circuit-relay/server/reservation-store.js.map +0 -1
  149. package/dist/src/circuit-relay/server/reservation-voucher.d.ts +0 -18
  150. package/dist/src/circuit-relay/server/reservation-voucher.d.ts.map +0 -1
  151. package/dist/src/circuit-relay/server/reservation-voucher.js +0 -36
  152. package/dist/src/circuit-relay/server/reservation-voucher.js.map +0 -1
  153. package/dist/src/circuit-relay/transport/discovery.d.ts +0 -45
  154. package/dist/src/circuit-relay/transport/discovery.d.ts.map +0 -1
  155. package/dist/src/circuit-relay/transport/discovery.js +0 -97
  156. package/dist/src/circuit-relay/transport/discovery.js.map +0 -1
  157. package/dist/src/circuit-relay/transport/index.d.ts +0 -57
  158. package/dist/src/circuit-relay/transport/index.d.ts.map +0 -1
  159. package/dist/src/circuit-relay/transport/index.js +0 -276
  160. package/dist/src/circuit-relay/transport/index.js.map +0 -1
  161. package/dist/src/circuit-relay/transport/listener.d.ts +0 -9
  162. package/dist/src/circuit-relay/transport/listener.d.ts.map +0 -1
  163. package/dist/src/circuit-relay/transport/listener.js +0 -66
  164. package/dist/src/circuit-relay/transport/listener.js.map +0 -1
  165. package/dist/src/circuit-relay/transport/reservation-store.d.ts +0 -72
  166. package/dist/src/circuit-relay/transport/reservation-store.d.ts.map +0 -1
  167. package/dist/src/circuit-relay/transport/reservation-store.js +0 -209
  168. package/dist/src/circuit-relay/transport/reservation-store.js.map +0 -1
  169. package/dist/src/circuit-relay/utils.d.ts +0 -13
  170. package/dist/src/circuit-relay/utils.d.ts.map +0 -1
  171. package/dist/src/circuit-relay/utils.js +0 -108
  172. package/dist/src/circuit-relay/utils.js.map +0 -1
  173. package/dist/src/dcutr/dcutr.d.ts +0 -43
  174. package/dist/src/dcutr/dcutr.d.ts.map +0 -1
  175. package/dist/src/dcutr/dcutr.js +0 -313
  176. package/dist/src/dcutr/dcutr.js.map +0 -1
  177. package/dist/src/dcutr/index.d.ts +0 -92
  178. package/dist/src/dcutr/index.d.ts.map +0 -1
  179. package/dist/src/dcutr/index.js +0 -63
  180. package/dist/src/dcutr/index.js.map +0 -1
  181. package/dist/src/dcutr/pb/message.d.ts +0 -20
  182. package/dist/src/dcutr/pb/message.d.ts.map +0 -1
  183. package/dist/src/dcutr/pb/message.js +0 -77
  184. package/dist/src/dcutr/pb/message.js.map +0 -1
  185. package/dist/src/dcutr/utils.d.ts +0 -8
  186. package/dist/src/dcutr/utils.d.ts.map +0 -1
  187. package/dist/src/dcutr/utils.js +0 -27
  188. package/dist/src/dcutr/utils.js.map +0 -1
  189. package/dist/src/fetch/constants.d.ts +0 -3
  190. package/dist/src/fetch/constants.d.ts.map +0 -1
  191. package/dist/src/fetch/constants.js +0 -4
  192. package/dist/src/fetch/constants.js.map +0 -1
  193. package/dist/src/fetch/index.d.ts +0 -61
  194. package/dist/src/fetch/index.d.ts.map +0 -1
  195. package/dist/src/fetch/index.js +0 -205
  196. package/dist/src/fetch/index.js.map +0 -1
  197. package/dist/src/fetch/pb/proto.d.ts +0 -28
  198. package/dist/src/fetch/pb/proto.d.ts.map +0 -1
  199. package/dist/src/fetch/pb/proto.js +0 -120
  200. package/dist/src/fetch/pb/proto.js.map +0 -1
  201. package/dist/src/identify/consts.d.ts +0 -10
  202. package/dist/src/identify/consts.d.ts.map +0 -1
  203. package/dist/src/identify/consts.js +0 -11
  204. package/dist/src/identify/consts.js.map +0 -1
  205. package/dist/src/identify/identify.d.ts +0 -54
  206. package/dist/src/identify/identify.d.ts.map +0 -1
  207. package/dist/src/identify/identify.js +0 -447
  208. package/dist/src/identify/identify.js.map +0 -1
  209. package/dist/src/identify/index.d.ts +0 -72
  210. package/dist/src/identify/index.d.ts.map +0 -1
  211. package/dist/src/identify/index.js +0 -15
  212. package/dist/src/identify/index.js.map +0 -1
  213. package/dist/src/identify/pb/message.d.ts +0 -17
  214. package/dist/src/identify/pb/message.d.ts.map +0 -1
  215. package/dist/src/identify/pb/message.js +0 -98
  216. package/dist/src/identify/pb/message.js.map +0 -1
  217. package/dist/src/insecure/index.d.ts +0 -26
  218. package/dist/src/insecure/index.d.ts.map +0 -1
  219. package/dist/src/insecure/index.js +0 -110
  220. package/dist/src/insecure/index.js.map +0 -1
  221. package/dist/src/insecure/pb/proto.d.ts +0 -30
  222. package/dist/src/insecure/pb/proto.d.ts.map +0 -1
  223. package/dist/src/insecure/pb/proto.js +0 -127
  224. package/dist/src/insecure/pb/proto.js.map +0 -1
  225. package/dist/src/ping/constants.d.ts +0 -9
  226. package/dist/src/ping/constants.d.ts.map +0 -1
  227. package/dist/src/ping/constants.js +0 -15
  228. package/dist/src/ping/constants.js.map +0 -1
  229. package/dist/src/ping/index.d.ts +0 -24
  230. package/dist/src/ping/index.d.ts.map +0 -1
  231. package/dist/src/ping/index.js +0 -115
  232. package/dist/src/ping/index.js.map +0 -1
  233. package/dist/src/pnet/crypto.d.ts +0 -18
  234. package/dist/src/pnet/crypto.d.ts.map +0 -1
  235. package/dist/src/pnet/crypto.js +0 -60
  236. package/dist/src/pnet/crypto.js.map +0 -1
  237. package/dist/src/pnet/errors.d.ts +0 -6
  238. package/dist/src/pnet/errors.d.ts.map +0 -1
  239. package/dist/src/pnet/errors.js +0 -6
  240. package/dist/src/pnet/errors.js.map +0 -1
  241. package/dist/src/pnet/index.d.ts +0 -31
  242. package/dist/src/pnet/index.d.ts.map +0 -1
  243. package/dist/src/pnet/index.js +0 -97
  244. package/dist/src/pnet/index.js.map +0 -1
  245. package/dist/src/pnet/key-generator.d.ts +0 -11
  246. package/dist/src/pnet/key-generator.d.ts.map +0 -1
  247. package/dist/src/pnet/key-generator.js +0 -22
  248. package/dist/src/pnet/key-generator.js.map +0 -1
  249. package/dist/src/upnp-nat/index.d.ts +0 -71
  250. package/dist/src/upnp-nat/index.d.ts.map +0 -1
  251. package/dist/src/upnp-nat/index.js +0 -136
  252. package/dist/src/upnp-nat/index.js.map +0 -1
  253. package/dist/src/utils/peer-job-queue.d.ts +0 -33
  254. package/dist/src/utils/peer-job-queue.d.ts.map +0 -1
  255. package/dist/src/utils/peer-job-queue.js +0 -82
  256. package/dist/src/utils/peer-job-queue.js.map +0 -1
  257. package/src/autonat/constants.ts +0 -19
  258. package/src/autonat/index.ts +0 -597
  259. package/src/autonat/pb/index.proto +0 -35
  260. package/src/autonat/pb/index.ts +0 -320
  261. package/src/circuit-relay/constants.ts +0 -72
  262. package/src/circuit-relay/index.ts +0 -59
  263. package/src/circuit-relay/pb/index.proto +0 -67
  264. package/src/circuit-relay/pb/index.ts +0 -539
  265. package/src/circuit-relay/server/advert-service.ts +0 -108
  266. package/src/circuit-relay/server/index.ts +0 -443
  267. package/src/circuit-relay/server/reservation-store.ts +0 -116
  268. package/src/circuit-relay/server/reservation-voucher.ts +0 -51
  269. package/src/circuit-relay/transport/discovery.ts +0 -136
  270. package/src/circuit-relay/transport/index.ts +0 -396
  271. package/src/circuit-relay/transport/listener.ts +0 -97
  272. package/src/circuit-relay/transport/reservation-store.ts +0 -312
  273. package/src/circuit-relay/utils.ts +0 -136
  274. package/src/dcutr/dcutr.ts +0 -378
  275. package/src/dcutr/index.ts +0 -102
  276. package/src/dcutr/pb/message.proto +0 -12
  277. package/src/dcutr/pb/message.ts +0 -96
  278. package/src/dcutr/utils.ts +0 -33
  279. package/src/fetch/README.md +0 -41
  280. package/src/fetch/constants.ts +0 -3
  281. package/src/fetch/index.ts +0 -315
  282. package/src/fetch/pb/proto.proto +0 -15
  283. package/src/fetch/pb/proto.ts +0 -153
  284. package/src/identify/README.md +0 -13
  285. package/src/identify/consts.ts +0 -12
  286. package/src/identify/identify.ts +0 -561
  287. package/src/identify/index.ts +0 -90
  288. package/src/identify/pb/message.proto +0 -30
  289. package/src/identify/pb/message.ts +0 -126
  290. package/src/insecure/index.ts +0 -138
  291. package/src/insecure/pb/proto.proto +0 -18
  292. package/src/insecure/pb/proto.ts +0 -161
  293. package/src/ping/constants.ts +0 -15
  294. package/src/ping/index.ts +0 -170
  295. package/src/pnet/README.md +0 -68
  296. package/src/pnet/crypto.ts +0 -67
  297. package/src/pnet/errors.ts +0 -5
  298. package/src/pnet/index.ts +0 -126
  299. package/src/pnet/key-generator.ts +0 -23
  300. package/src/upnp-nat/index.ts +0 -212
  301. package/src/utils/peer-job-queue.ts +0 -119
@@ -1,250 +0,0 @@
1
- /* eslint-disable import/export */
2
- /* eslint-disable complexity */
3
- /* eslint-disable @typescript-eslint/no-namespace */
4
- /* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
5
- /* eslint-disable @typescript-eslint/no-empty-interface */
6
- import { enumeration, encodeMessage, decodeMessage, message } from 'protons-runtime';
7
- export var Message;
8
- (function (Message) {
9
- let MessageType;
10
- (function (MessageType) {
11
- MessageType["DIAL"] = "DIAL";
12
- MessageType["DIAL_RESPONSE"] = "DIAL_RESPONSE";
13
- })(MessageType = Message.MessageType || (Message.MessageType = {}));
14
- let __MessageTypeValues;
15
- (function (__MessageTypeValues) {
16
- __MessageTypeValues[__MessageTypeValues["DIAL"] = 0] = "DIAL";
17
- __MessageTypeValues[__MessageTypeValues["DIAL_RESPONSE"] = 1] = "DIAL_RESPONSE";
18
- })(__MessageTypeValues || (__MessageTypeValues = {}));
19
- (function (MessageType) {
20
- MessageType.codec = () => {
21
- return enumeration(__MessageTypeValues);
22
- };
23
- })(MessageType = Message.MessageType || (Message.MessageType = {}));
24
- let ResponseStatus;
25
- (function (ResponseStatus) {
26
- ResponseStatus["OK"] = "OK";
27
- ResponseStatus["E_DIAL_ERROR"] = "E_DIAL_ERROR";
28
- ResponseStatus["E_DIAL_REFUSED"] = "E_DIAL_REFUSED";
29
- ResponseStatus["E_BAD_REQUEST"] = "E_BAD_REQUEST";
30
- ResponseStatus["E_INTERNAL_ERROR"] = "E_INTERNAL_ERROR";
31
- })(ResponseStatus = Message.ResponseStatus || (Message.ResponseStatus = {}));
32
- let __ResponseStatusValues;
33
- (function (__ResponseStatusValues) {
34
- __ResponseStatusValues[__ResponseStatusValues["OK"] = 0] = "OK";
35
- __ResponseStatusValues[__ResponseStatusValues["E_DIAL_ERROR"] = 100] = "E_DIAL_ERROR";
36
- __ResponseStatusValues[__ResponseStatusValues["E_DIAL_REFUSED"] = 101] = "E_DIAL_REFUSED";
37
- __ResponseStatusValues[__ResponseStatusValues["E_BAD_REQUEST"] = 200] = "E_BAD_REQUEST";
38
- __ResponseStatusValues[__ResponseStatusValues["E_INTERNAL_ERROR"] = 300] = "E_INTERNAL_ERROR";
39
- })(__ResponseStatusValues || (__ResponseStatusValues = {}));
40
- (function (ResponseStatus) {
41
- ResponseStatus.codec = () => {
42
- return enumeration(__ResponseStatusValues);
43
- };
44
- })(ResponseStatus = Message.ResponseStatus || (Message.ResponseStatus = {}));
45
- let PeerInfo;
46
- (function (PeerInfo) {
47
- let _codec;
48
- PeerInfo.codec = () => {
49
- if (_codec == null) {
50
- _codec = message((obj, w, opts = {}) => {
51
- if (opts.lengthDelimited !== false) {
52
- w.fork();
53
- }
54
- if (obj.id != null) {
55
- w.uint32(10);
56
- w.bytes(obj.id);
57
- }
58
- if (obj.addrs != null) {
59
- for (const value of obj.addrs) {
60
- w.uint32(18);
61
- w.bytes(value);
62
- }
63
- }
64
- if (opts.lengthDelimited !== false) {
65
- w.ldelim();
66
- }
67
- }, (reader, length) => {
68
- const obj = {
69
- addrs: []
70
- };
71
- const end = length == null ? reader.len : reader.pos + length;
72
- while (reader.pos < end) {
73
- const tag = reader.uint32();
74
- switch (tag >>> 3) {
75
- case 1:
76
- obj.id = reader.bytes();
77
- break;
78
- case 2:
79
- obj.addrs.push(reader.bytes());
80
- break;
81
- default:
82
- reader.skipType(tag & 7);
83
- break;
84
- }
85
- }
86
- return obj;
87
- });
88
- }
89
- return _codec;
90
- };
91
- PeerInfo.encode = (obj) => {
92
- return encodeMessage(obj, PeerInfo.codec());
93
- };
94
- PeerInfo.decode = (buf) => {
95
- return decodeMessage(buf, PeerInfo.codec());
96
- };
97
- })(PeerInfo = Message.PeerInfo || (Message.PeerInfo = {}));
98
- let Dial;
99
- (function (Dial) {
100
- let _codec;
101
- Dial.codec = () => {
102
- if (_codec == null) {
103
- _codec = message((obj, w, opts = {}) => {
104
- if (opts.lengthDelimited !== false) {
105
- w.fork();
106
- }
107
- if (obj.peer != null) {
108
- w.uint32(10);
109
- Message.PeerInfo.codec().encode(obj.peer, w);
110
- }
111
- if (opts.lengthDelimited !== false) {
112
- w.ldelim();
113
- }
114
- }, (reader, length) => {
115
- const obj = {};
116
- const end = length == null ? reader.len : reader.pos + length;
117
- while (reader.pos < end) {
118
- const tag = reader.uint32();
119
- switch (tag >>> 3) {
120
- case 1:
121
- obj.peer = Message.PeerInfo.codec().decode(reader, reader.uint32());
122
- break;
123
- default:
124
- reader.skipType(tag & 7);
125
- break;
126
- }
127
- }
128
- return obj;
129
- });
130
- }
131
- return _codec;
132
- };
133
- Dial.encode = (obj) => {
134
- return encodeMessage(obj, Dial.codec());
135
- };
136
- Dial.decode = (buf) => {
137
- return decodeMessage(buf, Dial.codec());
138
- };
139
- })(Dial = Message.Dial || (Message.Dial = {}));
140
- let DialResponse;
141
- (function (DialResponse) {
142
- let _codec;
143
- DialResponse.codec = () => {
144
- if (_codec == null) {
145
- _codec = message((obj, w, opts = {}) => {
146
- if (opts.lengthDelimited !== false) {
147
- w.fork();
148
- }
149
- if (obj.status != null) {
150
- w.uint32(8);
151
- Message.ResponseStatus.codec().encode(obj.status, w);
152
- }
153
- if (obj.statusText != null) {
154
- w.uint32(18);
155
- w.string(obj.statusText);
156
- }
157
- if (obj.addr != null) {
158
- w.uint32(26);
159
- w.bytes(obj.addr);
160
- }
161
- if (opts.lengthDelimited !== false) {
162
- w.ldelim();
163
- }
164
- }, (reader, length) => {
165
- const obj = {};
166
- const end = length == null ? reader.len : reader.pos + length;
167
- while (reader.pos < end) {
168
- const tag = reader.uint32();
169
- switch (tag >>> 3) {
170
- case 1:
171
- obj.status = Message.ResponseStatus.codec().decode(reader);
172
- break;
173
- case 2:
174
- obj.statusText = reader.string();
175
- break;
176
- case 3:
177
- obj.addr = reader.bytes();
178
- break;
179
- default:
180
- reader.skipType(tag & 7);
181
- break;
182
- }
183
- }
184
- return obj;
185
- });
186
- }
187
- return _codec;
188
- };
189
- DialResponse.encode = (obj) => {
190
- return encodeMessage(obj, DialResponse.codec());
191
- };
192
- DialResponse.decode = (buf) => {
193
- return decodeMessage(buf, DialResponse.codec());
194
- };
195
- })(DialResponse = Message.DialResponse || (Message.DialResponse = {}));
196
- let _codec;
197
- Message.codec = () => {
198
- if (_codec == null) {
199
- _codec = message((obj, w, opts = {}) => {
200
- if (opts.lengthDelimited !== false) {
201
- w.fork();
202
- }
203
- if (obj.type != null) {
204
- w.uint32(8);
205
- Message.MessageType.codec().encode(obj.type, w);
206
- }
207
- if (obj.dial != null) {
208
- w.uint32(18);
209
- Message.Dial.codec().encode(obj.dial, w);
210
- }
211
- if (obj.dialResponse != null) {
212
- w.uint32(26);
213
- Message.DialResponse.codec().encode(obj.dialResponse, w);
214
- }
215
- if (opts.lengthDelimited !== false) {
216
- w.ldelim();
217
- }
218
- }, (reader, length) => {
219
- const obj = {};
220
- const end = length == null ? reader.len : reader.pos + length;
221
- while (reader.pos < end) {
222
- const tag = reader.uint32();
223
- switch (tag >>> 3) {
224
- case 1:
225
- obj.type = Message.MessageType.codec().decode(reader);
226
- break;
227
- case 2:
228
- obj.dial = Message.Dial.codec().decode(reader, reader.uint32());
229
- break;
230
- case 3:
231
- obj.dialResponse = Message.DialResponse.codec().decode(reader, reader.uint32());
232
- break;
233
- default:
234
- reader.skipType(tag & 7);
235
- break;
236
- }
237
- }
238
- return obj;
239
- });
240
- }
241
- return _codec;
242
- };
243
- Message.encode = (obj) => {
244
- return encodeMessage(obj, Message.codec());
245
- };
246
- Message.decode = (buf) => {
247
- return decodeMessage(buf, Message.codec());
248
- };
249
- })(Message || (Message = {}));
250
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/autonat/pb/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,+BAA+B;AAC/B,oDAAoD;AACpD,8EAA8E;AAC9E,0DAA0D;AAE1D,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAUpF,MAAM,KAAW,OAAO,CA+SvB;AA/SD,WAAiB,OAAO;IACtB,IAAY,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C,GAAG,GAAG,CAAC,CAAC,CAAA;4BACxB,MAAK;qBACR;iBACF;gBAED,OAAO,GAAG,CAAA;YACZ,CAAC,CAAC,CAAA;SACH;QAED,OAAO,MAAM,CAAA;IACf,CAAC,CAAA;IAEY,cAAM,GAAG,CAAC,GAAqB,EAAc,EAAE;QAC1D,OAAO,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;IAC5C,CAAC,CAAA;IAEY,cAAM,GAAG,CAAC,GAAgC,EAAW,EAAE;QAClE,OAAO,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAA;IAC5C,CAAC,CAAA;AACH,CAAC,EA/SgB,OAAO,KAAP,OAAO,QA+SvB"}
@@ -1,50 +0,0 @@
1
- /**
2
- * Delay before HOP relay service is advertised on the network
3
- */
4
- export declare const ADVERTISE_BOOT_DELAY: number;
5
- /**
6
- * Delay Between HOP relay service advertisements on the network
7
- */
8
- export declare const ADVERTISE_TTL: number;
9
- /**
10
- * Multicodec code
11
- */
12
- export declare const CIRCUIT_PROTO_CODE = 290;
13
- /**
14
- * Relay HOP relay service namespace for discovery
15
- */
16
- export declare const RELAY_RENDEZVOUS_NS = "/libp2p/relay";
17
- /**
18
- * The maximum number of relay reservations the relay server will accept
19
- */
20
- export declare const DEFAULT_MAX_RESERVATION_STORE_SIZE = 15;
21
- /**
22
- * How often to check for reservation expiry
23
- */
24
- export declare const DEFAULT_MAX_RESERVATION_CLEAR_INTERVAL: number;
25
- /**
26
- * How often to check for reservation expiry
27
- */
28
- export declare const DEFAULT_MAX_RESERVATION_TTL: number;
29
- export declare const DEFAULT_RESERVATION_CONCURRENCY = 1;
30
- export declare const RELAY_SOURCE_TAG = "circuit-relay-source";
31
- export declare const RELAY_TAG = "circuit-relay-relay";
32
- export declare const DEFAULT_DURATION_LIMIT: number;
33
- export declare const DEFAULT_DATA_LIMIT: bigint;
34
- /**
35
- * The hop protocol
36
- */
37
- export declare const RELAY_V2_HOP_CODEC = "/libp2p/circuit/relay/0.2.0/hop";
38
- /**
39
- * the stop protocol
40
- */
41
- export declare const RELAY_V2_STOP_CODEC = "/libp2p/circuit/relay/0.2.0/stop";
42
- /**
43
- * Hop messages must be exchanged inside this timeout
44
- */
45
- export declare const DEFAULT_HOP_TIMEOUT: number;
46
- /**
47
- * How long to wait before starting to advertise the relay service
48
- */
49
- export declare const DEFAULT_ADVERT_BOOT_DELAY: number;
50
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/circuit-relay/constants.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,oBAAoB,QAAc,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,aAAa,QAAc,CAAA;AAExC;;GAEG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAA;AAErC;;GAEG;AACH,eAAO,MAAM,mBAAmB,kBAAkB,CAAA;AAElD;;GAEG;AACH,eAAO,MAAM,kCAAkC,KAAK,CAAA;AAEpD;;GAEG;AACH,eAAO,MAAM,sCAAsC,QAAe,CAAA;AAElE;;GAEG;AACH,eAAO,MAAM,2BAA2B,QAAkB,CAAA;AAE1D,eAAO,MAAM,+BAA+B,IAAI,CAAA;AAEhD,eAAO,MAAM,gBAAgB,yBAAyB,CAAA;AAEtD,eAAO,MAAM,SAAS,wBAAwB,CAAA;AAM9C,eAAO,MAAM,sBAAsB,QAAa,CAAA;AAGhD,eAAO,MAAM,kBAAkB,QAAkB,CAAA;AAEjD;;GAEG;AACH,eAAO,MAAM,kBAAkB,oCAAoC,CAAA;AAEnE;;GAEG;AACH,eAAO,MAAM,mBAAmB,qCAAqC,CAAA;AAErE;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAc,CAAA;AAE9C;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAc,CAAA"}
@@ -1,56 +0,0 @@
1
- const second = 1000;
2
- const minute = 60 * second;
3
- /**
4
- * Delay before HOP relay service is advertised on the network
5
- */
6
- export const ADVERTISE_BOOT_DELAY = 15 * minute;
7
- /**
8
- * Delay Between HOP relay service advertisements on the network
9
- */
10
- export const ADVERTISE_TTL = 30 * minute;
11
- /**
12
- * Multicodec code
13
- */
14
- export const CIRCUIT_PROTO_CODE = 290;
15
- /**
16
- * Relay HOP relay service namespace for discovery
17
- */
18
- export const RELAY_RENDEZVOUS_NS = '/libp2p/relay';
19
- /**
20
- * The maximum number of relay reservations the relay server will accept
21
- */
22
- export const DEFAULT_MAX_RESERVATION_STORE_SIZE = 15;
23
- /**
24
- * How often to check for reservation expiry
25
- */
26
- export const DEFAULT_MAX_RESERVATION_CLEAR_INTERVAL = 300 * second;
27
- /**
28
- * How often to check for reservation expiry
29
- */
30
- export const DEFAULT_MAX_RESERVATION_TTL = 2 * 60 * minute;
31
- export const DEFAULT_RESERVATION_CONCURRENCY = 1;
32
- export const RELAY_SOURCE_TAG = 'circuit-relay-source';
33
- export const RELAY_TAG = 'circuit-relay-relay';
34
- // circuit v2 connection limits
35
- // https://github.com/libp2p/go-libp2p/blob/master/p2p/protocol/circuitv2/relay/resources.go#L61-L66
36
- // 2 min is the default connection duration
37
- export const DEFAULT_DURATION_LIMIT = 2 * minute;
38
- // 128k is the default data limit
39
- export const DEFAULT_DATA_LIMIT = BigInt(1 << 17);
40
- /**
41
- * The hop protocol
42
- */
43
- export const RELAY_V2_HOP_CODEC = '/libp2p/circuit/relay/0.2.0/hop';
44
- /**
45
- * the stop protocol
46
- */
47
- export const RELAY_V2_STOP_CODEC = '/libp2p/circuit/relay/0.2.0/stop';
48
- /**
49
- * Hop messages must be exchanged inside this timeout
50
- */
51
- export const DEFAULT_HOP_TIMEOUT = 30 * second;
52
- /**
53
- * How long to wait before starting to advertise the relay service
54
- */
55
- export const DEFAULT_ADVERT_BOOT_DELAY = 30 * second;
56
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","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,yBAAyB,GAAG,EAAE,GAAG,MAAM,CAAA"}
@@ -1,55 +0,0 @@
1
- /**
2
- * @packageDocumentation
3
- *
4
- * The `circuitRelayTransport` allows libp2p to dial and listen on [Circuit Relay](https://docs.libp2p.io/concepts/nat/circuit-relay/)
5
- * addresses.
6
- *
7
- * @example
8
- *
9
- * ```typescript
10
- * import { createLibp2p } from 'libp2p'
11
- * import { circuitRelayTransport } from 'libp2p/circuit-relay'
12
- *
13
- * const node = await createLibp2p({
14
- * transports: [
15
- * circuitRelayTransport()
16
- * ]
17
- * })
18
- * ```
19
- *
20
- * The `circuitRelayServer` function allows libp2p to function as a [Circuit Relay](https://docs.libp2p.io/concepts/nat/circuit-relay/)
21
- * server. This will not work in browsers.
22
- *
23
- * @example
24
- *
25
- * ```typescript
26
- * import { createLibp2p } from 'libp2p'
27
- * import { circuitRelayServer } from 'libp2p/circuit-relay'
28
- *
29
- * const node = await createLibp2p({
30
- * services: [
31
- * circuitRelay: circuitRelayServer()
32
- * ]
33
- * })
34
- * ```
35
- */
36
- import type { Limit } from './pb/index.js';
37
- import type { TypedEventEmitter } from '@libp2p/interface/events';
38
- import type { PeerMap } from '@libp2p/peer-collections';
39
- import type { Multiaddr } from '@multiformats/multiaddr';
40
- export interface RelayReservation {
41
- expire: Date;
42
- addr: Multiaddr;
43
- limit?: Limit;
44
- }
45
- export interface CircuitRelayServiceEvents {
46
- 'relay:reservation': CustomEvent<RelayReservation>;
47
- 'relay:advert:success': CustomEvent<unknown>;
48
- 'relay:advert:error': CustomEvent<Error>;
49
- }
50
- export interface CircuitRelayService extends TypedEventEmitter<CircuitRelayServiceEvents> {
51
- reservations: PeerMap<RelayReservation>;
52
- }
53
- export { circuitRelayServer } from './server/index.js';
54
- export { circuitRelayTransport } from './transport/index.js';
55
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/circuit-relay/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,IAAI,CAAA;IACZ,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED,MAAM,WAAW,yBAAyB;IACxC,mBAAmB,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAA;IAClD,sBAAsB,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC5C,oBAAoB,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;CACzC;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB,CAAC,yBAAyB,CAAC;IACvF,YAAY,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;CACxC;AAED,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA"}
@@ -1,38 +0,0 @@
1
- /**
2
- * @packageDocumentation
3
- *
4
- * The `circuitRelayTransport` allows libp2p to dial and listen on [Circuit Relay](https://docs.libp2p.io/concepts/nat/circuit-relay/)
5
- * addresses.
6
- *
7
- * @example
8
- *
9
- * ```typescript
10
- * import { createLibp2p } from 'libp2p'
11
- * import { circuitRelayTransport } from 'libp2p/circuit-relay'
12
- *
13
- * const node = await createLibp2p({
14
- * transports: [
15
- * circuitRelayTransport()
16
- * ]
17
- * })
18
- * ```
19
- *
20
- * The `circuitRelayServer` function allows libp2p to function as a [Circuit Relay](https://docs.libp2p.io/concepts/nat/circuit-relay/)
21
- * server. This will not work in browsers.
22
- *
23
- * @example
24
- *
25
- * ```typescript
26
- * import { createLibp2p } from 'libp2p'
27
- * import { circuitRelayServer } from 'libp2p/circuit-relay'
28
- *
29
- * const node = await createLibp2p({
30
- * services: [
31
- * circuitRelay: circuitRelayServer()
32
- * ]
33
- * })
34
- * ```
35
- */
36
- export { circuitRelayServer } from './server/index.js';
37
- export { circuitRelayTransport } from './transport/index.js';
38
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/circuit-relay/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAuBH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA"}
@@ -1,93 +0,0 @@
1
- import type { Codec } from 'protons-runtime';
2
- import type { Uint8ArrayList } from 'uint8arraylist';
3
- export interface HopMessage {
4
- type?: HopMessage.Type;
5
- peer?: Peer;
6
- reservation?: Reservation;
7
- limit?: Limit;
8
- status?: Status;
9
- }
10
- export declare namespace HopMessage {
11
- enum Type {
12
- RESERVE = "RESERVE",
13
- CONNECT = "CONNECT",
14
- STATUS = "STATUS"
15
- }
16
- namespace Type {
17
- const codec: () => Codec<Type>;
18
- }
19
- const codec: () => Codec<HopMessage>;
20
- const encode: (obj: Partial<HopMessage>) => Uint8Array;
21
- const decode: (buf: Uint8Array | Uint8ArrayList) => HopMessage;
22
- }
23
- export interface StopMessage {
24
- type?: StopMessage.Type;
25
- peer?: Peer;
26
- limit?: Limit;
27
- status?: Status;
28
- }
29
- export declare namespace StopMessage {
30
- enum Type {
31
- CONNECT = "CONNECT",
32
- STATUS = "STATUS"
33
- }
34
- namespace Type {
35
- const codec: () => Codec<Type>;
36
- }
37
- const codec: () => Codec<StopMessage>;
38
- const encode: (obj: Partial<StopMessage>) => Uint8Array;
39
- const decode: (buf: Uint8Array | Uint8ArrayList) => StopMessage;
40
- }
41
- export interface Peer {
42
- id: Uint8Array;
43
- addrs: Uint8Array[];
44
- }
45
- export declare namespace Peer {
46
- const codec: () => Codec<Peer>;
47
- const encode: (obj: Partial<Peer>) => Uint8Array;
48
- const decode: (buf: Uint8Array | Uint8ArrayList) => Peer;
49
- }
50
- export interface Reservation {
51
- expire: bigint;
52
- addrs: Uint8Array[];
53
- voucher?: Uint8Array;
54
- }
55
- export declare namespace Reservation {
56
- const codec: () => Codec<Reservation>;
57
- const encode: (obj: Partial<Reservation>) => Uint8Array;
58
- const decode: (buf: Uint8Array | Uint8ArrayList) => Reservation;
59
- }
60
- export interface Limit {
61
- duration?: number;
62
- data?: bigint;
63
- }
64
- export declare namespace Limit {
65
- const codec: () => Codec<Limit>;
66
- const encode: (obj: Partial<Limit>) => Uint8Array;
67
- const decode: (buf: Uint8Array | Uint8ArrayList) => Limit;
68
- }
69
- export declare enum Status {
70
- UNUSED = "UNUSED",
71
- OK = "OK",
72
- RESERVATION_REFUSED = "RESERVATION_REFUSED",
73
- RESOURCE_LIMIT_EXCEEDED = "RESOURCE_LIMIT_EXCEEDED",
74
- PERMISSION_DENIED = "PERMISSION_DENIED",
75
- CONNECTION_FAILED = "CONNECTION_FAILED",
76
- NO_RESERVATION = "NO_RESERVATION",
77
- MALFORMED_MESSAGE = "MALFORMED_MESSAGE",
78
- UNEXPECTED_MESSAGE = "UNEXPECTED_MESSAGE"
79
- }
80
- export declare namespace Status {
81
- const codec: () => Codec<Status>;
82
- }
83
- export interface ReservationVoucher {
84
- relay: Uint8Array;
85
- peer: Uint8Array;
86
- expiration: bigint;
87
- }
88
- export declare namespace ReservationVoucher {
89
- const codec: () => Codec<ReservationVoucher>;
90
- const encode: (obj: Partial<ReservationVoucher>) => Uint8Array;
91
- const decode: (buf: Uint8Array | Uint8ArrayList) => ReservationVoucher;
92
- }
93
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../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