更新若干功能

This commit is contained in:
李琦
2026-08-14 07:52:01 +08:00
parent 153c7ed448
commit 89bc265f68
196 changed files with 17675 additions and 0 deletions

21
machineid_other.go Normal file
View File

@@ -0,0 +1,21 @@
//go:build !windows
package main
import (
"os"
"strings"
)
// rawMachineID 读取 Linux/macOS 的机器标识;读不到时返回空串由调用方兜底。
func rawMachineID() string {
for _, p := range []string{"/etc/machine-id", "/var/lib/dbus/machine-id"} {
if b, e := os.ReadFile(p); e == nil {
if v := strings.TrimSpace(string(b)); v != "" {
return v
}
}
}
// macOS 没有 machine-id 文件,退回 IOPlatformUUID 太重,直接用主机名兜底(由调用方哈希)。
return ""
}