wifictld-analyzer/data/hwaddr.go

17 lines
345 B
Go

package data
import "net"
type HardwareAddr struct{ net.HardwareAddr }
//MarshalJSON to bytearray
func (a HardwareAddr) MarshalText() ([]byte, error) {
return []byte(a.String()), nil
}
// UnmarshalJSON from bytearray
func (a HardwareAddr) UnmarshalText(data []byte) (err error) {
a.HardwareAddr, err = net.ParseMAC(string(data))
return
}