From 70a7e83291cd8890bbf6217a9b4d819005c867f1 Mon Sep 17 00:00:00 2001 From: Varun Narravula Date: Thu, 8 Jan 2026 20:40:41 -0800 Subject: [PATCH] feat(ping): send fingerprint and posture checks as part of ping/register --- olm/olm.go | 14 ++++++++------ olm/ping.go | 12 +++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/olm/olm.go b/olm/olm.go index de3f5a7..0810025 100644 --- a/olm/olm.go +++ b/olm/olm.go @@ -356,12 +356,14 @@ func (o *Olm) StartTunnel(config TunnelConfig) { if o.stopRegister == nil { logger.Debug("Sending registration message to server with public key: %s and relay: %v", publicKey, !config.Holepunch) o.stopRegister, o.updateRegister = olmClient.SendMessageInterval("olm/wg/register", map[string]any{ - "publicKey": publicKey.String(), - "relay": !config.Holepunch, - "olmVersion": o.olmConfig.Version, - "olmAgent": o.olmConfig.Agent, - "orgId": config.OrgID, - "userToken": userToken, + "publicKey": publicKey.String(), + "relay": !config.Holepunch, + "olmVersion": o.olmConfig.Version, + "olmAgent": o.olmConfig.Agent, + "orgId": config.OrgID, + "userToken": userToken, + "fingerprint": o.fingerprint, + "postures": o.postures, }, 1*time.Second) // Invoke onRegistered callback if configured diff --git a/olm/ping.go b/olm/ping.go index bbeee9a..0d5235d 100644 --- a/olm/ping.go +++ b/olm/ping.go @@ -8,10 +8,12 @@ import ( "github.com/fosrl/olm/websocket" ) -func sendPing(olm *websocket.Client) error { +func (o *Olm) sendPing(olm *websocket.Client) error { err := olm.SendMessage("olm/ping", map[string]any{ - "timestamp": time.Now().Unix(), - "userToken": olm.GetConfig().UserToken, + "timestamp": time.Now().Unix(), + "userToken": olm.GetConfig().UserToken, + "fingerprint": o.fingerprint, + "postures": o.postures, }) if err != nil { logger.Error("Failed to send ping message: %v", err) @@ -23,7 +25,7 @@ func sendPing(olm *websocket.Client) error { func (o *Olm) keepSendingPing(olm *websocket.Client) { // Send ping immediately on startup - if err := sendPing(olm); err != nil { + if err := o.sendPing(olm); err != nil { logger.Error("Failed to send initial ping: %v", err) } else { logger.Info("Sent initial ping message") @@ -39,7 +41,7 @@ func (o *Olm) keepSendingPing(olm *websocket.Client) { logger.Info("Stopping ping messages") return case <-ticker.C: - if err := sendPing(olm); err != nil { + if err := o.sendPing(olm); err != nil { logger.Error("Failed to send periodic ping: %v", err) } }