2020
12-24
12-24
golang获取网卡信息操作
我就废话不多说了,大家还是直接看代码吧~packagemainimport("fmt""os/exec""strings""github.com/safchain/ethtool")funcmain(){baseNicPath:="/sys/class/net/"cmd:=exec.Command("ls",baseNicPath)buf,err:=cmd.Output()iferr!=nil{//fmt.Println("Error:",err)return}output:=string(buf)for_,device:=rangestrings.Split(output,"\n"){iflen(device)>1{fmt.Println(device...
继续阅读 >