From 6211256e65fbf0f41a42a52a0e918ec0a2c76315 Mon Sep 17 00:00:00 2001 From: Pinga <121483313+getpinga@users.noreply.github.com> Date: Sun, 28 Jul 2024 13:28:37 +0300 Subject: [PATCH] Fixed #131 --- epp/config.php.dist | 3 +-- epp/start_epp.php | 5 +---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/epp/config.php.dist b/epp/config.php.dist index 533c4b6..84d64bc 100644 --- a/epp/config.php.dist +++ b/epp/config.php.dist @@ -7,8 +7,7 @@ return [ 'db_database' => 'registry', 'db_username' => 'your_username', 'db_password' => 'your_password', - 'epp_host' => '0.0.0.0', - 'epp_host_ipv6' => '::', // Set to false if no IPv6 support + 'epp_host' => '::', // Set to 0.0.0.0 if no IPv6 support 'epp_port' => 700, 'epp_pid' => '/var/run/epp.pid', 'epp_greeting' => 'Namingo EPP Server 1.0', diff --git a/epp/start_epp.php b/epp/start_epp.php index 6dc56a0..ff4a30d 100644 --- a/epp/start_epp.php +++ b/epp/start_epp.php @@ -48,9 +48,6 @@ $pool = new Swoole\Database\PDOPool( Swoole\Runtime::enableCoroutine(); $server = new Server($c['epp_host'], $c['epp_port']); -if ($c['epp_host_ipv6'] !== false) { - //$server->addListener($c['epp_host_ipv6'], $c['epp_port'], SWOOLE_SOCK_TCP6); -} $server->set([ 'enable_coroutine' => true, 'log_file' => '/var/log/namingo/epp_application.log', @@ -78,7 +75,7 @@ $log->info('Namingo EPP server started'); $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permittedIPsTable, $rateLimiter) { // Get the client information $clientInfo = $conn->exportSocket()->getpeername(); - $clientIP = $clientInfo['address'] ?? ''; + $clientIP = isset($clientInfo['address']) ? (strpos($clientInfo['address'], '::ffff:') === 0 ? substr($clientInfo['address'], 7) : $clientInfo['address']) : ''; // Check if the IP is in the permitted list if (!$permittedIPsTable->exist($clientIP)) {