mirror of
https://github.com/unraid/webgui.git
synced 2026-04-22 01:40:58 -05:00
Fixed return of IPv4 or IPv6 address
This commit is contained in:
@@ -796,11 +796,8 @@ class DockerUtil {
|
||||
}
|
||||
|
||||
public static function myIP($name, $version=4) {
|
||||
$networks = explode('|', DockerUtil::docker("inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}|{{end}}' $name"));
|
||||
foreach ($networks as $network) {
|
||||
if ($version==4 && strpos($network,'.')!==false) return $network;
|
||||
if ($version==6 && strpos($network,':')!==false) return $network;
|
||||
}
|
||||
$ipaddr = $version==4 ? 'IPAddress' : 'GlobalIPv6Address';
|
||||
return DockerUtil::docker("inspect --format='{{range .NetworkSettings.Networks}}{{.$ipaddr}}{{end}}' $name");
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user