Daemons Search

This commit is contained in:
mr
2026-01-28 17:22:29 +01:00
parent 0ed2fc0f15
commit 7fd258dc9d
22 changed files with 1631 additions and 680 deletions

30
models/event.go Normal file
View File

@@ -0,0 +1,30 @@
package models
import "encoding/json"
type Event struct {
Type string `json:"type"`
From string `json:"from"` // peerID
User string
DataType int64 `json:"datatype"`
Timestamp int64 `json:"ts"`
Payload []byte `json:"payload"`
Signature []byte `json:"sig"`
}
func (e *Event) RawEvent() *Event {
return &Event{
Type: e.Type,
From: e.From,
User: e.User,
DataType: e.DataType,
Timestamp: e.Timestamp,
Payload: e.Payload,
}
}
func (e *Event) ToRawByte() ([]byte, error) {
return json.Marshal(e.RawEvent())
}