-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dependency injection during boot time #130
Comments
One problem with this setting is the discovery. Usually, a discovery module is extracted from the transport module, something like this: const wstar = new WRTCStar()
{
modules: {
transport: [
wstar
],
discovery: [ wstar.discovery ]
}
} One option to mitigate this would be to implicitely add the discovery module if the transport instance contains a Another workaround would be to cache it like this: let wsstar // caches the WSStar object instance
const createWSStar = ({peerId}) => (wsstar ? wsstar : wsstar = new WSStar({id: peerId}))
const libp2pOptions = {
modules: {
transport: [
createWSStar
],
discovery: [
(options) => createWSStar(options).discovery
]
}
} Thoughts? |
/cc @diasdavid @mkg20001 |
(Probably should replace |
Another approach might be passing an instance of swarm to the transport during initialization, the peerId/peerInfo can be extracted from it. We already do that for DHT and Circuit. |
Let's continue evaluating this, I need to think more about it but I am in the same page that we need DI. |
overall, 👍 for DI, should make things a lot more testable and such! |
Currently I'm using a |
PR #160 |
@mkg20001 why not just pass |
Because usually transports get created before the libp2p object gets created (afaik) |
@mkg20001 you're right, swarm gets created after the protos get instantiated. |
Here is what I'm thinking the right way to go about this. Each libp2p module should expose:
Note: I'm calling libp2p-switch to the libp2p-swarm as part of the rename endeavour https://github.com/libp2p/js-libp2p-swarm/issues/40 |
Why re-invent the wheel? If we we want Fast search of NPM came up with https://www.npmjs.com/package/inversify |
Fair point, however, I don't see how that module will help us. It does way more things than what we need and it is TypeScript only. We don't want full DI with a TypeSystem (although that would be great), we are looking to add support for libp2p modules to use libp2p itself. |
I'll leave this here for consideration - https://github.com/dryajov/opium, it's pure es6 (needs to be updated to remote all the babel stuff that is not needed anymore). But its a full fledged IoC library. |
Reviewing this, it seems like the original problem that needed to be solved with DI was the boot time dependency injection, specifically knowing the Using Libp2p exclusively, this should be doable. One of the big problems was trying to customize libp2p within IPFS. The latest version of IPFS now supports passing a function that allows you to generate your libp2p bundle on ipfs boot time, which should resolve a lot of these issues. There is an example of that at https://github.com/ipfs/js-ipfs/tree/master/examples/custom-libp2p. Are there current issues that this doesn't solve for that DI is needed for? |
@pgte any final remarks before closing this one? |
36f4830b Update subtree cdab763b Squashed 'util/prometheus-metrics/' changes from 7756331..4cdae25 dfe97c5d Update subtree 163d593c Squashed 'util/cms/' changes from f6e2f944..24b05bc5 530b3574 Update subtree 5bb8dbf1 Squashed 'util/peer-record/' changes from 78ab160..a98220d ddf3827d Update subtree 0d3eb5f7 Squashed 'util/keychain/' changes from a8ad7f6..89e9fa9 03f5db80 Update subtree 66592d3f Squashed 'util/tracked-map/' changes from 80163d7..3cd54ac 793f8ee3 Update subtree fb3b0316 Squashed 'util/bootstrap/' changes from 2771c45..4877f5a d7da47c9 Update subtree 0fab4fd3 Squashed 'util/daemon/' changes from bfe013be..9318c3d1 561889ed Update subtree a602dc34 Squashed 'util/utils/' changes from acad1fe..ec1b7b9 af41d91d Update subtree 4160c1b3 Squashed 'util/record/' changes from 7933249..2c199b7 8febea47 Update subtree 4a2bb311 Squashed 'util/logger/' changes from 4bf1a9d..6e5ed97 1ddd0bd2 Update subtree 5d7d8581 Squashed 'util/topology/' changes from 8d3e9af..b13b3a2 3cafa44d Update subtree 870098b9 Squashed 'util/pubsub-peer-discovery/' changes from 740b7973..bd0ed1ee b9d4e0a0 Update subtree 2102bb13 Squashed 'protocols/mdns/' changes from 5e82b6d..db35c30 d29d0e93 Update subtree f176ff6c Squashed 'protocols/peer-routing/' changes from b0f81bf2..c8692f6b e92a9b15 Update subtree d1114922 Squashed 'protocols/delegated-content-routing/' changes from 8fc0c064..7c0cf9cb 22ec4687 Update subtree 3979dd0d Squashed 'protocols/floodsub/' changes from fccc516..3f27941 a2a294a6 Update subtree 6dd5b320 Squashed 'protocols/multistream-select/' changes from 1861a94..b7ef1f7 d19e1786 Update subtree d49cbd25 Squashed 'protocols/kad/' changes from e5ef228..0e73ed3 300d19f0 Update subtree 05f9eea5 Squashed 'transports/websockets/' changes from ae19510..3225d4c a2e21c58 Update subtree 5d714285 Squashed 'transports/tcp/' changes from 05bd31c..04fa66c 040ad07b Update subtree 4be2fa24 Squashed 'muxers/mplex/' changes from 54de88d..31a32f3 9b6ce69c Update subtree fc17e851 Squashed 'core/interfaces/' changes from 6a810c19..7b3b9967 be94f856 Update subtree ef2e321b Squashed 'core/js-libp2p/' changes from d6c8601..5e63ee2 6b9263af Update subtree 680ea5e7 Squashed 'core/peer-store/' changes from 0c7069b..3df533c fd564f70 Update subtree f8544ea8 Squashed 'core/crypto/' changes from ee4a3b3..e7bb8b2 92463655 Update subtree 9d952a11 Squashed 'core/peer-id/' changes from 8fe66ac..e309961 463b89ed Update subtree 743984b9 Squashed 'core/pubsub/' changes from b1c5590..d502db7 b44a757d Add merge message 5925314f Merge commit '525844fb68f3a42b7693acbd18f05c2db32413c8' 525844fb Squashed 'protocols/relay-server/' changes from 1819ee1e..6b86ceaa b952050f Squashed 'protocols/kad/' changes from 3ae2395..e5ef228 59819383 Merge commit 'b952050fc8af37b3fd249be34aae45225699330e' 600f8de3 Squashed 'core/js-libp2p/' changes from afaee4c..d6c8601 ef9637b9 Merge commit '600f8de33a574094cf8ed84d1045af7a767d6f13' 8a722cd8 Squashed 'util/peer-record/' changes from 6e378ef..78ab160 ee685ed0 Merge commit '8a722cd85b5199d80f572fe38b083b52e2fd1d27' a7eb777c Squashed 'util/keychain/' changes from f3985cc..a8ad7f6 a7b7819d Merge commit 'a7eb777c12337ba14441ca9d3dd3bbc434b14315' 1fbd3e91 Squashed 'util/logger/' changes from a24089e..4bf1a9d ad900cc9 Merge commit '1fbd3e917d56586b170cc9c5b75fbdf2fccc3ba2' cd209207 Squashed 'core/peer-store/' changes from d2b7c22..0c7069b 2efacc02 Merge commit 'cd209207ad7d4a41e8b9c607b16e6701bd2a012a' 8959921a Squashed 'util/peer-record/' changes from 157d49d..6e378ef 61e15d99 Merge commit '8959921ad96aab7a4f17fdfab0d0c833fd3ddd0e' 7fb053be Squashed 'util/record/' changes from 3982918..7933249 3bd5b7b9 Merge commit '7fb053bee8a7e8dcccba59aa69c94a2505e87555' dd8132c8 Squashed 'protocols/floodsub/' changes from 258b856..fccc516 f841b512 Merge commit 'dd8132c8b1d434b1309066e72da4e90a026dfc05' 5b4102d0 Squashed 'protocols/kad/' changes from a70ab3f..3ae2395 9a93db62 Merge commit '5b4102d02ba1c710d25201383831230e0acae6c9' fbd4be6d Squashed 'core/interfaces/' changes from 81e36ccb..6a810c19 5cb9494d Merge commit 'fbd4be6df61bc5f2513f2a12829632412d4c2aa0' 10808a52 Squashed 'core/crypto/' changes from b66007c..ee4a3b3 dbabae1e Merge commit '10808a526076f8dddf4e0ef148941ab55d9a3604' 21f0d7d5 Squashed 'core/peer-id/' changes from 585dc1b..8fe66ac 528872d6 Merge commit '21f0d7d58f4f8aa6c564b02d471921b7ec47f376' 9328cada Merge commit '4480c97781f657d4e2f43940d930f157ac93b379' 4480c977 Squashed 'util/metrics/' changes from ae10ccf3..8e401f06 852d7c69 Squashed 'util/prometheus-metrics/' changes from 1a3861f..7756331 b7de851b Merge commit '852d7c69f1c7ea913d9c0e9f419d1d0da5abdffb' 18f2f7a7 Merge commit '7158f25886dbe0da45ee56f8bd0eab1149d27891' 7158f258 Squashed 'util/daemon-client/' changes from c31c457c..31b3615b 79eb57ea Squashed 'util/cms/' changes from 7ce9f67a..f6e2f944 1f908066 Merge commit '79eb57eae3f87a274145992aa19b74ef2f4ab6f1' d32e9924 Squashed 'util/peer-record/' changes from 920dfd3..157d49d cb3e839c Merge commit 'd32e992484c58c356d6d9baea29b86887ce86b6b' b3b227f2 Squashed 'util/keychain/' changes from d8b81ff..f3985cc 907e7eff Merge commit 'b3b227f2b06962635516a91d378a9911c71dff40' 80e25b36 Squashed 'util/tracked-map/' changes from 5fc1905..80163d7 6eb0ce1f Merge commit '80e25b36972ad21a1bc15c10455d31d7a8e70f86' 40d160d0 Squashed 'util/bootstrap/' changes from bdc51df..2771c45 d2c6ed00 Merge commit '40d160d027289da5ba39b7d03ee47212ccaa7e58' 53956bdb Squashed 'util/daemon/' changes from 51204865..bfe013be d2d1a87a Merge commit '53956bdbd689716e386a6fd8d2b8fe61fd494fec' 801b393d Squashed 'util/utils/' changes from 1b96837..acad1fe df262ea6 Merge commit '801b393db20916c3157d224925a12d8f2d8aa2d7' 311907ef Squashed 'util/record/' changes from 79984c0..3982918 871a52a9 Merge commit '311907ef35dd97164f9e2a34a352518f65e6b02c' 93e5c179 Squashed 'util/logger/' changes from 36c0fe1..a24089e 2e90d906 Merge commit '93e5c179eb8c0ad2099e96e6b7e0db58a6efe73b' 504ad5f8 Squashed 'util/topology/' changes from aae4c14..8d3e9af 6dfe2e37 Merge commit '504ad5f82458039709ec84b4b027d10b03f7c8c7' 013e74bb Squashed 'util/pubsub-peer-discovery/' changes from 0d8e5d25..740b7973 dbfc8261 Merge commit '013e74bb0bd8ebc32985a9fdbb312e0e9d627f41' ec07fedf Squashed 'protocols/mdns/' changes from 124fd47..5e82b6d a8b64525 Merge commit 'ec07fedf118b547b074830e71ceeafcf3e6fbcae' c1518f04 Squashed 'protocols/peer-routing/' changes from 17e79283..b0f81bf2 dc41e7b1 Merge commit 'c1518f04a3c01aadb4497e4ab96f8905c4a7f438' ff8be937 Merge commit 'a5bad7195cdad2d17096907f5916dbed08929137' a5bad719 Squashed 'protocols/rendezvous/' changes from 30f0978b..4becc8cd ca0ec30c Squashed 'protocols/relay-server/' changes from c3c9e121..1819ee1e 83309722 Merge commit 'ca0ec30c157bc7e8fc3d36cecc4a1b21330aeee8' 7322a048 Squashed 'protocols/delegated-content-routing/' changes from 4d7de631..8fc0c064 6b694617 Merge commit '7322a048a91040d2124443c0805e5867668b02b0' aba3ff53 Squashed 'protocols/floodsub/' changes from 3e5da6a..258b856 2d68fe66 Merge commit 'aba3ff532584e1380c36d9ee46a915cf4ac3d949' 5296c9e3 Squashed 'protocols/multistream-select/' changes from 0f312c0..1861a94 2781517c Merge commit '5296c9e3db4555cfa77576aeb1fdb3989c8b69a4' 0a2c055d Squashed 'protocols/kad/' changes from 1652c6c..a70ab3f 34747325 Merge commit '0a2c055d334f92bae3d33f083b97ee7c3a8cceb7' 2005dfd4 Merge commit 'f55a9e0ba35ccaab76b915c783db8e47b58e19bd' f55a9e0b Squashed 'transports/webtransport/' changes from 63f0c33..9435f0d 7aae29b9 Squashed 'transports/websockets/' changes from f21d488..ae19510 c58608eb Merge commit '7aae29b9db8200943336f2a98bdf00c578313ed9' 5e03b04a Squashed 'transports/tcp/' changes from bbd4c2a..05bd31c e2b03866 Merge commit '5e03b04a2f3659956049b005ee95eba1d2ec235d' 30b88df1 Squashed 'muxers/mplex/' changes from df03e8d..54de88d 65cac8ce Merge commit '30b88df176a7bc6482bb76ce228fcfeeabe1fdc5' 63b5c619 Squashed 'core/interfaces/' changes from 4e664c69..81e36ccb 4907ed3a Merge commit '63b5c619e3f0a04c3828df4e31903d86e8ba929a' c3008393 Squashed 'core/js-libp2p/' changes from 593deef..afaee4c 5392eb51 Merge commit 'c3008393a2654d61a573d44bba589f1eb5afff39' 2c09d4f7 Squashed 'core/peer-store/' changes from 271731c..d2b7c22 149cab18 Merge commit '2c09d4f7517900b98e0faca402679ff221db0735' e0923a49 Squashed 'core/crypto/' changes from 110063c..b66007c 523f3d62 Merge commit 'e0923a49a05f5777cce02fbfeb00cf6e809b966e' 83e09682 Squashed 'core/peer-id/' changes from 05df4e7..585dc1b 9d904aa2 Merge commit '83e09682373f7c509ce9d4e343a4456064e7626d' 59362de4 Squashed 'core/pubsub/' changes from f83a2f7..b1c5590 2e8f5a07 Merge commit '59362de4338c9f88e879eff2c67adb16d791b00b' 5e48a83c debug fde4dc57 Merge commit 'ea34aa39cfaab5b7d5f174327ae4dcd22146a3f6' ea34aa39 Squashed 'core/interfaces/' changes from ef98717e..4e664c69 802d3201 debug 9727f1cf debug 9debbb25 debug abbb1ad6 debug 7d6c0b5f debug 9df0b1d8 debug 40f8f178 debug 4b1b4891 debug 4f976625 Debug 0a5d8d0b Update readme with example 5bab1568 Revert "do not merge: dummy edit" 84905098 do not merge: dummy edit 5d132e5c Update readme 460c1732 Update subtree in GH actions 4011fda7 Squashed 'protocols/mdns/' content from commit 124fd47 9776a1fa Merge commit '4011fda70cedfe726e3be0a2c4bb3055c6cd6ac1' as 'protocols/mdns' 9ba8ed23 Update c780ecfd Squashed 'protocols/peer-routing/' content from commit 17e79283 c8a7ec15 Merge commit 'c780ecfd830d165af11498ef4d7cc1e394e8edb3' as 'protocols/peer-routing' b126956a Update d49f4c9e Add script 5b8c4e88 Readme update 21ddd99c Merge commit '057ba120fcc5af9352014aca1c62ae33ddf9782f' as 'secure-channels/noise' 057ba120 Squashed 'secure-channels/noise/' content from commit 7419a672 fea8c690 Squashed 'transports/tcp/' content from commit bbd4c2a 8486dbf8 Merge commit 'fea8c690be53491e34e38c436495a2a2fd7fc44c' as 'transports/tcp' b3e4ce41 Squashed 'util/cms/' content from commit 7ce9f67a 5914edea Merge commit 'b3e4ce41229f44cf162d077f0b107a3a78b985ee' as 'util/cms' 72f819b0 Squashed 'util/peer-record/' content from commit 920dfd3 92d9eee8 Merge commit '72f819b05fba7f7803998ee0631aa16c35f8b678' as 'util/peer-record' be22de91 Squashed 'util/keychain/' content from commit d8b81ff 3ec919ed Merge commit 'be22de9147744550e64118bb859cea19dbe35d84' as 'util/keychain' 68a36277 Squashed 'util/tracked-map/' content from commit 5fc1905 37053727 Merge commit '68a362777524efae8e2fd1e85f69854b818e7de6' as 'util/tracked-map' f014d2f0 Squashed 'util/bootstrap/' content from commit bdc51df b013f089 Merge commit 'f014d2f00666bd9cc8ea89c4aaa72e6dab091441' as 'util/bootstrap' 3d8793a9 Squashed 'util/daemon/' content from commit 51204865 26146444 Merge commit '3d8793a9cdfb1ce91b6c57cd3dfa0d7abc5dc8fa' as 'util/daemon' 3b5e0df2 Squashed 'util/utils/' content from commit 1b96837 fdff7725 Merge commit '3b5e0df24c4a1f390a3945e5c3f77b57481c2bc2' as 'util/utils' 31446507 Squashed 'util/record/' content from commit 79984c0 efacf31f Merge commit '31446507c5bf50da6dcc82aa234ad0068a649b20' as 'util/record' f46a2cf3 Squashed 'util/logger/' content from commit 36c0fe1 37b575ec Merge commit 'f46a2cf3f3181e14782794ff9ff03b1c741822d8' as 'util/logger' 0ea76e6e Squashed 'util/topology/' content from commit aae4c14 4fcaeb1e Merge commit '0ea76e6e0052a3a7d9f92330e8e71a7ff53eb14f' as 'util/topology' 38a7daee Squashed 'util/pubsub-peer-discovery/' content from commit 0d8e5d25 09bc72d8 Merge commit '38a7daeef0b848848100fa8065336fcbb55d5920' as 'util/pubsub-peer-discovery' 5e7f0a90 Squashed 'core/peer-store/' content from commit 271731c fba97198 Merge commit '5e7f0a9002039cbda0ebd284682385b5c7ba2362' as 'core/peer-store' e11dc286 Squashed 'core/crypto/' content from commit 110063c 6ebe9721 Merge commit 'e11dc2862e01caa2abdc4c19e2b7ecc9c0f54f6c' as 'core/crypto' f2b15850 Squashed 'core/peer-id/' content from commit 05df4e7 96d99388 Merge commit 'f2b15850645e8b68d9045194fdb2c08cd8570759' as 'core/peer-id' f83e5be8 Squashed 'core/pubsub/' content from commit f83a2f7 3733b5f6 Merge commit 'f83e5be8d18d2144a45777ca6b427ec76e371e67' as 'core/pubsub' 7a9fe377 Squashed 'protocols/relay-server/' content from commit c3c9e121 fc0e9524 Merge commit '7a9fe37730bf71a67b11a5caddac229e591abb54' as 'protocols/relay-server' 3f50bf6b Merge commit '18abb858c4803235ee65509ac7a4d6ca47c7c818' as 'protocols/gossipsub' 18abb858 Squashed 'protocols/gossipsub/' content from commit 1e1cf5a7 c16cef06 Squashed 'protocols/rendezvous/' content from commit 30f0978b ffff84c5 Merge commit 'c16cef0661a802275962384239566515ba2acc9c' as 'protocols/rendezvous' d4aa076b Squashed 'protocols/delegated-content-routing/' content from commit 4d7de631 10c52cbb Merge commit 'd4aa076b1db1e526c4dfab6c549a20f91a301e83' as 'protocols/delegated-content-routing' 5765e7c2 Squashed 'protocols/floodsub/' content from commit 3e5da6a c79fcf57 Merge commit '5765e7c285b2c52cdbb0bd8408c501bcaeb8eacf' as 'protocols/floodsub' 48f79287 Squashed 'protocols/multistream-select/' content from commit 0f312c0 2a415fca Merge commit '48f79287c30ec3ef56f8e469d0bcffe4e25bdfb4' as 'protocols/multistream-select' 30cf8279 Squashed 'protocols/kad/' content from commit 1652c6c 13099cb7 Merge commit '30cf82790a97866f22e00de0185d75e9a2fe17e4' as 'protocols/kad' eaf2d970 Readme update f52e166c Merge commit 'c2ff3ba4215860055dd81beccecbd1fd26755f66' as 'muxers/yamux' c2ff3ba4 Squashed 'muxers/yamux/' content from commit da397130 9f156986 Squashed 'muxers/mplex/' content from commit df03e8d 23ae1da6 Merge commit '9f1569862aa64be1fbfd1cfcdf923b9636de3401' as 'muxers/mplex' 67542820 Readme update e51cb2b1 Rename 04c1ebde Squashed 'transports/webtransport/' content from commit 63f0c33 06cafb21 Merge commit '04c1ebde11d1e84ab45609639c099b7157f4bc5b' as 'transports/webtransport' 07ecfa4d Update readme 367147e6 Squashed 'util/metrics/' content from commit ae10ccf3 aa8ff1aa Merge commit '367147e60b0b6f6bbcf87768ac76305e8adde815' as 'util/metrics' 1d970a97 Squashed 'util/prometheus-metrics/' content from commit 1a3861f e3a03a6d Merge commit '1d970a972861c639c5f425e19c28d6a506720f19' as 'util/prometheus-metrics' f4162acb Squashed 'util/daemon-client/' content from commit c31c457c 2460143c Merge commit 'f4162acb67d56a38ba44fb6af3fffb064e004784' as 'util/daemon-client' bc854afa Squashed 'transports/websockets/' content from commit f21d488 22709886 Merge commit 'bc854afa7a485aab53770e195890afd7b25099e7' as 'transports/websockets' 0b350996 Merge commit '6bb3dd86ee2623c4901833d6c03b9eb34469269d' as 'transports/webrtc' 6bb3dd86 Squashed 'transports/webrtc/' content from commit 4066d29f a3fbf1d5 Merge commit '79533f835d9b38b1ff202aa1e01140c055cce8dc' as 'p2p/mdns' 79533f83 Squashed 'p2p/mdns/' content from commit 124fd47 3410042e Merge commit '6bfa6c7ad18942c91ad37abb94612865e2b50b66' as 'p2p/peer-routing' 6bfa6c7a Squashed 'p2p/peer-routing/' content from commit 17e79283 acb45046 Squashed 'core/interfaces/' content from commit ef98717e 102164ce Merge commit 'acb450468e9b60bcd37497993e99723333f457dc' as 'core/interfaces' ad5cac48 Squashed 'core/js-libp2p/' content from commit 593deef 240d2d60 Merge commit 'ad5cac487b4394d30f79027d4b0b0aecb8d4ce58' as 'core/js-libp2p' 30fb8e4d Initial commit REVERT: d502db7 update .github/workflows/js-test-and-release.yml (#131) REVERT: b1c5590 chore: Update .github/workflows/semantic-pull-request.yml [skip ci] REVERT: f83a2f7 chore: Update .github/workflows/semantic-pull-request.yml [skip ci] REVERT: 5f4b45b update .github/workflows/js-test-and-release.yml (#130) REVERT: 172cb29 chore(release): 6.0.4 [skip ci] REVERT: 7609545 deps(dev): bump aegir from 37.12.1 to 38.1.6 (#128) REVERT: 9c2c7cb chore(release): 6.0.3 [skip ci] REVERT: 302763e deps(dev): bump protons from 6.1.3 to 7.0.2 (#124) REVERT: 0a30cf6 chore(release): 6.0.2 [skip ci] REVERT: c183c70 fix: get key from peer id if not specified in the message (#129) REVERT: 9839b71 chore: Update .github/workflows/semantic-pull-request.yml [skip ci] REVERT: 1280754 update .github/workflows/js-test-and-release.yml (#123) REVERT: 564a1e5 update .github/workflows/js-test-and-release.yml (#121) REVERT: 6f4e8af chore(release): 6.0.1 [skip ci] REVERT: 2567a45 fix: allow `key` field to be unset (#118) REVERT: e121e4b chore: replace err-code with CodeError (#116) REVERT: 8f85f86 chore(release): 6.0.0 [skip ci] REVERT: 148f554 fix!: update multiformats to v11 (#115) REVERT: 9a7b840 chore(release): 5.0.1 [skip ci] REVERT: bc20def docs: publish api docs (#113) REVERT: e4d74cf update .github/workflows/js-test-and-release.yml (#111) REVERT: 82dca43 update .github/workflows/js-test-and-release.yml (#110) REVERT: fb9fa8e update .github/workflows/js-test-and-release.yml (#108) REVERT: 43d2d9b update .github/workflows/js-test-and-release.yml (#107) REVERT: 8a2531c chore(release): 5.0.0 [skip ci] REVERT: 01707d7 fix!: remove @libp2p/components (#106) REVERT: cb50ec0 chore(release): 4.0.1 [skip ci] REVERT: 7a6f91d docs: update readme REVERT: f84d365 fix: update interface-pubsub and adjust topicValidator implementation (#102) REVERT: d442edc chore(release): 4.0.0 [skip ci] REVERT: fe407fe deps!: bump @libp2p/components from 2.1.1 to 3.0.0 (#103) REVERT: 914a441 update .github/workflows/js-test-and-release.yml (#100) REVERT: 2f11655 chore(release): 3.1.3 [skip ci] REVERT: 9524fa4 deps: update @multiformats/multiaddr to 11.0.0 (#101) REVERT: fcf5da9 chore: Update .github/workflows/stale.yml [skip ci] REVERT: 818aa3e update .github/workflows/js-test-and-release.yml (#99) REVERT: 7f692e9 chore(release): 3.1.2 [skip ci] REVERT: aa6dc45 deps(dev): update protons to 5.1.0 (#98) REVERT: 8b01d5f chore(release): 3.1.1 [skip ci] REVERT: 5d5d788 deps: update all deps (#94) REVERT: 31dc528 chore(release): 3.1.0 [skip ci] REVERT: 6d51017 feat: remove unnecessary direct dependency (#92) REVERT: 7a68b4b chore(release): 3.0.4 [skip ci] REVERT: f295fce deps: update it-length-prefixed and uint8arraylists deps (#91) REVERT: 3251829 chore: update project config (#86) REVERT: d8d5533 sync: update CI config files (#80) REVERT: 9ba829b chore(release): 3.0.3 [skip ci] REVERT: c066676 chore(deps): bump @libp2p/peer-collections from 1.0.3 to 2.0.0 (#79) REVERT: 4b116f2 chore(release): 3.0.2 [skip ci] REVERT: 760594e fix: do not unsubscribe after publish (#78) REVERT: 9cb24bc chore(release): 3.0.1 [skip ci] REVERT: d4f1779 fix: limit stream concurrency (#77) REVERT: a0ef679 chore(release): 3.0.0 [skip ci] REVERT: 50d1a5f chore!: update deps (#76) REVERT: f602e26 chore(release): 2.0.0 [skip ci] REVERT: fe38340 feat!: update to latest libp2p interfaces (#74) REVERT: cee5c38 chore: switch to ts version REVERT: d4b2bcb chore: add deprecation notice (#71) REVERT: 5540c58 chore: release version v0.6.0 REVERT: 1d2e02a chore: update contributors REVERT: 92632b5 fix: replace node buffers with uint8arrays (#70) REVERT: 1297ca1 chore: release version v0.5.6 REVERT: 3a74daf chore: update contributors REVERT: b7706ad Revert "chore: refactor message normalization (#59)" REVERT: de50542 chore: release version v0.5.5 REVERT: 4f166d2 chore: update contributors REVERT: dbc3d8c chore: refactor message normalization (#59) REVERT: e2ac419 chore: release version v0.5.4 REVERT: 0e47481 chore: update contributors REVERT: f86dfbc fix: quick reconnects (#57) REVERT: 66529fa chore: release version v0.5.3 REVERT: 95f4ea4 chore: update contributors REVERT: 60162b5 chore: prevent unecessary allocation (#49) REVERT: f3b06d9 fix: not create stream if it already exists (#48) REVERT: d478ed0 chore: release version v0.5.2 REVERT: ee7892a chore: update contributors REVERT: c6ba48d fix: use unidirectional streams (#45) REVERT: bcadfef chore(deps-dev): bump aegir from 21.10.2 to 22.0.0 (#43) REVERT: 508a632 chore: change libp2p-gossipsub url (#44) REVERT: fb53ce4 chore: release version v0.5.1 REVERT: efec8b7 chore: update contributors REVERT: 636041b fix: remove node globals (#42) REVERT: 363f655 chore: release version v0.5.0 REVERT: 38b7671 chore: update contributors REVERT: 721a53e Merge pull request #41 from libp2p/chore/remove-peer-info-usage REVERT: 071468f chore: update readme constructor example REVERT: 7aae306 chore: apply suggestions from code review REVERT: 21a63cb chore: remove peer-info usage REVERT: 59d49dc chore(deps-dev): bump aegir from 20.6.1 to 21.2.0 (#40) REVERT: 94b4b97 chore(deps-dev): bump sinon from 8.1.1 to 9.0.0 (#39) REVERT: 43dd116 chore: release version v0.4.3 REVERT: f8322f3 chore: update contributors REVERT: d452054 fix: remove use of assert module (#37) REVERT: 21d3017 chore: release version v0.4.2 REVERT: d952e22 chore: update contributors REVERT: 6461c33 chore: update deps (#36) REVERT: e0c7829 docs(fix): correct jsdocs for _processMessages (#35) REVERT: 651ab08 chore: release version v0.4.1 REVERT: d95aa8c chore: update contributors REVERT: 57453d4 fix: catch newStream errors (#34) REVERT: 1b866ca chore: fix getSubscribers api doc (#33) REVERT: ea8fac8 chore: release version v0.4.0 REVERT: 57086ad chore: update contributors REVERT: b76451e chore: getSubscribers (#32) REVERT: 1574023 chore: release version v0.3.2 REVERT: 25f604f chore: update contributors REVERT: d26a19c fix: reduce seqno to 8 bytes (#31) REVERT: a3371a0 chore: release version v0.3.1 REVERT: 34e8b73 chore: update contributors REVERT: 1b2af2c fix: incoming stream conn (#30) REVERT: 39309a5 chore: release version v0.3.0 REVERT: 12b6ae0 chore: update contributors REVERT: c690b29 refactor: async (#26) REVERT: 8669709 chore: release version v0.2.1 REVERT: 4780b60 chore: update contributors REVERT: 55624b5 feat: support inline public keys in messages REVERT: fbb1803 chore: remove commitlint REVERT: 3b3fcea feat: allow inline public keys in messages REVERT: 65fe4a5 chore: add gossipsub implementation in README REVERT: 6ec7836 fix: typo in README REVERT: 2684e36 fix: add gossipsub implementation in README REVERT: 929ec61 fix: typo in README REVERT: 9402257 chore: release version v0.2.0 REVERT: 71a3bbd chore: update contributors REVERT: 41f05bf feat: verify signatures REVERT: 73df77a test: add more tests for validate REVERT: ca99ce9 fix: use strict signing properly and fix callback issue REVERT: 8d7a9b4 chore: fix linting REVERT: 919e918 docs: add validate function to readme REVERT: c36fefa feat: add validate method for validating signatures REVERT: 4e551b0 Merge pull request #19 from libp2p/chore/enable-browser-tests REVERT: e66a7df chore: enable some browser tests REVERT: 5f4a7ad chore: release version v0.1.0 REVERT: 20c3df3 chore: update contributors REVERT: f1e1889 Merge pull request #17 from libp2p/feat/signing REVERT: 5cb17fd feat: add support for message signing REVERT: dda1894 chore: release version v0.0.4 REVERT: 8900c7d chore: update contributors REVERT: 6963e46 Merge pull request #15 from libp2p/chore/export-pubsub-utils REVERT: b607cc2 chore: export pubsub utils REVERT: 0eaed4b chore: add utils tests REVERT: d51a283 test: added utils test file from js-libp2p-floodsub REVERT: be03d16 chore: release version v0.0.3 REVERT: 0b05e07 chore: update contributors REVERT: 308607f chore: moved utilities from js-libp2p-floodsub REVERT: b654c37 fix: libp2p crypto for linting REVERT: cc566c8 Merge branch 'master' into master REVERT: c759f38 feat: added libp2p-crypto and bs58 dependencies REVERT: d83e357 feat: added utils.js from js-libp2p-floodsub REVERT: 5ef5a35 Merge pull request #12 from wemeetagain/fix/topicid REVERT: f9a27d7 fix: align topicid protobuf variable names REVERT: ae14d3e Merge pull request #10 from libp2p/chore/add-discourse-badge REVERT: 9ed7f37 chore: add discourse badge REVERT: 1d04874 Merge pull request #6 from libp2p/docs/overwriten-functions REVERT: ad1057f chore: suggestion REVERT: e40aec6 docs: overwritten functions REVERT: 1e4ce8c chore: release version v0.0.2 REVERT: cb3185e chore: update contributors REVERT: 9a395b2 Merge pull request #5 from ChainSafeSystems/master REVERT: b1e0695 chore: updated package.json and linted index.js REVERT: 13a56a4 feat: added a time cache and a mapping of topics to peers REVERT: 96f5334 chore: release version v0.0.1 REVERT: 57ab340 chore: update contributors REVERT: d0f7bdc chore: update package.json REVERT: 552e9b9 Merge pull request #2 from libp2p/feat/initial-implementation REVERT: 326d73d chore: improve docs REVERT: 7ca7f06 fix: code review REVERT: a68dc87 feat: initial implementation REVERT: e5502e9 chore: initial commit git-subtree-dir: core/pubsub git-subtree-split: 36f4830b1b1530f4727735cb37b23ac3b0bffd91
Co-authored-by: web3-bot <web3-bot@users.noreply.github.com>
Some libp2p modules require or would benefit from knowing the
peerId
and other values. It happens that, at the time the declarative options are created, the peerId is not yet known. As an example, libp2p-websocket-star would require thePeerId
object to prevent spoofing. It happens that this value is not known before boot.Here I propose a modules definition form that is backwards compatible and can be summed up to:
If a module is a function, libp2p assumes it is a constructor and executes that function, which should return a the module instance.
This would allow to declare config like this:
The text was updated successfully, but these errors were encountered: