Commit 60cd7894 authored by root's avatar root

hyperf2.2.0

parent d0e61f2b
...@@ -45,4 +45,18 @@ class RegisterServiceListener extends BaseRegisterServiceListener ...@@ -45,4 +45,18 @@ class RegisterServiceListener extends BaseRegisterServiceListener
return $result; return $result;
} }
private function getInternalIp(): string
{
$ips = swoole_get_local_ip();
if (is_array($ips) && ! empty($ips)) {
return current($ips);
}
/** @var mixed|string $ip */
$ip = gethostbyname(gethostname());
if (is_string($ip)) {
return $ip;
}
throw new \RuntimeException('Can not get the internal IP.');
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment