close method

Future<Map<String, dynamic>> close({
  1. bool? all,
  2. String? protocol,
  3. String? listenAddress,
  4. String? targetAddress,
})

EXPERIMENTAL

Stop listening for new connections to forward. /api/v0/p2p/close

Optional arguments:

  • all bool: Close all listeners.
  • protocol String: Match protocol name.
  • listenAddress String: Match listen address.
  • targetAddress String: Match target address.

Response:

{
  "Data": "<int>",
  "StatusCode": "<statusCode>",
  "StatusMessage": "<statusMessage>"
}

See more: https://docs.ipfs.io/reference/http/api/#api-v0-p2p-close

Implementation

Future<Map<String, dynamic>> close(
    {bool? all,
    String? protocol,
    String? listenAddress,
    String? targetAddress}) async {
  Response? res = await _post(
    Ipfs.dio,
    url: "${Ipfs.url}/p2p/close",
    queryParameters: {
      if (all != null) "all": all,
      if (protocol != null) "protocol": protocol,
      if (listenAddress != null) "listen-address": listenAddress,
      if (targetAddress != null) "target-address": targetAddress,
    },
  );

  return _interceptDioResponse(res, expectsResponseBody: true);
}