GatekeeperMock class

The GatekeeperMock class is a mock implementation of GatekeeperDriver used for testing or simulating behaviors without interacting with actual system resources like iptables.

Inheritance

Constructors

GatekeeperMock({Set<int>? blockedPorts, Set<(String, int)>? acceptedAddressesOnPort, bool verbose = false})

Properties

acceptedAddressesOnPort Set<(String, int)>
final
blockedPorts Set<int>
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
verbose bool
final

Methods

acceptAddressOnTCPPort(String address, int port, {bool sudo = false, required Set<int>? allowedPorts, required bool allowAllPorts}) Future<bool>
Add rule to accept connections on a specified TCP port from the given address.
override
blockTCPPort(int port, {bool sudo = false, required Set<int>? allowedPorts, required bool allowAllPorts}) Future<bool>
Blocks a specific TCP port.
override
clearResolveBinaryPathCache() → void
Clears the cached binary path entries.
inherited
isAcceptedAddress(String address, {bool sudo = false, Set<int>? allowedPorts}) Future<bool>
Checks whether a specific address is accepted on ANY TCP port. See also: isAcceptedAddressOnPort, listAcceptedAddressesOnTCPPorts.
inherited
isAcceptedAddressOnPort(String address, int port, {bool sudo = false, Set<int>? allowedPorts}) Future<bool>
Checks whether a specific address is accepted on a TCP port. See also: listAcceptedAddressesOnTCPPorts.
inherited
isBlockedTCPPort(int port, {bool sudo = false, Set<int>? allowedPorts}) Future<bool>
Checks whether a specific TCP port is blocked. See listBlockedTCPPorts.
inherited
listAcceptedAddressesOnTCPPorts({bool sudo = false, Set<int>? allowedPorts}) Future<Set<(String, int)>>
Lists all the currently accepted addresses on TCP ports.
override
listBlockedTCPPorts({bool sudo = false, Set<int>? allowedPorts}) Future<Set<int>>
Lists all the currently blocked TCP ports.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve() Future<bool>
Resolves this GatekeeperDriver instance to ensure that it can be used in this system.
override
resolveBinaryPath(String binaryCommand) Future<String>
Resolves the binary path for a given command. See resolveBinaryPathCached.
override
resolveBinaryPathCached(String binaryCommand) Future<String>
Resolves the binary path for a given command, using a cached path if available.
inherited
runCommand(String binaryPath, List<String> args, {bool sudo = false, int? expectedExitCode}) Future<String?>
Runs a command using the specified binary path and arguments.
override
toString() String
A string representation of this object.
override
unacceptAddressOnTCPPort(String address, int? port, {bool sudo = false, required Set<int>? allowedPorts, required bool allowAllPorts}) Future<bool>
Reverses the acceptance ("unaccept") of an address on a specified TCP port.
override
unblockTCPPort(int port, {bool sudo = false, required Set<int>? allowedPorts, required bool allowAllPorts}) Future<bool>
Unblocks a specific TCP port.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited