This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
examples/browser-ipns-publish Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,16 @@ <h1 class="aqua fw2 montserrat dib ma0 pv2 ph1 v-mid fr f3 lh-copy">
137137 >
138138 Connect
139139 </ button >
140+ <!-- For localhost:
141+ placeholder=""
142+ -->
143+ < div
144+ class ="custom-block callout "
145+ style ="font-size: 0.75em; width: 75%; margin: 1em; "
146+ >
147+ For connecting to a local go-ipfs node, you may need to use
148+ < pre > /ip4/127.0.0.1/tcp/4003/ws/p2p/QmTheirServerPeerId</ pre >
149+ </ div >
140150 </ div >
141151
142152 < div class ="ph3 mb3 ">
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ const cryptoKeys = require("human-crypto-keys"); // { getKeyPairFromSeed }
99const uint8ArrayToString = require ( 'uint8arrays/to-string' )
1010const uint8ArrayFromString = require ( 'uint8arrays/from-string' )
1111
12+ const WS = require ( 'libp2p-websockets' )
13+ const transportKey = WS . prototype [ Symbol . toStringTag ]
14+ const filters = require ( 'libp2p-websockets/src/filters' )
15+
1216const { sleep, Logger, onEnterPress, catchAndLog } = require ( "./util" ) ;
1317
1418async function main ( ) {
@@ -39,6 +43,17 @@ async function main() {
3943 ipfsBrowser = await IPFS . create ( {
4044 pass : "01234567890123456789" ,
4145 EXPERIMENTAL : { ipnsPubsub : true } ,
46+ libp2p : {
47+ config : {
48+ transport : {
49+ // This is added for local demo!
50+ // In a production environment the default filter should be used
51+ // where only DNS + WSS addresses will be dialed by websockets in the browser.
52+ [ transportKey ] : {
53+ filter : filters . all
54+ }
55+ }
56+ } }
4257 } ) ;
4358 const { id } = await ipfsBrowser . id ( ) ;
4459 log ( `Browser IPFS ready! Node id: ${ id } ` ) ;
You can’t perform that action at this time.
0 commit comments