listAcceptedAddressesOnTCPPorts method
Lists the accepted addresses on TCP ports.
Returns a Future that completes with a Set of ({String address, int port} entries.
Implementation
Future<Set<({String address, int port})>>
listAcceptedAddressesOnTCPPorts() async {
var response = await _sendCommand("list accepts");
if (response == null) return {};
var entries = response
.trim()
.split(RegExp(r';'))
.map((e) => e.trim())
.where((e) => e.isNotEmpty)
.map((e) {
// Split on the LAST `:` so IPv6 addresses (which contain `:`) are
// parsed correctly; the port is always the trailing segment.
var idx = e.lastIndexOf(':');
if (idx <= 0 || idx >= e.length - 1) return null;
var a = e.substring(0, idx).trim();
var p = int.tryParse(e.substring(idx + 1).trim());
if (a.isEmpty || p == null) return null;
return (address: a, port: p);
})
.nonNulls
.toSet();
return entries;
}