package amf import ( "errors" ) func (amf_obj_root AMFObj) ProcessConnect() (err error) { err = errors.New("Bad AMF connect command") if _, ok := amf_obj_root[0]; !ok { return } else if command_string, ok := amf_obj_root[0].(string); !ok || command_string != "connect" { return } if _, ok := amf_obj_root[1]; !ok { return } else if transac_id_float, ok := amf_obj_root[1].(float64); !ok || transac_id_float != 1.0 { return } if _, ok := amf_obj_root[2]; !ok { return } else if _, ok := amf_obj_root[2].(AMFObj); !ok { 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 } err = nil return } func EncodeConnectResponse() ([]byte, error) { amf_root_obj := make(AMFObj) amf_root_obj[0] = "_result" amf_root_obj[1] = 1.0 amf_root_obj[2] = make(AMFObj) amf_prop_obj := amf_root_obj[2].(AMFObj) amf_prop_obj["fmsVer"] = "FMS/3,5,5,2004" amf_prop_obj["capabilities"] = 31.0 amf_root_obj[3] = make(AMFObj) amf_event_obj := amf_root_obj[3].(AMFObj) amf_event_obj["level"] = "status" amf_event_obj["code"] = "NetConnection.Connect.Success" amf_event_obj["description"] = "Connection Succeeded" amf_event_obj["objectEncoding"] = 0.0 return Encode(amf_root_obj) }