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 {
240240 return (Map <String , Object >)m .get ("Addrs" );
241241 }
242242
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+ }
244252 }
245253
246254 class Diag {
Original file line number Diff line number Diff line change @@ -169,6 +169,9 @@ public void resolveTest() {
169169 @ org .junit .Test
170170 public void swarmTest () {
171171 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 );
172175 Map bootstrap = ipfs .bootstrap ();
173176 Map <String , Object > addrs = ipfs .swarm .addrs ();
174177 if (addrs .size () > 0 ) {
You can’t perform that action at this time.
0 commit comments