feat(netx): 自 go-hua/common 迁入本机网络信息工具并独立成包

- 枚举 IPv4 地址与 MAC 地址(过滤回环与虚拟网卡),附测试、例程与 README
This commit is contained in:
2026-09-20 12:20:50 +08:00
parent f04a14d6bb
commit 792335a3cb
4 changed files with 107 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// 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)
}