From ca59c5f316b9c8861fb6a2110be39621d2a28d50 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 29 Jun 2026 10:43:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=BA=E5=99=A8=E4=BA=BAho?= =?UTF-8?q?ps=E4=B8=BA7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/mqtpp/builder.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/mqtpp/builder.go b/internal/mqtpp/builder.go index a41345e..fe3393e 100644 --- a/internal/mqtpp/builder.go +++ b/internal/mqtpp/builder.go @@ -20,6 +20,7 @@ type PacketBuildOptions struct { PSK []byte Encrypt bool ViaMQTT bool + HopLimit uint32 } type TextMessageBuildOptions struct { @@ -252,6 +253,14 @@ func buildMeshPacket(opts PacketBuildOptions, data []byte) ([]byte, error) { out = protowire.AppendTag(out, 14, protowire.VarintType) out = protowire.AppendVarint(out, 1) } + hop := opts.HopLimit + if hop == 0 { + hop = 7 + } + out = protowire.AppendTag(out, 9, protowire.VarintType) + out = protowire.AppendVarint(out, uint64(hop)) + out = protowire.AppendTag(out, 15, protowire.VarintType) + out = protowire.AppendVarint(out, uint64(hop)) return out, nil }