Refactoring for HomeKit client

This commit is contained in:
Alexey Khit
2022-11-11 21:56:58 +03:00
parent 7bc3534bcb
commit 77888fe086
22 changed files with 300 additions and 275 deletions
+6 -7
View File
@@ -3,6 +3,7 @@ package homekit
import (
"github.com/AlexxIT/go2rtc/cmd/api"
"github.com/AlexxIT/go2rtc/cmd/app"
"github.com/AlexxIT/go2rtc/cmd/srtp"
"github.com/AlexxIT/go2rtc/cmd/streams"
"github.com/AlexxIT/go2rtc/pkg/homekit"
"github.com/AlexxIT/go2rtc/pkg/streamer"
@@ -20,14 +21,12 @@ func Init() {
var log zerolog.Logger
func streamHandler(url string) (streamer.Producer, error) {
conn, err := homekit.Dial(url)
conn, err := homekit.NewClient(url, srtp.Server)
if err != nil {
return nil, err
}
exit := make(chan error)
go func() {
//start goroutine for reading responses from camera
exit <- conn.Handle()
}()
return &Client{conn: conn, exit: exit}, nil
if err = conn.Dial();err!=nil{
return nil, err
}
return conn, nil
}