diff --git a/cmd/meshobserv/meshobserv.go b/cmd/meshobserv/meshobserv.go index 10eb932..e9512ec 100644 --- a/cmd/meshobserv/meshobserv.go +++ b/cmd/meshobserv/meshobserv.go @@ -227,6 +227,16 @@ func main() { } // connect to MQTT client := &meshtastic.MQTTClient{ + Topics: []string{ + "msh/+/2/map/", + "msh/+/2/e/+/+", + "msh/+/+/2/map/", + "msh/+/+/2/e/+/+", + "msh/+/+/+/2/map/", + "msh/+/+/+/2/e/+/+", + "msh/+/+/+/+/2/map/", + "msh/+/+/+/+/2/e/+/+", + }, TopicRegex: regexp.MustCompile(`/2/e/[^/]+/![0-9a-f]+$|/2/map/$`), Accept: func(from uint32) bool { _, found := blocked[from] diff --git a/internal/meshtastic/mqtt.go b/internal/meshtastic/mqtt.go index 62456ee..aa8037a 100644 --- a/internal/meshtastic/mqtt.go +++ b/internal/meshtastic/mqtt.go @@ -31,6 +31,7 @@ func NewBlockCipher(key []byte) cipher.Block { } type MQTTClient struct { + Topics []string TopicRegex *regexp.Regexp Accept func(from uint32) bool BlockCipher cipher.Block @@ -56,11 +57,8 @@ func (c *MQTTClient) Connect() error { } log.Print("[info] connected") topics := make(map[string]byte) - for i, region := range generated.Config_LoRaConfig_RegionCode_name { - if i == 0 { - continue - } - topics["msh/"+region+"/#"] = 0 + for _, topic := range c.Topics { + topics[topic] = 0 } token = c.SubscribeMultiple(topics, nil) <-token.Done()