isAcceptedAddressOnPort method
Checks whether a specific address is accepted on a TCP port.
See also: listAcceptedAddressesOnTCPPorts.
address: The address to check.port: The TCP port to check.sudo: Whether sudo privileges should be used. Defaults tofalse.allowedPorts: A set of allowed ports, ornullto allow all ports.
Returns a Future that completes with true if the address is accepted on port,
or false if it is not.
Implementation
Future<bool> isAcceptedAddressOnPort(String address, int port,
{bool sudo = false, Set<int>? allowedPorts}) async {
var accepts = await listAcceptedAddressesOnTCPPorts(
sudo: sudo, allowedPorts: allowedPorts);
var accepted = accepts.contains((address, port));
return accepted;
}