diff --git a/internal/meshtastic/mqtt.go b/internal/meshtastic/mqtt.go index 01c414d..f6020a6 100644 --- a/internal/meshtastic/mqtt.go +++ b/internal/meshtastic/mqtt.go @@ -33,6 +33,7 @@ func NewBlockCipher(key []byte) cipher.Block { type MQTTClient struct { TopicRegex *regexp.Regexp + Accept func(from uint32) bool BlockCipher cipher.Block MessageHandler func(from uint32, topic string, portNum generated.PortNum, payload []byte) topics []string @@ -105,6 +106,10 @@ func (c *MQTTClient) handleMessage(_ mqtt.Client, msg mqtt.Message) { log.Printf("[warn] skipping MeshPacket from unknown on %v", topic) return } + // check sender + if c.Accept != nil && !c.Accept(from) { + return + } // get Data, try decoded first data := packet.GetDecoded() if data == nil {