Add support Hikvision ISAPI

This commit is contained in:
Alexey Khit
2023-02-28 22:55:19 +03:00
parent ab1b3932ac
commit 5846cbd989
7 changed files with 292 additions and 20 deletions

View File

@@ -73,7 +73,9 @@ func (c *Client) newConn() (net.Conn, error) {
u.Host += ":8800"
}
req, err := http.NewRequest("POST", u.String(), nil)
// TODO: fix closing connection
ctx, pconn := tcp.WithConn()
req, err := http.NewRequestWithContext(ctx, "POST", u.String(), nil)
if err != nil {
return nil, err
}
@@ -93,7 +95,7 @@ func (c *Client) newConn() (net.Conn, error) {
c.newDectypter(res, username, password)
}
return res.Body.(net.Conn), nil
return *pconn, nil
}
func (c *Client) newDectypter(res *http.Response, username, password string) {