Skip to content

Commit c04fa59

Browse files
author
Tomas Kubovic
committed
Fixed trim IPv6 brackets in observe devices
1 parent c3ba801 commit c04fa59

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

client/observeDevices.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"errors"
2222
"fmt"
23+
"strings"
2324
"sync"
2425

2526
"github.com/google/uuid"
@@ -220,7 +221,7 @@ func (o *devicesObserver) observe(ctx context.Context) (map[string]uint8, error)
220221
for deviceID, ip := range devicesByIP {
221222
go func(deviceID string, ip string) {
222223
defer wg.Done()
223-
if _, e := o.c.getDeviceByIPWithUpdateCache(ctx, ip, deviceID); e == nil {
224+
if _, e := o.c.getDeviceByIPWithUpdateCache(ctx, strings.Trim(ip, "[]"), deviceID); e == nil {
224225
newDevices.devices.LoadOrStore(deviceID, struct{}{})
225226
}
226227
}(deviceID, ip)

0 commit comments

Comments
 (0)