1
0
mirror of https://github.com/cmur2/miflorad.git synced 2025-06-26 22:30:24 +02:00

munin-miflora: refactor helper into common, add RSSI and timing metrics

This commit is contained in:
cn
2018-12-20 13:46:39 +01:00
parent 3b4627f988
commit c66b3d2f75
4 changed files with 87 additions and 25 deletions

14
common/misc.go Normal file
View File

@ -0,0 +1,14 @@
package common
import (
"regexp"
"strings"
)
const peripheralAddressAllowedChars = "[^a-z0-9]+"
var peripheralAddressAllowedCharsPattern = regexp.MustCompile(peripheralAddressAllowedChars)
func MifloraGetAlphaNumericID(peripheralAddress string) string {
return peripheralAddressAllowedCharsPattern.ReplaceAllString(strings.ToLower(peripheralAddress), "")
}