Files
2024-05-03 16:44:08 +02:00

26 lines
407 B
Go

package TPLinkClient
import (
"bytes"
"net"
)
func macToBytes(mac string) []byte {
hwAddr, _ := net.ParseMAC(mac)
return hwAddr
}
func decodeString(data []byte) string {
nullIndex := bytes.IndexByte(data, 0)
if nullIndex >= 0 {
s := data[:nullIndex]
return string(s)
} else {
return ""
}
}
func bytesToIp(data []byte) string {
return net.IP{data[0], data[1], data[2], data[3]}.String()
}