Skip to content

Commit 5b2d7e2

Browse files
committed
parse mac
1 parent 2f419cc commit 5b2d7e2

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

internals/wol/wol.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package wol
22

33
import (
4+
"errors"
45
"net"
56

67
"github.com/codeshelldev/gotl/pkg/logger"
@@ -19,7 +20,12 @@ func Init() {
1920
}
2021

2122
func Wake(addr, mac string) error {
22-
return client.Wake(addr, net.HardwareAddr(mac))
23+
hwAddr, err := net.ParseMAC(mac)
24+
if err != nil {
25+
return errors.New("Could not parse mac: " + mac)
26+
}
27+
return client.Wake(addr, hwAddr)
28+
2329
}
2430

2531
func Close() {

0 commit comments

Comments
 (0)