** Copyright (C) 2001-2025 Zabbix SIA
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
"golang.zabbix.com/sdk/zbxerr"
func newClient(socketPath string, timeout int) *client {
transport := &http.Transport{
DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
return net.Dial("unix", socketPath)
client.client = http.Client{
Timeout: time.Duration(timeout) * time.Second,
func (cli *client) Query(queryPath string) ([]byte, error) {
resp, err := cli.client.Get("http://" + path.Join(dockerVersion, queryPath))
return nil, zbxerr.ErrorCannotFetchData.Wrap(err)
body, err := ioutil.ReadAll(resp.Body)
return nil, zbxerr.ErrorCannotFetchData.Wrap(err)
if resp.StatusCode != http.StatusOK {