This commit is contained in:
Pinga 2024-07-28 13:28:37 +03:00
parent 7e215b4932
commit 6211256e65
2 changed files with 2 additions and 6 deletions

View file

@ -7,8 +7,7 @@ return [
'db_database' => 'registry', 'db_database' => 'registry',
'db_username' => 'your_username', 'db_username' => 'your_username',
'db_password' => 'your_password', 'db_password' => 'your_password',
'epp_host' => '0.0.0.0', 'epp_host' => '::', // Set to 0.0.0.0 if no IPv6 support
'epp_host_ipv6' => '::', // Set to false if no IPv6 support
'epp_port' => 700, 'epp_port' => 700,
'epp_pid' => '/var/run/epp.pid', 'epp_pid' => '/var/run/epp.pid',
'epp_greeting' => 'Namingo EPP Server 1.0', 'epp_greeting' => 'Namingo EPP Server 1.0',

View file

@ -48,9 +48,6 @@ $pool = new Swoole\Database\PDOPool(
Swoole\Runtime::enableCoroutine(); Swoole\Runtime::enableCoroutine();
$server = new Server($c['epp_host'], $c['epp_port']); $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([ $server->set([
'enable_coroutine' => true, 'enable_coroutine' => true,
'log_file' => '/var/log/namingo/epp_application.log', '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) { $server->handle(function (Connection $conn) use ($table, $pool, $c, $log, $permittedIPsTable, $rateLimiter) {
// Get the client information // Get the client information
$clientInfo = $conn->exportSocket()->getpeername(); $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 // Check if the IP is in the permitted list
if (!$permittedIPsTable->exist($clientIP)) { if (!$permittedIPsTable->exist($clientIP)) {