Add kasa client and simplify multipart client

This commit is contained in:
Alexey Khit
2023-08-28 22:31:52 +03:00
parent 7f232c5cf2
commit c6d5bb4eeb
6 changed files with 289 additions and 240 deletions
+7 -8
View File
@@ -3,17 +3,16 @@ package tapo
import (
"github.com/AlexxIT/go2rtc/internal/streams"
"github.com/AlexxIT/go2rtc/pkg/core"
"github.com/AlexxIT/go2rtc/pkg/kasa"
"github.com/AlexxIT/go2rtc/pkg/tapo"
)
func Init() {
streams.HandleFunc("tapo", handle)
}
streams.HandleFunc("kasa", func(url string) (core.Producer, error) {
return kasa.Dial(url)
})
func handle(url string) (core.Producer, error) {
conn := tapo.NewClient(url)
if err := conn.Dial(); err != nil {
return nil, err
}
return conn, nil
streams.HandleFunc("tapo", func(url string) (core.Producer, error) {
return tapo.Dial(url)
})
}