gatekeeper 1.0.11
gatekeeper: ^1.0.11 copied to clipboard
Gatekeeper is a Dart package for managing TCP ports with a manager, server, and client. Control ports programmatically, via IPC, or remotely for efficient port management.
gatekeeper #
gatekeeper
is a Dart package for managing TCP ports, offering a manager, server, and client for seamless control. You
can list, block, and unblock ports programmatically, through inter-process communication (IPC), or remotely, providing a
flexible and efficient solution for port management.
Usage #
You can use Gatekeeper
programmatically:
import 'package:gatekeeper/gatekeeper_iptables.dart';
void main() async {
var gatekeeper = Gatekeeper(
driver: GatekeeperIpTables(), // Use `iptables` to handle ports.
allowedPorts: {2080, 2443}, // Only handle ports 2080 and 2443.
);
// List blocked TCP ports:
var blockedTCPPorts = await gatekeeper.listBlockedTCPPorts();
print("-- Blocked TCP ports: $blockedTCPPorts");
// Block port 2222:
var blocked = await gatekeeper.blockTCPPort(2080);
print("-- Blocked 2080: $blocked");
// Unblock port 2222:
var unblocked = await gatekeeper.unblockTCPPort(2080);
print("-- Unblocked 2080: $unblocked");
// Try to block a not allowed port:
var failedBlock = await gatekeeper.blockTCPPort(8080);
print("-- Failed block of 2080: $failedBlock");
}
CLI #
Activate the gatekeeper
commands:
dart pub global activate gatekeeper
gatekeeper #
To run a GatekeeperServer
listening on port 2243
and managing ports 2221,2222,2223
:
gatekeeper --port 2243 --allowed-ports 2221,2222,2223
gatekeeper_client #
To connect to a GatekeeperServer
on port 2243
:
gatekeeper_client server-host 2243
Features and bugs #
Please file feature requests and bugs at the issue tracker.
Author #
Graciliano M. Passos: gmpassos@GitHub.
License #
Dart free & open-source license.