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/private/Security | |
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/private/Security')
-rw-r--r-- | lib/private/Security/Ip/Factory.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/private/Security/Ip/Factory.php b/lib/private/Security/Ip/Factory.php new file mode 100644 index 00000000000..1eedcf27a09 --- /dev/null +++ b/lib/private/Security/Ip/Factory.php @@ -0,0 +1,23 @@ +<?php + +declare(strict_types=1); +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OC\Security\Ip; + +use OCP\Security\Ip\IAddress; +use OCP\Security\Ip\IFactory; +use OCP\Security\Ip\IRange; + +class Factory implements IFactory { + public function rangeFromString(string $range): IRange { + return new Range($range); + } + + public function addressFromString(string $ip): IAddress { + return new Address($ip); + } +} |