Code refactoring after #967
This commit is contained in:
+4
-5
@@ -2,12 +2,13 @@ package isapi
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/AlexxIT/go2rtc/pkg/core"
|
|
||||||
"github.com/AlexxIT/go2rtc/pkg/tcp"
|
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
|
"github.com/AlexxIT/go2rtc/pkg/core"
|
||||||
|
"github.com/AlexxIT/go2rtc/pkg/tcp"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
@@ -88,9 +89,7 @@ func (c *Client) Open() (err error) {
|
|||||||
// using the test button on-camera or via curl command) but a close request can be sent even if
|
// using the test button on-camera or via curl command) but a close request can be sent even if
|
||||||
// the audio is already closed. So, we send a close request first and then open it again. Seems
|
// the audio is already closed. So, we send a close request first and then open it again. Seems
|
||||||
// janky but it works.
|
// janky but it works.
|
||||||
|
if err = c.Close(); err != nil {
|
||||||
err = c.Close()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -9,6 +9,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/AlexxIT/go2rtc/pkg/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Do - http.Client with support Digest Authorization
|
// Do - http.Client with support Digest Authorization
|
||||||
@@ -115,9 +117,7 @@ func Do(req *http.Request) (*http.Response, error) {
|
|||||||
)
|
)
|
||||||
case "auth":
|
case "auth":
|
||||||
nc := "00000001"
|
nc := "00000001"
|
||||||
// TODO: Random cnonce
|
cnonce := core.RandString(32, 64)
|
||||||
// Here is temp static cnonce of required 32 bytes
|
|
||||||
cnonce := "ZDlmODczZTk2NjQyZTQ4OGQ5ZGEzOTI3YTc5Y2Q0ZGM="
|
|
||||||
response := HexMD5(ha1, nonce, nc, cnonce, qop, ha2)
|
response := HexMD5(ha1, nonce, nc, cnonce, qop, ha2)
|
||||||
header = fmt.Sprintf(
|
header = fmt.Sprintf(
|
||||||
`Digest username="%s", realm="%s", nonce="%s", uri="%s", qop=%s, nc=%s, cnonce="%s", response="%s"`,
|
`Digest username="%s", realm="%s", nonce="%s", uri="%s", qop=%s, nc=%s, cnonce="%s", response="%s"`,
|
||||||
|
|||||||
Reference in New Issue
Block a user