File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -240,7 +240,15 @@ public Map addrs() throws IOException {
240
240
return (Map <String , Object >)m .get ("Addrs" );
241
241
}
242
242
243
- // TODO connect, disconnect
243
+ public Map connect (String multiAddr ) throws IOException {
244
+ Map m = retrieveMap ("swarm/connect?arg=" +multiAddr );
245
+ return m ;
246
+ }
247
+
248
+ public Map disconnect (String multiAddr ) throws IOException {
249
+ Map m = retrieveMap ("swarm/disconnect?arg=" +multiAddr );
250
+ return m ;
251
+ }
244
252
}
245
253
246
254
class Diag {
Original file line number Diff line number Diff line change @@ -169,6 +169,9 @@ public void resolveTest() {
169
169
@ org .junit .Test
170
170
public void swarmTest () {
171
171
try {
172
+ String multiaddr = "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ" ;
173
+ Map connect = ipfs .swarm .connect (multiaddr );
174
+ Map disconnect = ipfs .swarm .disconnect (multiaddr );
172
175
Map bootstrap = ipfs .bootstrap ();
173
176
Map <String , Object > addrs = ipfs .swarm .addrs ();
174
177
if (addrs .size () > 0 ) {
You can’t perform that action at this time.
0 commit comments