listBlockedTCPPorts method

Future<Set<int>> listBlockedTCPPorts()

Lists the TCP ports that are currently blocked.

Returns a Future that completes with a Set of blocked ports.

Implementation

Future<Set<int>> listBlockedTCPPorts() async {
  var response = await _sendCommand("list ports");
  if (response == null) return {};

  response = response.split(':')[1];

  var ports = response
      .trim()
      .split(RegExp(r'\D+'))
      .map((e) => int.tryParse(e))
      .nonNulls
      .toSet();

  return ports;
}