@@ -103,7 +103,7 @@ describe(`circuit`, function () {
103
103
nodeTCP1 = node
104
104
cb ( )
105
105
} ) ,
106
- // set up node with TCP and listening on relay1 over TCP transport
106
+ // set up node with TCP and listening on relay2 over TCP transport
107
107
( cb ) => setupNode ( [
108
108
`/ip4/0.0.0.0/tcp/9311` ,
109
109
`/ip4/0.0.0.0/tcp/9111/ipfs/${ relayNode2 . peerInfo . id . toB58String ( ) } /p2p-circuit`
@@ -133,68 +133,72 @@ describe(`circuit`, function () {
133
133
] , done )
134
134
} )
135
135
136
- it ( 'should dial from WS1 to TCP1 over any R' , function ( done ) {
137
- nodeWS1 . dial ( nodeTCP1 . peerInfo , '/echo/1.0.0' , ( err , conn ) => {
138
- expect ( err ) . to . not . exist ( )
139
- expect ( conn ) . to . exist ( )
140
-
141
- pull (
142
- pull . values ( [ 'hello' ] ) ,
143
- conn ,
144
- pull . collect ( ( e , result ) => {
145
- expect ( e ) . to . not . exist ( )
146
- expect ( result [ 0 ] . toString ( ) ) . to . equal ( 'hello' )
147
- done ( )
148
- } )
149
- )
136
+ describe ( `any relay` , function ( ) {
137
+ it ( 'should dial from WS1 to TCP1 over any R' , function ( done ) {
138
+ nodeWS1 . dial ( nodeTCP1 . peerInfo , '/echo/1.0.0' , ( err , conn ) => {
139
+ expect ( err ) . to . not . exist ( )
140
+ expect ( conn ) . to . exist ( )
141
+
142
+ pull (
143
+ pull . values ( [ 'hello' ] ) ,
144
+ conn ,
145
+ pull . collect ( ( e , result ) => {
146
+ expect ( e ) . to . not . exist ( )
147
+ expect ( result [ 0 ] . toString ( ) ) . to . equal ( 'hello' )
148
+ done ( )
149
+ } )
150
+ )
151
+ } )
150
152
} )
151
- } )
152
153
153
- it ( 'should dial from WS1 to TCP1 over R1' , function ( done ) {
154
- nodeWS1 . dial ( nodeTCP1 . peerInfo , '/echo/1.0.0' , ( err , conn ) => {
155
- expect ( err ) . to . not . exist ( )
156
- expect ( conn ) . to . exist ( )
157
-
158
- pull (
159
- pull . values ( [ 'hello' ] ) ,
160
- conn ,
161
- pull . collect ( ( e , result ) => {
162
- expect ( e ) . to . not . exist ( )
163
- expect ( result [ 0 ] . toString ( ) ) . to . equal ( 'hello' )
164
-
165
- const addr = multiaddr ( handlerSpies [ 0 ] . args [ 2 ] [ 0 ] . dstPeer . addrs [ 0 ] ) . toString ( )
166
- expect ( addr ) . to . equal ( `/ipfs/${ nodeTCP1 . peerInfo . id . toB58String ( ) } ` )
167
- done ( )
168
- } )
169
- )
154
+ it ( `should not dial - no R from WS2 to TCP1` , function ( done ) {
155
+ nodeWS2 . dial ( nodeTCP2 . peerInfo , '/echo/1.0.0' , ( err , conn ) => {
156
+ expect ( err ) . to . exist ( )
157
+ expect ( conn ) . to . not . exist ( )
158
+ done ( )
159
+ } )
170
160
} )
171
161
} )
172
162
173
- it ( `should dial from WS1 to TCP2 over R2` , function ( done ) {
174
- nodeWS1 . dial ( nodeTCP2 . peerInfo , '/echo/1.0.0' , ( err , conn ) => {
175
- expect ( err ) . to . not . exist ( )
176
- expect ( conn ) . to . exist ( )
177
-
178
- pull (
179
- pull . values ( [ 'hello' ] ) ,
180
- conn ,
181
- pull . collect ( ( e , result ) => {
182
- expect ( e ) . to . not . exist ( )
183
- expect ( result [ 0 ] . toString ( ) ) . to . equal ( 'hello' )
184
-
185
- const addr = multiaddr ( handlerSpies [ 1 ] . args [ 2 ] [ 0 ] . dstPeer . addrs [ 0 ] ) . toString ( )
186
- expect ( addr ) . to . equal ( `/ipfs/${ nodeTCP2 . peerInfo . id . toB58String ( ) } ` )
187
- done ( )
188
- } )
189
- )
163
+ describe ( `explicit relay` , function ( ) {
164
+ it ( 'should dial from WS1 to TCP1 over R1' , function ( done ) {
165
+ nodeWS1 . dial ( nodeTCP1 . peerInfo , '/echo/1.0.0' , ( err , conn ) => {
166
+ expect ( err ) . to . not . exist ( )
167
+ expect ( conn ) . to . exist ( )
168
+
169
+ pull (
170
+ pull . values ( [ 'hello' ] ) ,
171
+ conn ,
172
+ pull . collect ( ( e , result ) => {
173
+ expect ( e ) . to . not . exist ( )
174
+ expect ( result [ 0 ] . toString ( ) ) . to . equal ( 'hello' )
175
+
176
+ const addr = multiaddr ( handlerSpies [ 0 ] . args [ 2 ] [ 0 ] . dstPeer . addrs [ 0 ] ) . toString ( )
177
+ expect ( addr ) . to . equal ( `/ipfs/${ nodeTCP1 . peerInfo . id . toB58String ( ) } ` )
178
+ done ( )
179
+ } )
180
+ )
181
+ } )
190
182
} )
191
- } )
192
183
193
- it ( `should not dial - no R from WS2 to TCP1` , function ( done ) {
194
- nodeWS2 . dial ( nodeTCP2 . peerInfo , '/echo/1.0.0' , ( err , conn ) => {
195
- expect ( err ) . to . exist ( )
196
- expect ( conn ) . to . not . exist ( )
197
- done ( )
184
+ it ( `should dial from WS1 to TCP2 over R2` , function ( done ) {
185
+ nodeWS1 . dial ( nodeTCP2 . peerInfo , '/echo/1.0.0' , ( err , conn ) => {
186
+ expect ( err ) . to . not . exist ( )
187
+ expect ( conn ) . to . exist ( )
188
+
189
+ pull (
190
+ pull . values ( [ 'hello' ] ) ,
191
+ conn ,
192
+ pull . collect ( ( e , result ) => {
193
+ expect ( e ) . to . not . exist ( )
194
+ expect ( result [ 0 ] . toString ( ) ) . to . equal ( 'hello' )
195
+
196
+ const addr = multiaddr ( handlerSpies [ 1 ] . args [ 2 ] [ 0 ] . dstPeer . addrs [ 0 ] ) . toString ( )
197
+ expect ( addr ) . to . equal ( `/ipfs/${ nodeTCP2 . peerInfo . id . toB58String ( ) } ` )
198
+ done ( )
199
+ } )
200
+ )
201
+ } )
198
202
} )
199
203
} )
200
204
} )
0 commit comments