GatekeeperClient class

The GatekeeperClient class allows a client to connect to a GatekeeperServer and interact with it by sending commands such as login, listing blocked TCP ports, and blocking or unblocking specific TCP ports. It uses a socket connection to communicate with the server and expects responses in a specific format.

Example usage:

var client = GatekeeperClient('localhost', 2243);
await client.connect();
await client.login('accessKey123');
await client.listBlockedTCPPorts();

Constructors

GatekeeperClient(String host, int port, {bool secure = true, bool verbose = false})
Creates a new GatekeeperClient instance.

Properties

aesEncryptor → AESEncryptor
no setter
chainAESEncryptor → ChainAESEncryptor
no setter
hashCode int
The hash code for this object.
no setterinherited
host String
The host (IP address or hostname) of the GatekeeperServer.
final
isConnected bool
A flag indicating whether the client is connected to the server.
no setter
isLogged bool
A flag indicating whether this client is logged.
no setter
port int
The port on which the GatekeeperServer is listening.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secure bool
If true use a secure layer for communication.
final
verbose bool
final

Methods

acceptAddressOnTCPPort(String address, int port) Future<bool>
Adds a rule to accept a TCP connection from a specified address to the blocked port.
blockTCPPort(int port) Future<bool>
Blocks a specific TCP port.
close() → void
Closes the connection to the server.
connect() Future<bool>
Connects to the Gatekeeper server.
disconnect() Future<bool>
Send a disconnect command, remotely closing the Socket. Used by exit command. See processCommand.
listAcceptedAddressesOnTCPPorts() Future<Set<({String address, int port})>>
Lists the accepted addresses on TCP ports.
listBlockedTCPPorts() Future<Set<int>>
Lists the TCP ports that are currently blocked.
login(String accessKey) Future<({bool ok, String? serverVersion})>
Logs in to the GatekeeperServer using the provided access key.
myIP() Future<String?>
Retrieves the IP address of this client as seen by the remote server.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
processCommand(String? command) Future<bool>
Processes a command entered by the user.
toString() String
A string representation of this object.
override
unacceptAddressOnTCPPort(String address, int? port) Future<bool>
Reverses the acceptance ("unaccept") of an address on a specified TCP port.
unblockTCPPort(int port) Future<bool>
Unblocks a specific TCP port.

Operators

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