diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2020-06-23 10:08:19 +0300 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2020-06-23 10:08:19 +0300 |
| commit | 4b7305c3d1f668671bd6eef05ed0996faf78d961 (patch) | |
| tree | 4f86d91329e22547c1e587266e5f5439795dbacd /libs/services.php | |
| parent | a66bd8f49d3fe9c31724d55623a2e7ee2ba152bb (diff) | |
| parent | 192aa0b79102e9fc29d7162d913b04bdda955b2e (diff) | |
Merge branch 'feature/unix-socket-support'
Diffstat (limited to 'libs/services.php')
| -rw-r--r-- | libs/services.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libs/services.php b/libs/services.php index 61411e4..a3f9e94 100644 --- a/libs/services.php +++ b/libs/services.php @@ -5,7 +5,7 @@ $Config = new Config(); $datas = array(); -$available_protocols = array('tcp', 'udp'); +$available_protocols = array('tcp', 'udp', 'unix'); $show_port = $Config->get('services:show_port'); @@ -18,10 +18,16 @@ if (count($Config->get('services:list')) > 0) $name = $service['name']; $protocol = isset($service['protocol']) && in_array($service['protocol'], $available_protocols) ? $service['protocol'] : 'tcp'; - if (Misc::scanPort($host, $port, $protocol)) - $status = 1; - else - $status = 0; + $socketProtocols = array('tcp', 'udp', 'unix'); + if (in_array($protocol, $socketProtocols)) { + if (Misc::socketAvailable($host, $port, $protocol)) + $status = 1; + else + $status = 0; + } + else { + $status = Misc::systemdServiceActive($host) ? 1 : 0; + } $datas[] = array( 'port' => $show_port === true ? $port : '', |
