2023-08-11 13:12:12 +05:00
|
|
|
package amf
|
|
|
|
|
|
|
|
import "errors"
|
|
|
|
|
2023-08-11 15:21:49 +05:00
|
|
|
func (amf_obj_root AMFObj) ProcessConnect() (err error) {
|
|
|
|
err = errors.New("Bad AMF connect command")
|
2023-08-11 13:12:12 +05:00
|
|
|
if _, ok := amf_obj_root[0]; !ok {
|
2023-08-11 15:21:49 +05:00
|
|
|
return
|
2023-08-11 13:12:12 +05:00
|
|
|
} else if command_string, ok := amf_obj_root[0].(string); !ok || command_string != "connect" {
|
2023-08-11 15:21:49 +05:00
|
|
|
return
|
2023-08-11 13:12:12 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
if _, ok := amf_obj_root[1]; !ok {
|
2023-08-11 15:21:49 +05:00
|
|
|
return
|
2023-08-11 13:12:12 +05:00
|
|
|
} else if transac_id_float, ok := amf_obj_root[1].(float64); !ok || transac_id_float != 1.0 {
|
2023-08-11 15:21:49 +05:00
|
|
|
return
|
2023-08-11 13:12:12 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
if _, ok := amf_obj_root[2]; !ok {
|
2023-08-11 15:21:49 +05:00
|
|
|
return
|
2023-08-11 13:12:12 +05:00
|
|
|
} else if _, ok := amf_obj_root[2].(AMFObj); !ok {
|
2023-08-11 15:21:49 +05:00
|
|
|
return
|
|
|
|
} else if _, ok := amf_obj_root[2].(AMFObj)["app"]; !ok {
|
|
|
|
return
|
|
|
|
} else if _, ok := amf_obj_root[2].(AMFObj)["app"].(string); !ok {
|
|
|
|
return
|
|
|
|
} else if amf_obj_root[2].(AMFObj)["app"].(string) != "live" {
|
|
|
|
return
|
2023-08-11 13:12:12 +05:00
|
|
|
}
|
2023-08-11 15:21:49 +05:00
|
|
|
err = nil
|
|
|
|
return
|
2023-08-11 13:12:12 +05:00
|
|
|
}
|