Golang net.ParseMAC() function and HardwareAddr type example
package net
Golang net.ParseMAC() function and HardwareAddr type usage example
package main
import (
"fmt"
"net"
)
func main() {
hwAddr, err := net.ParseMAC("01:23:45:67:89:ab:cd:ef")
if err != nil {
fmt.Println(err)
}
fmt.Printf("Physical hardware address : %s \n", hwAddr.String())
fmt.Printf("Physical hardware address : %#v \n", hwAddr)
}
Sample output :
Physical hardware address : 01:23:45:67:89:ab:cd:ef
Physical hardware address : net.HardwareAddr{0x1, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}
References :
Advertisement
Something interesting
Tutorials
+13.8k Generate salted password with OpenSSL example
+9.2k Golang : How to check if a string with spaces in between is numeric?
+6.4k CodeIgniter : form input set_value cause " to become & quot
+7.2k Golang : Dealing with postal or zip code example
+10.5k RPM : error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
+6k Javascript : Get operating system and browser information
+14.3k Golang : How to shuffle elements in array or slice?
+7.1k Golang : Validate credit card example
+39k Golang : How to iterate over a []string(array)
+13.5k Facebook PHP getUser() returns 0
+10.1k Golang : Find and replace data in all files recursively