From c53d89136693aba31d5bbdc7ce1626bd202ab3b6 Mon Sep 17 00:00:00 2001 From: "Enot (ded) Skelly" Date: Wed, 3 Jun 2026 10:05:57 -0700 Subject: [PATCH] fix: advert sig, flags and type change type to have both value and string return signature and flags byte --- internal/ingest/ingest.go | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/internal/ingest/ingest.go b/internal/ingest/ingest.go index 718c92f..bc4e47c 100644 --- a/internal/ingest/ingest.go +++ b/internal/ingest/ingest.go @@ -264,13 +264,16 @@ type parsedAnonReq struct { } type parsedAdvert struct { - Type string `json:"type"` - PublicKey string `json:"publicKey"` - Timestamp uint32 `json:"timestamp"` - NodeType string `json:"nodeType"` - Name string `json:"name"` - Lat float64 `json:"lat"` - Lon float64 `json:"lon"` + Type string `json:"type"` + PublicKey string `json:"publicKey"` + Timestamp uint32 `json:"timestamp"` + Signature string `json:"signature"` // hex 64 bytes + Flags string `json:"flags"` + DeviceRole int `json:"deviceRole"` + DeviceRoleName string `json:"deviceRoleName"` + Name string `json:"name"` + Lat float64 `json:"lat"` + Lon float64 `json:"lon"` } type parsedEnvelope struct { @@ -531,13 +534,16 @@ func (w *Worker) handlePacket(ctx context.Context, iata, pubkeyHex string, raw [ originPubkey = advert.PublicKey.PublicKeyBytes() appData := advert.AppData() pa := parsedAdvert{ - Type: "ADVERT", - PublicKey: hex.EncodeToString(advert.PublicKey.PublicKeyBytes()), - Timestamp: advert.Timestamp, - NodeType: appData.Type, - Name: appData.Name, - Lat: float64(appData.Lat) / 1e6, - Lon: float64(appData.Lon) / 1e6, + Type: "ADVERT", + PublicKey: hex.EncodeToString(advert.PublicKey.PublicKeyBytes()), + Timestamp: advert.Timestamp, + Signature: hex.EncodeToString(advert.Signature), + Flags: fmt.Sprintf("%02x", advert.Flags()), + DeviceRole: int(advert.Type()), + DeviceRoleName: advert.TypeString(), + Name: appData.Name, + Lat: float64(appData.Lat) / 1e6, + Lon: float64(appData.Lon) / 1e6, } parsedPayload, _ = json.Marshal(pa) }