17 lines
334 B
Go
17 lines
334 B
Go
// netx 包示例:本机网络信息(IPv4 地址列表、MAC 地址列表)
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.zeroonesoft.cn/golib/zogo/netx"
|
|
)
|
|
|
|
func main() {
|
|
ips, err := netx.GetLocalIp()
|
|
fmt.Println("本机 IPv4:", ips, "错误:", err)
|
|
|
|
macs, err := netx.GetLocalMac()
|
|
fmt.Println("本机 MAC:", macs, "错误:", err)
|
|
}
|