This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +43
-3
lines changed Expand file tree Collapse file tree 4 files changed +43
-3
lines changed Original file line number Diff line number Diff line change 33const IPFSFactory = require ( 'ipfsd-ctl' )
44const MockPreloadNode = require ( './test/utils/mock-preload-node' )
55const EchoServer = require ( 'interface-ipfs-core/src/utils/echo-http-server' )
6+ const webRTCStarSigServer = require ( 'libp2p-webrtc-star/src/sig-server' )
67
78const ipfsdServer = IPFSFactory . createServer ( )
89const preloadNode = MockPreloadNode . createNode ( )
910const echoServer = EchoServer . createServer ( )
11+ let sigServer
1012
1113module . exports = {
1214 bundlesize : { maxSize : '652kB' } ,
@@ -42,11 +44,16 @@ module.exports = {
4244 await ipfsdServer . start ( )
4345 await preloadNode . start ( )
4446 await echoServer . start ( )
47+ sigServer = await webRTCStarSigServer . start ( {
48+ host : '127.0.0.1' ,
49+ port : 14579
50+ } )
4551 } ,
4652 post : async ( ) => {
4753 await ipfsdServer . stop ( )
4854 await preloadNode . stop ( )
4955 await echoServer . stop ( )
56+ await sigServer . stop ( )
5057 }
5158 }
5259 }
Original file line number Diff line number Diff line change @@ -12,7 +12,17 @@ module.exports = ({ peerInfo }) => {
1212 publicKey : peerInfo . id . pubKey . bytes . toString ( 'base64' ) ,
1313 addresses : peerInfo . multiaddrs
1414 . toArray ( )
15- . map ( ma => `${ ma } /p2p/${ id } ` )
15+ . map ( ma => {
16+ const str = ma . toString ( )
17+
18+ // some relay-style transports add our peer id to the ma for us
19+ // so don't double-add
20+ if ( str . endsWith ( `/p2p/${ id } ` ) ) {
21+ return str
22+ }
23+
24+ return `${ str } /p2p/${ id } `
25+ } )
1626 . sort ( )
1727 . map ( ma => multiaddr ( ma ) ) ,
1828 agentVersion : `js-ipfs/${ pkgversion } ` ,
Original file line number Diff line number Diff line change 44const tests = require ( 'interface-ipfs-core' )
55const merge = require ( 'merge-options' )
66const { createFactory } = require ( 'ipfsd-ctl' )
7- const { isNode } = require ( 'ipfs-utils/src/env' )
7+ const { isNode, isBrowser } = require ( 'ipfs-utils/src/env' )
88const IPFS = require ( '../../src' )
99
1010/** @typedef { import("ipfsd-ctl").ControllerOptions } ControllerOptions */
@@ -23,7 +23,16 @@ describe('interface-ipfs-core tests', function () {
2323 ref : require ( 'ipfs-http-client' )
2424 } ,
2525 ipfsOptions : {
26- pass : 'ipfs-is-awesome-software'
26+ pass : 'ipfs-is-awesome-software' ,
27+ ...( isBrowser ? {
28+ config : {
29+ Addresses : {
30+ Swarm : [
31+ '/ip4/127.0.0.1/tcp/14579/wss/p2p-webrtc-star'
32+ ]
33+ }
34+ }
35+ } : { } )
2736 }
2837 }
2938 const overrides = {
Original file line number Diff line number Diff line change 11'use strict'
22const { createFactory } = require ( 'ipfsd-ctl' )
33const merge = require ( 'merge-options' )
4+ const { isBrowser } = require ( 'ipfs-utils/src/env' )
45
56const factory = ( options , overrides ) => createFactory (
67 merge ( {
@@ -18,6 +19,19 @@ const factory = (options, overrides) => createFactory(
1819 merge ( {
1920 js : {
2021 ipfsBin : './src/cli/bin.js'
22+ } ,
23+ proc : {
24+ ...( isBrowser ? {
25+ ipfsOptions : {
26+ config : {
27+ Addresses : {
28+ Swarm : [
29+ '/ip4/127.0.0.1/tcp/14579/wss/p2p-webrtc-star'
30+ ]
31+ }
32+ }
33+ }
34+ } : { } )
2135 }
2236 } , overrides )
2337)
You can’t perform that action at this time.
0 commit comments