GatekeeperServer constructor

GatekeeperServer(
  1. Gatekeeper gatekeeper, {
  2. required String accessKey,
  3. required int listenPort,
  4. Object? address,
  5. int? loginErrorLimit,
  6. Duration? blockingTime,
  7. bool verbose = false,
})

Creates a GatekeeperServer instance.

  • gatekeeper: the Gatekeeper instance.
  • accessKey: the access key for login.
  • listenPort: the port to listen for connections. NO default port for security purpose.
  • address: Optional addresses to bind. See ServerSocket.bind. Default: InternetAddress.anyIPv4
  • loginErrorLimit: The limit of login errors to block a Socket. Default: 3 ; Minimal: 3
  • blockingTime: The Socket blocking time. Default: 10min

Implementation

GatekeeperServer(this.gatekeeper,
    {required this.accessKey,
    required this.listenPort,
    Object? address,
    int? loginErrorLimit,
    Duration? blockingTime,
    this.verbose = false})
    : address = address ?? InternetAddress.anyIPv4,
      loginErrorLimit = normalizeLoginErrorLimit(loginErrorLimit),
      blockingTime = normalizeBlockingTime(blockingTime) {
  if (accessKey.length < 32) {
    throw ArgumentError(
        "Invalid `accessKey` length: ${accessKey.length} < 32");
  }

  accessKeyHash = hashAccessKey(accessKey);
}