Exemple #1
0
// Returns the protobuf message's session
func GetSession(c *payload.Collection) string {
	session := md5.New()
	io.WriteString(session, c.GetDeviceId())
	io.WriteString(session, ":")
	io.WriteString(session, c.GetClientId())
	io.WriteString(session, ":")
	io.WriteString(session, c.GetSystemVersion())
	io.WriteString(session, ":")
	io.WriteString(session, c.GetProductVersion())
	return hex.EncodeToString(session.Sum(nil))
}
Exemple #2
0
// Creates a new event based on the collection and a single payload
func NewEvent(meta *payload.Collection, payload *payload.Payload) *Event {
	return &Event{
		DeviceID:       meta.GetDeviceId(),
		ClientID:       meta.GetClientId(),
		Session:        meta.GetSession(),
		Nr:             payload.GetNr(),
		SystemVersion:  meta.GetSystemVersion(),
		ProductVersion: meta.GetProductVersion(),
		At:             ConvertIsoformat(payload.GetAt()),
		Event:          payload.GetEvent(),
		System:         meta.GetSystem(),
		ProductGitHash: meta.GetProductGitHash(),
		UserID:         payload.GetUserId(),
		IP:             payload.GetIp(),
		Parameters:     payload.GetParameters(),
		IsTesting:      payload.GetIsTesting()}
}