0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-05-03 21:40:31 +00:00
nextcloud_server/lib/public/Security/Ip/IAddress.php
Joas Schilling 047479ccf9
feat(security): Add public API to allow validating IP Ranges and checking for "in range"
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2024-07-19 16:28:03 +02:00

35 lines
601 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Security\Ip;
/**
* @since 30.0.0
*/
interface IAddress {
/**
* Check if a given IP address is valid
*
* @since 30.0.0
*/
public static function isValid(string $ip): bool;
/**
* Check if current address is contained by given ranges
*
* @since 30.0.0
*/
public function matches(IRange... $ranges): bool;
/**
* Normalized IP address
*
* @since 30.0.0
*/
public function __toString(): string;
}