diff options
author | Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> | 2024-07-19 15:25:57 +0200 |
---|---|---|
committer | Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> | 2024-07-19 16:28:03 +0200 |
commit | f1d97a318818860d3fff9fccffbab5a1faba752b (patch) | |
tree | 6e1392f54d351e3b741898cb02a4f170bc273e20 /lib/public | |
parent | 047479ccf9ff332cc249cd08d5c315394f3e48da (diff) | |
download | nextcloud-server-f1d97a318818860d3fff9fccffbab5a1faba752b.tar.gz nextcloud-server-f1d97a318818860d3fff9fccffbab5a1faba752b.zip |
feat(Security): add Factory for IP addresses and ranges
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/Security/Ip/IFactory.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/public/Security/Ip/IFactory.php b/lib/public/Security/Ip/IFactory.php new file mode 100644 index 00000000000..3b88aa8c756 --- /dev/null +++ b/lib/public/Security/Ip/IFactory.php @@ -0,0 +1,30 @@ +<?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 IFactory { + /** + * Creates a range from string + * + * @since 30.0.0 + * @throws \InvalidArgumentException on invalid range + */ + public function rangeFromString(string $range): IRange; + + /** + * Creates a address from string + * + * @since 30.0.0 + * @throws \InvalidArgumentException on invalid IP + */ + public function addressFromString(string $ip): IAddress; +} |