Add ONVIF client and server support

This commit is contained in:
Alexey Khit
2023-04-29 13:58:10 +03:00
parent 8dbaa4ba93
commit 1e14dc9ab2
8 changed files with 746 additions and 0 deletions
+19
View File
@@ -131,6 +131,25 @@ func importEntries(config string) map[string]string {
case "roborock":
_ = json.Unmarshal(entrie.Data, &roborock.Auth)
case "onvif":
var data struct {
Host string `json:"host" json:"host"`
Port uint16 `json:"port" json:"port"`
Username string `json:"username" json:"username"`
Password string `json:"password" json:"password"`
}
if err = json.Unmarshal(entrie.Data, &data); err != nil {
continue
}
if data.Username != "" && data.Password != "" {
urls[entrie.Title] = fmt.Sprintf(
"onvif://%s:%s@%s:%d", data.Username, data.Password, data.Host, data.Port,
)
} else {
urls[entrie.Title] = fmt.Sprintf("onvif://%s:%d", data.Host, data.Port)
}
default:
continue
}