Device Exlude also filters types and protocols.

Make regex also search inside a device type and protocol fields instead of a hardware name that can change on hardware change/reset.

Signed-off-by: tekert <tekert@gmail.com>
This commit is contained in:
tekert 2023-07-23 12:57:59 -03:00
parent 895bf1eeb3
commit 43abcf3728

View file

@ -91,10 +91,12 @@ func scanDevices(logger log.Logger) []string {
var scanDeviceResult []string
for _, d := range scanDevices {
deviceName := d.Get("name").String()
if filter.ignored(deviceName) {
level.Info(logger).Log("msg", "Ignoring device", "name", deviceName)
deviceType := d.Get("type").String()
deviceProtocol := d.Get("protocol").String()
if filter.ignored(deviceName) || filter.ignored(deviceType) || filter.ignored(deviceProtocol) {
level.Info(logger).Log("msg", "Ignoring device", "name", deviceName, "type", deviceType, "protocol", deviceProtocol)
} else {
level.Info(logger).Log("msg", "Found device", "name", deviceName)
level.Info(logger).Log("msg", "Found device", "name", deviceName, "type", deviceType, "protocol", deviceProtocol)
scanDeviceResult = append(scanDeviceResult, deviceName)
}
}