mirror of
https://github.com/pelican-dev/panel.git
synced 2025-09-24 08:37:47 +02:00
Show localhost
This commit is contained in:
parent
32018399b6
commit
ba5b81cf2d
@ -14,6 +14,7 @@ class Endpoint implements Jsonable
|
|||||||
public const PORT_RANGE_LIMIT = 1000;
|
public const PORT_RANGE_LIMIT = 1000;
|
||||||
public const PORT_RANGE_REGEX = '/^(\d{4,5})-(\d{4,5})$/';
|
public const PORT_RANGE_REGEX = '/^(\d{4,5})-(\d{4,5})$/';
|
||||||
public const INADDR_ANY = '0.0.0.0';
|
public const INADDR_ANY = '0.0.0.0';
|
||||||
|
public const INADDR_LOOPBACK = '127.0.0.1';
|
||||||
|
|
||||||
public int $port;
|
public int $port;
|
||||||
public string $ip;
|
public string $ip;
|
||||||
@ -35,11 +36,17 @@ class Endpoint implements Jsonable
|
|||||||
|
|
||||||
public function __toString(): string
|
public function __toString(): string
|
||||||
{
|
{
|
||||||
if ($this->ip === self::INADDR_ANY) {
|
$ip = $this->ip;
|
||||||
|
|
||||||
|
if ($ip === self::INADDR_ANY) {
|
||||||
return (string) $this->port;
|
return (string) $this->port;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "$this->ip:$this->port";
|
if ($ip === self::INADDR_LOOPBACK) {
|
||||||
|
$ip = 'localhost';
|
||||||
|
}
|
||||||
|
|
||||||
|
return "$ip:$this->port";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toJson($options = 0): string
|
public function toJson($options = 0): string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user