aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Security
diff options
context:
space:
mode:
authorBenjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>2024-07-19 15:25:57 +0200
committerBenjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>2024-07-19 16:28:03 +0200
commitf1d97a318818860d3fff9fccffbab5a1faba752b (patch)
tree6e1392f54d351e3b741898cb02a4f170bc273e20 /lib/private/Security
parent047479ccf9ff332cc249cd08d5c315394f3e48da (diff)
downloadnextcloud-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.php23
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);
+ }
+}